diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 9532d1e202b414ce38bb592f5c7663731addd73e..d78eb65f2e37d48b9ff5b04f55e0effdcc28dcea 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -63,7 +63,8 @@ static SExprInfo* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t colIndex, int3 static int32_t setShowInfo(SSqlObj* pSql, SSqlInfo* pInfo); static char* getAccountId(SSqlObj* pSql); -static bool serializeExprListToVariant(SArray* pList, tVariant **dest, int16_t colType); +static int convertTimestampStrToInt64(tVariant *pVar, int32_t precision); +static bool serializeExprListToVariant(SArray* pList, tVariant **dest, int16_t colType, uint8_t precision); static int32_t validateParamOfRelationIn(tVariant *pVar, int32_t colType); static bool has(SArray* pFieldList, int32_t startIdx, const char* name); @@ -149,7 +150,7 @@ int16_t getNewResColId(SSqlCmd* pCmd) { // serialize expr in exprlist to binary // formate "type | size | value" -bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType) { +bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType, uint8_t precision) { bool ret = false; if (!pList || pList->size <= 0 || colType < 0) { return ret; @@ -159,14 +160,17 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType) int32_t firstTokenType = item->pNode->token.type; int32_t type = firstTokenType; - //nchar to binary and - toTSDBType(type); - if (type != colType && (type != TSDB_DATA_TYPE_BINARY || colType != TSDB_DATA_TYPE_NCHAR)) { - return false; - } - type = colType; + //nchar to binary and other xxint to bigint + toTSDBType(type); + if (colType != TSDB_DATA_TYPE_TIMESTAMP && !IS_UNSIGNED_NUMERIC_TYPE(colType)) { + if (type != colType && (type != TSDB_DATA_TYPE_BINARY || colType != TSDB_DATA_TYPE_NCHAR)) { + return false; + } + } + type = colType; + + SBufferWriter bw = tbufInitWriter( NULL, false); - SBufferWriter bw = tbufInitWriter( NULL, false ); tbufEnsureCapacity(&bw, 512); int32_t size = (int32_t)(pList->size); @@ -179,16 +183,23 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType) // check all the token type in expr list same or not if (firstTokenType != pSub->token.type) { break; + } + toTSDBType(pSub->token.type); + + tVariant var; + tVariantCreate(&var, &pSub->token); + if (type == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(type)) { + tbufWriteInt64(&bw, var.i64); + } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { + // ugly code, refactor later + if (IS_UNSIGNED_NUMERIC_TYPE(pSub->token.type) || IS_SIGNED_NUMERIC_TYPE(pSub->token.type)) { + tbufWriteUint64(&bw, var.i64); + } else { + tVariantDestroy(&var); + break; + } } - - toTSDBType(pSub->token.type); - - tVariant var; - tVariantCreate(&var, &pSub->token); - if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT - || type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_INT) { - tbufWriteInt64(&bw, var.i64); - } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { + else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { tbufWriteDouble(&bw, var.dKey); } else if (type == TSDB_DATA_TYPE_BINARY){ tbufWriteBinary(&bw, var.pz, var.nLen); @@ -201,6 +212,16 @@ bool serializeExprListToVariant(SArray* pList, tVariant **dst, int16_t colType) } tbufWriteBinary(&bw, buf, twcslen((wchar_t *)buf) * TSDB_NCHAR_SIZE); free(buf); + } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { + if (var.nType == TSDB_DATA_TYPE_BINARY) { + if (convertTimestampStrToInt64(&var, precision) < 0) { + tVariantDestroy(&var); + break; + } + tbufWriteInt64(&bw, var.i64); + } else if (var.nType == TSDB_DATA_TYPE_BIGINT) { + tbufWriteInt64(&bw, var.i64); + } } tVariantDestroy(&var); @@ -286,29 +307,33 @@ static int32_t invalidOperationMsg(char* dstBuffer, const char* errMsg) { return tscInvalidOperationMsg(dstBuffer, errMsg, NULL); } -static int setColumnFilterInfoForTimestamp(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tVariant* pVar) { +static int convertTimestampStrToInt64(tVariant *pVar, int32_t precision) { int64_t time = 0; - const char* msg = "invalid timestamp"; - strdequote(pVar->pz); - char* seg = strnchr(pVar->pz, '-', pVar->nLen, false); - STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); - + char* seg = strnchr(pVar->pz, '-', pVar->nLen, false); if (seg != NULL) { - if (taosParseTime(pVar->pz, &time, pVar->nLen, tinfo.precision, tsDaylight) != TSDB_CODE_SUCCESS) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + if (taosParseTime(pVar->pz, &time, pVar->nLen, precision, tsDaylight) != TSDB_CODE_SUCCESS) { + return -1; } } else { if (tVariantDump(pVar, (char*)&time, TSDB_DATA_TYPE_BIGINT, true)) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + return -1; } } - tVariantDestroy(pVar); tVariantCreateFromBinary(pVar, (char*)&time, 0, TSDB_DATA_TYPE_BIGINT); + return 0; +} +static int setColumnFilterInfoForTimestamp(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tVariant* pVar) { + const char* msg = "invalid timestamp"; + + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); + if (convertTimestampStrToInt64(pVar, tinfo.precision) < -1) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); + } return TSDB_CODE_SUCCESS; } @@ -1282,7 +1307,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC const char* msg1 = "invalid number of tag columns"; const char* msg2 = "tag length too long"; const char* msg3 = "duplicated column names"; - const char* msg4 = "timestamp not allowed in tags"; + //const char* msg4 = "timestamp not allowed in tags"; const char* msg5 = "invalid data type in tags"; const char* msg6 = "invalid tag name"; const char* msg7 = "invalid binary/nchar tag length"; @@ -1298,10 +1323,10 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC for (int32_t i = 0; i < numOfTags; ++i) { TAOS_FIELD* p = taosArrayGet(pTagsList, i); - if (p->type == TSDB_DATA_TYPE_TIMESTAMP) { - invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); - return false; - } + //if (p->type == TSDB_DATA_TYPE_TIMESTAMP) { + // invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + // return false; + //} if (!isValidDataType(p->type)) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); @@ -1359,7 +1384,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC * tags name /column name is truncated in sql.y */ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) { - const char* msg1 = "timestamp not allowed in tags"; + //const char* msg1 = "timestamp not allowed in tags"; const char* msg2 = "duplicated column names"; const char* msg3 = "tag length too long"; const char* msg4 = "invalid tag name"; @@ -1382,10 +1407,10 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) { } // no timestamp allowable - if (pTagField->type == TSDB_DATA_TYPE_TIMESTAMP) { - invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); - return false; - } + //if (pTagField->type == TSDB_DATA_TYPE_TIMESTAMP) { + // invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + // return false; + //} if ((pTagField->type < TSDB_DATA_TYPE_BOOL) || (pTagField->type > TSDB_DATA_TYPE_UBIGINT)) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); @@ -3337,8 +3362,8 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, // TK_GT,TK_GE,TK_EQ,TK_NE are based on the pColumn->lowerBndd } else if (pExpr->tokenId == TK_IN) { - tVariant *pVal; - if (pRight->tokenId != TK_SET || !serializeExprListToVariant(pRight->pParam, &pVal, colType) || colType == TSDB_DATA_TYPE_TIMESTAMP) { + tVariant *pVal; + if (pRight->tokenId != TK_SET || !serializeExprListToVariant(pRight->pParam, &pVal, colType, timePrecision)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg); } if (validateParamOfRelationIn(pVal, colType) != TSDB_CODE_SUCCESS) { @@ -3349,8 +3374,7 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, pColumnFilter->pz = (int64_t)calloc(1, pVal->nLen + 1); pColumnFilter->len = pVal->nLen; pColumnFilter->filterstr = 1; - memcpy((char *)(pColumnFilter->pz), (char *)(pVal->pz), pVal->nLen); - //retVal = tVariantDump(pVal, (char *)(pColumnFilter->pz), TSDB_DATA_TYPE_BINARY, false); + memcpy((char *)(pColumnFilter->pz), (char *)(pVal->pz), pVal->nLen); tVariantDestroy(pVal); free(pVal); @@ -3483,6 +3507,7 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC const char* msg1 = "non binary column not support like operator"; const char* msg2 = "binary column not support this operator"; const char* msg3 = "bool column not support this operator"; + const char* msg4 = "primary key not support this operator"; SColumn* pColumn = tscColumnListInsert(pQueryInfo->colList, pIndex->columnIndex, pTableMeta->id.uid, pSchema); SColumnFilterInfo* pColFilter = NULL; @@ -3539,6 +3564,9 @@ static int32_t extractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SC pColumn->columnIndex = pIndex->columnIndex; pColumn->tableUid = pTableMeta->id.uid; + if (pColumn->columnIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX && pExpr->tokenId == TK_IN) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } STableComInfo tinfo = tscGetTableInfo(pTableMeta); return doExtractColumnFilterInfo(pCmd, pQueryInfo, tinfo.precision, pColFilter, pSchema->type, pExpr); @@ -6808,7 +6836,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { const int32_t STABLE_INDEX = 1; STableMetaInfo* pStableMetaInfo = tscGetMetaInfo(pQueryInfo, STABLE_INDEX); - + // super table name, create table by using dst int32_t numOfTables = (int32_t) taosArrayGetSize(pCreateTable->childTableInfo); for(int32_t j = 0; j < numOfTables; ++j) { @@ -6837,6 +6865,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { // too long tag values will return invalid sql, not be truncated automatically SSchema *pTagSchema = tscGetTableTagSchema(pStableMetaInfo->pTableMeta); + STableComInfo tinfo = tscGetTableInfo(pStableMetaInfo->pTableMeta); STagData *pTag = &pCreateTableInfo->tagdata; SKVRowBuilder kvRowBuilder = {0}; @@ -6886,6 +6915,15 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { tdDestroyKVRowBuilder(&kvRowBuilder); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } + } else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { + if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) { + ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); + if (ret != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) { + pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision); + } } ret = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); @@ -6932,7 +6970,17 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { tdDestroyKVRowBuilder(&kvRowBuilder); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } + } else if (pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { + if (pItem->pVar.nType == TSDB_DATA_TYPE_BINARY) { + ret = convertTimestampStrToInt64(&(pItem->pVar), tinfo.precision); + if (ret != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + } else if (pItem->pVar.nType == TSDB_DATA_TYPE_TIMESTAMP) { + pItem->pVar.i64 = convertTimePrecision(pItem->pVar.i64, TSDB_TIME_PRECISION_NANO, tinfo.precision); + } } + ret = tVariantDump(&(pItem->pVar), tagVal, pSchema->type, true); @@ -8030,12 +8078,22 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS assert(pSqlExpr->pRight == NULL); if (pSqlExpr->type == SQL_NODE_VALUE) { + int32_t ret = TSDB_CODE_SUCCESS; *pExpr = calloc(1, sizeof(tExprNode)); (*pExpr)->nodeType = TSQL_NODE_VALUE; (*pExpr)->pVal = calloc(1, sizeof(tVariant)); - tVariantAssign((*pExpr)->pVal, &pSqlExpr->value); - return TSDB_CODE_SUCCESS; + + STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta; + if (pCols != NULL && taosArrayGetSize(pCols) > 0) { + SColIndex* idx = taosArrayGet(pCols, 0); + SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, idx->colIndex); + // convert time by precision + if (pSchema != NULL && TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && TSDB_DATA_TYPE_BINARY == (*pExpr)->pVal->nType) { + ret = setColumnFilterInfoForTimestamp(pCmd, pQueryInfo, (*pExpr)->pVal); + } + } + return ret; } else if (pSqlExpr->type == SQL_NODE_SQLFUNCTION) { // arithmetic expression on the results of aggregation functions *pExpr = calloc(1, sizeof(tExprNode)); @@ -8092,21 +8150,22 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS } else if (pSqlExpr->tokenId == TK_SET) { int32_t colType = -1; STableMeta* pTableMeta = tscGetMetaInfo(pQueryInfo, 0)->pTableMeta; - if (pCols != NULL) { + if (pCols != NULL && taosArrayGetSize(pCols) > 0) { SColIndex* idx = taosArrayGet(pCols, 0); SSchema* pSchema = tscGetTableColumnSchema(pTableMeta, idx->colIndex); if (pSchema != NULL) { colType = pSchema->type; } } - tVariant *pVal; 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) { colType = TSDB_DATA_TYPE_DOUBLE; } - if (serializeExprListToVariant(pSqlExpr->pParam, &pVal, colType) == false) { + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); + if (serializeExprListToVariant(pSqlExpr->pParam, &pVal, colType, tinfo.precision) == false) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "not support filter expression"); } *pExpr = calloc(1, sizeof(tExprNode)); diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 0e9ec053cc5fb0f402fe9ffd42f3435fb4ca3cad..973b88fef9357b5e4b17ad0f9266d18cb98c2b1a 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -476,7 +476,14 @@ void buildFilterSetFromBinary(void **q, const char *buf, int32_t len) { int dummy = -1; int32_t sz = tbufReadInt32(&br); for (int32_t i = 0; i < sz; i++) { - if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT || type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_INT) { + if (type == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(type)) { + int64_t val = tbufReadInt64(&br); + taosHashPut(pObj, (char *)&val, sizeof(val), &dummy, sizeof(dummy)); + } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { + uint64_t val = tbufReadUint64(&br); + taosHashPut(pObj, (char *)&val, sizeof(val), &dummy, sizeof(dummy)); + } + else if (type == TSDB_DATA_TYPE_TIMESTAMP) { int64_t val = tbufReadInt64(&br); taosHashPut(pObj, (char *)&val, sizeof(val), &dummy, sizeof(dummy)); } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 33dab51633b244326b0490c6bf7b784bc41fe77f..1168eeb231fec49907b7ced9f019f55af2b085a8 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -77,6 +77,10 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) { pVar->nLen = strRmquote(pVar->pz, token->n); break; } + case TSDB_DATA_TYPE_TIMESTAMP: { + pVar->i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + break; + } default: { // nType == 0 means the null value type = TSDB_DATA_TYPE_NULL; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index f6047d57dc3e238f5eb20830b34c42034fac405d..d15f044b6505555f9c3bca61f653f13a43b0bcfc 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -128,29 +128,29 @@ #define TK_USING 110 #define TK_AS 111 #define TK_NULL 112 -#define TK_SELECT 113 -#define TK_UNION 114 -#define TK_ALL 115 -#define TK_DISTINCT 116 -#define TK_FROM 117 -#define TK_VARIABLE 118 -#define TK_INTERVAL 119 -#define TK_SESSION 120 -#define TK_STATE_WINDOW 121 -#define TK_FILL 122 -#define TK_SLIDING 123 -#define TK_ORDER 124 -#define TK_BY 125 -#define TK_ASC 126 -#define TK_DESC 127 -#define TK_GROUP 128 -#define TK_HAVING 129 -#define TK_LIMIT 130 -#define TK_OFFSET 131 -#define TK_SLIMIT 132 -#define TK_SOFFSET 133 -#define TK_WHERE 134 -#define TK_NOW 135 +#define TK_NOW 113 +#define TK_SELECT 114 +#define TK_UNION 115 +#define TK_ALL 116 +#define TK_DISTINCT 117 +#define TK_FROM 118 +#define TK_VARIABLE 119 +#define TK_INTERVAL 120 +#define TK_SESSION 121 +#define TK_STATE_WINDOW 122 +#define TK_FILL 123 +#define TK_SLIDING 124 +#define TK_ORDER 125 +#define TK_BY 126 +#define TK_ASC 127 +#define TK_DESC 128 +#define TK_GROUP 129 +#define TK_HAVING 130 +#define TK_LIMIT 131 +#define TK_OFFSET 132 +#define TK_SLIMIT 133 +#define TK_SOFFSET 134 +#define TK_WHERE 135 #define TK_RESET 136 #define TK_QUERY 137 #define TK_SYNCDB 138 diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 63bfd859768f92da6ae1e90c27950337c528ab8e..a54d46974ae94c56cf5d967be1daee1ab11b7190 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -437,6 +437,7 @@ tagitem(A) ::= FLOAT(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= STRING(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= BOOL(X). { toTSDBType(X.type); tVariantCreate(&A, &X); } tagitem(A) ::= NULL(X). { X.type = 0; tVariantCreate(&A, &X); } +tagitem(A) ::= NOW(X). { X.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&A, &X);} tagitem(A) ::= MINUS(X) INTEGER(Y).{ X.n += Y.n; diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 7b106c178d8f7554d6316d8a5fc1e1504b763199..75c0b0d22a42097de588dea4abc02f3f494ee195 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -2891,7 +2891,9 @@ void setTagValue(SOperatorInfo* pOperatorInfo, void *pTable, SQLFunctionCtx* pCt doSetTagValueInParam(pTable, pLocalExprInfo->base.colInfo.colId, &pCtx[idx].tag, pLocalExprInfo->base.resType, pLocalExprInfo->base.resBytes); - if (IS_NUMERIC_TYPE(pLocalExprInfo->base.resType) || pLocalExprInfo->base.resType == TSDB_DATA_TYPE_BOOL) { + if (IS_NUMERIC_TYPE(pLocalExprInfo->base.resType) + || pLocalExprInfo->base.resType == TSDB_DATA_TYPE_BOOL + || pLocalExprInfo->base.resType == TSDB_DATA_TYPE_TIMESTAMP) { memcpy(pRuntimeEnv->tagVal + offset, &pCtx[idx].tag.i64, pLocalExprInfo->base.resBytes); } else { memcpy(pRuntimeEnv->tagVal + offset, pCtx[idx].tag.pz, pCtx[idx].tag.nLen); diff --git a/src/query/src/qFilterfunc.c b/src/query/src/qFilterfunc.c index 7e8dd66ed12ee38d9dba5c982a5b78fda9a872ac..1c1ec21d653b5b96fe792aa05641191a441b8e8d 100644 --- a/src/query/src/qFilterfunc.c +++ b/src/query/src/qFilterfunc.c @@ -254,15 +254,23 @@ bool notNullOperator(SColumnFilterElem *pFilter, const char* minval, const char* return true; } bool inOperator(SColumnFilterElem *pFilter, const char* minval, const char* maxval, int16_t type) { - if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT || type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_INT) { + if (type == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_TIMESTAMP) { int64_t minv = -1, maxv = -1; GET_TYPED_DATA(minv, int64_t, type, minval); GET_TYPED_DATA(maxv, int64_t, type, maxval); if (minv == maxv) { return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&minv, sizeof(minv)); } - return true; - } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { + return false; + } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { + uint64_t minv = 0, maxv = 0; + GET_TYPED_DATA(minv, uint64_t, type, minval); + GET_TYPED_DATA(maxv, uint64_t, type, maxval); + if (minv == maxv) { + return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&minv, sizeof(minv)); + } + return false; + }else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_FLOAT) { double v; GET_TYPED_DATA(v, double, type, minval); return NULL != taosHashGet((SHashObj *)pFilter->q, (char *)&v, sizeof(v)); diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 8764c6d0d3f2c7e31817f48bb0030a09aee2a5c4..d3f478ebeb5fefe8bba2df859028dc8b97e66527 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -129,16 +129,16 @@ typedef union { #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 #define YYNSTATE 347 -#define YYNRULE 284 +#define YYNRULE 285 #define YYNTOKEN 190 #define YY_MAX_SHIFT 346 -#define YY_MIN_SHIFTREDUCE 548 -#define YY_MAX_SHIFTREDUCE 831 -#define YY_ERROR_ACTION 832 -#define YY_ACCEPT_ACTION 833 -#define YY_NO_ACTION 834 -#define YY_MIN_REDUCE 835 -#define YY_MAX_REDUCE 1118 +#define YY_MIN_SHIFTREDUCE 549 +#define YY_MAX_SHIFTREDUCE 833 +#define YY_ERROR_ACTION 834 +#define YY_ACCEPT_ACTION 835 +#define YY_NO_ACTION 836 +#define YY_MIN_REDUCE 837 +#define YY_MAX_REDUCE 1121 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -204,82 +204,82 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (734) +#define YY_ACTTAB_COUNT (735) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 23, 597, 1007, 597, 219, 344, 194, 833, 346, 598, - /* 10 */ 597, 598, 197, 54, 55, 225, 58, 59, 598, 986, - /* 20 */ 239, 48, 1094, 57, 300, 62, 60, 63, 61, 998, - /* 30 */ 998, 231, 233, 53, 52, 986, 986, 51, 50, 49, - /* 40 */ 54, 55, 35, 58, 59, 222, 223, 239, 48, 597, - /* 50 */ 57, 300, 62, 60, 63, 61, 998, 598, 152, 236, - /* 60 */ 53, 52, 235, 152, 51, 50, 49, 55, 1004, 58, - /* 70 */ 59, 772, 261, 239, 48, 240, 57, 300, 62, 60, - /* 80 */ 63, 61, 29, 195, 83, 221, 53, 52, 145, 983, - /* 90 */ 51, 50, 49, 549, 550, 551, 552, 553, 554, 555, - /* 100 */ 556, 557, 558, 559, 560, 561, 345, 773, 770, 220, + /* 0 */ 23, 598, 1010, 598, 219, 344, 194, 835, 346, 599, + /* 10 */ 598, 599, 197, 54, 55, 225, 58, 59, 599, 988, + /* 20 */ 239, 48, 1097, 57, 300, 62, 60, 63, 61, 1001, + /* 30 */ 1001, 231, 233, 53, 52, 988, 988, 51, 50, 49, + /* 40 */ 54, 55, 35, 58, 59, 222, 223, 239, 48, 598, + /* 50 */ 57, 300, 62, 60, 63, 61, 1001, 599, 152, 236, + /* 60 */ 53, 52, 235, 152, 51, 50, 49, 55, 1007, 58, + /* 70 */ 59, 630, 261, 239, 48, 240, 57, 300, 62, 60, + /* 80 */ 63, 61, 29, 83, 982, 221, 53, 52, 145, 985, + /* 90 */ 51, 50, 49, 550, 551, 552, 553, 554, 555, 556, + /* 100 */ 557, 558, 559, 560, 561, 562, 345, 80, 772, 220, /* 110 */ 95, 77, 54, 55, 35, 58, 59, 42, 197, 239, - /* 120 */ 48, 197, 57, 300, 62, 60, 63, 61, 1095, 298, - /* 130 */ 1043, 1095, 53, 52, 197, 89, 51, 50, 49, 54, - /* 140 */ 56, 330, 58, 59, 1095, 974, 239, 48, 629, 57, - /* 150 */ 300, 62, 60, 63, 61, 268, 267, 229, 152, 53, - /* 160 */ 52, 983, 248, 51, 50, 49, 41, 296, 339, 338, + /* 120 */ 48, 197, 57, 300, 62, 60, 63, 61, 1098, 232, + /* 130 */ 1046, 1098, 53, 52, 197, 89, 51, 50, 49, 54, + /* 140 */ 56, 264, 58, 59, 1098, 976, 239, 48, 974, 57, + /* 150 */ 300, 62, 60, 63, 61, 268, 267, 229, 298, 53, + /* 160 */ 52, 985, 248, 51, 50, 49, 41, 296, 339, 338, /* 170 */ 295, 294, 293, 337, 292, 336, 335, 334, 291, 333, - /* 180 */ 332, 946, 934, 935, 936, 937, 938, 939, 940, 941, - /* 190 */ 942, 943, 944, 945, 947, 948, 58, 59, 24, 984, - /* 200 */ 239, 48, 35, 57, 300, 62, 60, 63, 61, 51, - /* 210 */ 50, 49, 972, 53, 52, 205, 881, 51, 50, 49, - /* 220 */ 76, 179, 206, 35, 340, 915, 92, 129, 128, 204, - /* 230 */ 1044, 237, 280, 305, 83, 200, 238, 785, 35, 776, - /* 240 */ 774, 779, 777, 980, 780, 230, 238, 785, 715, 983, - /* 250 */ 774, 6, 777, 971, 780, 114, 108, 119, 969, 970, - /* 260 */ 34, 973, 118, 124, 127, 117, 309, 42, 217, 218, - /* 270 */ 983, 121, 301, 41, 9, 339, 338, 35, 217, 218, - /* 280 */ 337, 310, 336, 335, 334, 983, 333, 332, 232, 116, - /* 290 */ 260, 262, 75, 954, 298, 952, 953, 330, 242, 213, - /* 300 */ 955, 36, 957, 958, 956, 718, 959, 960, 62, 60, - /* 310 */ 63, 61, 775, 152, 778, 64, 53, 52, 14, 247, - /* 320 */ 51, 50, 49, 703, 982, 64, 700, 1091, 701, 35, - /* 330 */ 702, 5, 38, 169, 35, 188, 186, 184, 168, 102, - /* 340 */ 97, 101, 183, 132, 131, 130, 35, 786, 94, 91, - /* 350 */ 679, 1090, 783, 782, 244, 245, 35, 786, 35, 35, - /* 360 */ 53, 52, 891, 782, 51, 50, 49, 179, 90, 243, - /* 370 */ 781, 241, 311, 308, 307, 1089, 983, 312, 320, 319, - /* 380 */ 781, 983, 78, 282, 722, 88, 882, 253, 71, 316, - /* 390 */ 249, 179, 246, 983, 315, 314, 257, 256, 80, 317, - /* 400 */ 68, 318, 322, 983, 81, 983, 983, 343, 342, 137, - /* 410 */ 143, 141, 140, 1, 167, 3, 180, 751, 752, 734, - /* 420 */ 742, 302, 743, 1054, 689, 784, 33, 215, 72, 147, - /* 430 */ 65, 264, 26, 704, 36, 285, 691, 264, 287, 690, - /* 440 */ 806, 787, 69, 596, 74, 36, 65, 216, 93, 65, - /* 450 */ 25, 25, 16, 25, 15, 288, 107, 198, 106, 18, - /* 460 */ 707, 17, 708, 199, 705, 20, 706, 19, 201, 113, - /* 470 */ 985, 112, 678, 22, 196, 21, 126, 125, 202, 203, - /* 480 */ 208, 209, 210, 207, 193, 1114, 1106, 1053, 227, 1050, - /* 490 */ 1049, 228, 321, 258, 144, 1006, 1017, 45, 1014, 1015, - /* 500 */ 1019, 999, 265, 1036, 146, 150, 981, 274, 1035, 163, - /* 510 */ 142, 269, 164, 157, 979, 733, 165, 224, 789, 263, - /* 520 */ 166, 153, 894, 283, 290, 43, 191, 271, 39, 299, - /* 530 */ 890, 306, 73, 278, 1113, 996, 70, 47, 104, 154, - /* 540 */ 155, 1112, 281, 1109, 170, 313, 1105, 110, 279, 156, - /* 550 */ 1104, 277, 158, 275, 273, 1101, 159, 171, 270, 912, - /* 560 */ 40, 37, 44, 192, 878, 120, 876, 122, 123, 874, - /* 570 */ 873, 250, 182, 871, 870, 869, 868, 867, 866, 185, - /* 580 */ 187, 863, 861, 859, 857, 189, 854, 190, 46, 79, - /* 590 */ 84, 272, 331, 1037, 115, 323, 324, 325, 326, 327, - /* 600 */ 328, 329, 214, 341, 234, 289, 831, 252, 251, 830, - /* 610 */ 211, 212, 254, 98, 99, 255, 829, 812, 811, 259, - /* 620 */ 10, 264, 872, 284, 133, 710, 174, 134, 173, 913, - /* 630 */ 172, 175, 177, 176, 135, 178, 865, 914, 864, 2, - /* 640 */ 136, 950, 856, 855, 82, 30, 4, 266, 160, 161, - /* 650 */ 162, 962, 85, 735, 148, 149, 738, 86, 226, 740, - /* 660 */ 87, 276, 31, 744, 151, 13, 11, 32, 12, 27, - /* 670 */ 28, 286, 96, 94, 642, 638, 636, 635, 634, 631, - /* 680 */ 601, 297, 100, 7, 303, 790, 788, 8, 304, 103, - /* 690 */ 105, 66, 67, 109, 111, 681, 680, 677, 623, 36, - /* 700 */ 621, 613, 619, 615, 617, 611, 609, 645, 644, 643, - /* 710 */ 641, 640, 639, 637, 633, 632, 181, 599, 565, 835, - /* 720 */ 563, 834, 834, 834, 834, 834, 834, 834, 834, 834, - /* 730 */ 834, 834, 138, 139, + /* 180 */ 332, 948, 936, 937, 938, 939, 940, 941, 942, 943, + /* 190 */ 944, 945, 946, 947, 949, 950, 58, 59, 24, 986, + /* 200 */ 239, 48, 253, 57, 300, 62, 60, 63, 61, 35, + /* 210 */ 195, 257, 256, 53, 52, 205, 330, 51, 50, 49, + /* 220 */ 53, 52, 206, 14, 51, 50, 49, 129, 128, 204, + /* 230 */ 298, 238, 787, 305, 83, 776, 81, 779, 116, 782, + /* 240 */ 200, 238, 787, 883, 35, 776, 330, 779, 179, 782, + /* 250 */ 114, 108, 119, 94, 91, 1094, 984, 118, 124, 127, + /* 260 */ 117, 987, 35, 217, 218, 152, 121, 301, 42, 41, + /* 270 */ 264, 339, 338, 217, 218, 242, 337, 1093, 336, 335, + /* 280 */ 334, 704, 333, 332, 701, 1117, 702, 230, 703, 1092, + /* 290 */ 260, 985, 75, 956, 680, 954, 955, 340, 917, 213, + /* 300 */ 957, 247, 959, 960, 958, 309, 961, 962, 152, 985, + /* 310 */ 64, 35, 244, 245, 1, 167, 62, 60, 63, 61, + /* 320 */ 64, 893, 320, 319, 53, 52, 179, 1109, 51, 50, + /* 330 */ 49, 5, 38, 169, 92, 282, 215, 88, 168, 102, + /* 340 */ 97, 101, 788, 783, 720, 76, 243, 35, 241, 784, + /* 350 */ 308, 307, 788, 783, 310, 188, 186, 184, 985, 784, + /* 360 */ 35, 35, 183, 132, 131, 130, 971, 972, 34, 975, + /* 370 */ 35, 68, 249, 35, 246, 35, 315, 314, 973, 778, + /* 380 */ 1047, 781, 280, 884, 51, 50, 49, 777, 179, 780, + /* 390 */ 311, 705, 706, 71, 985, 343, 342, 137, 143, 141, + /* 400 */ 140, 90, 717, 312, 316, 3, 180, 985, 985, 753, + /* 410 */ 754, 774, 33, 317, 69, 78, 318, 985, 322, 302, + /* 420 */ 985, 262, 985, 736, 724, 744, 745, 690, 216, 9, + /* 430 */ 285, 36, 692, 147, 72, 65, 26, 36, 287, 691, + /* 440 */ 36, 288, 65, 808, 789, 237, 597, 775, 93, 65, + /* 450 */ 16, 74, 15, 25, 25, 107, 25, 106, 18, 709, + /* 460 */ 17, 710, 707, 198, 708, 6, 20, 113, 19, 112, + /* 470 */ 199, 22, 201, 21, 126, 125, 196, 202, 203, 679, + /* 480 */ 208, 209, 210, 207, 193, 1057, 1056, 227, 1053, 1052, + /* 490 */ 228, 321, 258, 785, 144, 1009, 45, 1020, 1017, 1018, + /* 500 */ 1002, 786, 265, 1022, 1039, 163, 146, 150, 274, 1038, + /* 510 */ 983, 164, 142, 981, 165, 166, 791, 896, 290, 43, + /* 520 */ 735, 999, 191, 39, 279, 154, 269, 299, 892, 306, + /* 530 */ 224, 1116, 104, 1115, 271, 1112, 278, 170, 73, 70, + /* 540 */ 153, 47, 313, 283, 1108, 281, 110, 1107, 1104, 171, + /* 550 */ 914, 155, 277, 40, 37, 44, 275, 156, 192, 273, + /* 560 */ 880, 120, 878, 122, 123, 158, 876, 875, 270, 250, + /* 570 */ 182, 873, 872, 871, 870, 869, 46, 868, 185, 331, + /* 580 */ 187, 865, 863, 861, 859, 189, 856, 190, 115, 263, + /* 590 */ 79, 84, 272, 323, 1040, 324, 325, 326, 327, 328, + /* 600 */ 329, 341, 833, 252, 214, 832, 251, 254, 234, 289, + /* 610 */ 255, 831, 814, 813, 259, 211, 212, 264, 98, 10, + /* 620 */ 99, 82, 284, 712, 266, 85, 30, 874, 737, 148, + /* 630 */ 867, 174, 133, 173, 915, 172, 175, 176, 178, 177, + /* 640 */ 134, 135, 916, 136, 866, 952, 858, 4, 857, 740, + /* 650 */ 162, 159, 157, 149, 86, 160, 964, 2, 161, 742, + /* 660 */ 87, 226, 276, 31, 746, 151, 11, 32, 13, 12, + /* 670 */ 27, 28, 286, 643, 94, 96, 639, 637, 636, 635, + /* 680 */ 632, 297, 7, 100, 602, 790, 303, 792, 8, 304, + /* 690 */ 103, 682, 66, 105, 36, 67, 109, 111, 681, 678, + /* 700 */ 624, 622, 614, 620, 616, 618, 612, 610, 646, 645, + /* 710 */ 644, 642, 641, 640, 638, 634, 633, 181, 600, 566, + /* 720 */ 564, 837, 836, 836, 836, 836, 836, 836, 836, 836, + /* 730 */ 836, 836, 836, 138, 139, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 259, 1, 194, 1, 193, 194, 259, 191, 192, 9, @@ -289,73 +289,73 @@ static const YYCODETYPE yy_lookahead[] = { /* 40 */ 13, 14, 194, 16, 17, 256, 256, 20, 21, 1, /* 50 */ 23, 24, 25, 26, 27, 28, 240, 9, 194, 200, /* 60 */ 33, 34, 200, 194, 37, 38, 39, 14, 260, 16, - /* 70 */ 17, 1, 256, 20, 21, 200, 23, 24, 25, 26, - /* 80 */ 27, 28, 80, 259, 80, 237, 33, 34, 194, 241, + /* 70 */ 17, 5, 256, 20, 21, 200, 23, 24, 25, 26, + /* 80 */ 27, 28, 80, 80, 194, 237, 33, 34, 194, 241, /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 37, 81, 61, - /* 110 */ 201, 111, 13, 14, 194, 16, 17, 113, 259, 20, - /* 120 */ 21, 259, 23, 24, 25, 26, 27, 28, 269, 82, + /* 100 */ 52, 53, 54, 55, 56, 57, 58, 81, 81, 61, + /* 110 */ 201, 111, 13, 14, 194, 16, 17, 114, 259, 20, + /* 120 */ 21, 259, 23, 24, 25, 26, 27, 28, 269, 239, /* 130 */ 266, 269, 33, 34, 259, 266, 37, 38, 39, 13, - /* 140 */ 14, 84, 16, 17, 269, 236, 20, 21, 5, 23, - /* 150 */ 24, 25, 26, 27, 28, 261, 262, 237, 194, 33, + /* 140 */ 14, 115, 16, 17, 269, 236, 20, 21, 0, 23, + /* 150 */ 24, 25, 26, 27, 28, 261, 262, 237, 82, 33, /* 160 */ 34, 241, 194, 37, 38, 39, 92, 93, 94, 95, /* 170 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, /* 180 */ 106, 215, 216, 217, 218, 219, 220, 221, 222, 223, /* 190 */ 224, 225, 226, 227, 228, 229, 16, 17, 44, 231, - /* 200 */ 20, 21, 194, 23, 24, 25, 26, 27, 28, 37, - /* 210 */ 38, 39, 0, 33, 34, 61, 199, 37, 38, 39, - /* 220 */ 201, 204, 68, 194, 213, 214, 201, 73, 74, 75, - /* 230 */ 266, 60, 268, 79, 80, 259, 1, 2, 194, 5, - /* 240 */ 5, 7, 7, 194, 9, 237, 1, 2, 91, 241, - /* 250 */ 5, 80, 7, 234, 9, 62, 63, 64, 233, 234, - /* 260 */ 235, 236, 69, 70, 71, 72, 237, 113, 33, 34, - /* 270 */ 241, 78, 37, 92, 117, 94, 95, 194, 33, 34, - /* 280 */ 99, 237, 101, 102, 103, 241, 105, 106, 239, 76, - /* 290 */ 136, 81, 138, 215, 82, 217, 218, 84, 68, 145, - /* 300 */ 222, 91, 224, 225, 226, 37, 228, 229, 25, 26, - /* 310 */ 27, 28, 5, 194, 7, 80, 33, 34, 80, 68, - /* 320 */ 37, 38, 39, 2, 241, 80, 5, 259, 7, 194, - /* 330 */ 9, 62, 63, 64, 194, 62, 63, 64, 69, 70, - /* 340 */ 71, 72, 69, 70, 71, 72, 194, 112, 110, 111, - /* 350 */ 5, 259, 118, 118, 33, 34, 194, 112, 194, 194, - /* 360 */ 33, 34, 199, 118, 37, 38, 39, 204, 243, 139, - /* 370 */ 135, 141, 237, 143, 144, 259, 241, 237, 33, 34, - /* 380 */ 135, 241, 257, 264, 116, 266, 199, 137, 91, 237, - /* 390 */ 139, 204, 141, 241, 143, 144, 146, 147, 81, 237, - /* 400 */ 91, 237, 237, 241, 81, 241, 241, 65, 66, 67, - /* 410 */ 62, 63, 64, 202, 203, 197, 198, 126, 127, 81, - /* 420 */ 81, 15, 81, 232, 81, 118, 80, 259, 131, 91, - /* 430 */ 91, 114, 91, 112, 91, 81, 81, 114, 81, 81, - /* 440 */ 81, 81, 133, 81, 80, 91, 91, 259, 91, 91, - /* 450 */ 91, 91, 140, 91, 142, 109, 140, 259, 142, 140, - /* 460 */ 5, 142, 7, 259, 5, 140, 7, 142, 259, 140, - /* 470 */ 242, 142, 108, 140, 259, 142, 76, 77, 259, 259, - /* 480 */ 259, 259, 259, 259, 259, 242, 242, 232, 232, 232, - /* 490 */ 232, 232, 232, 194, 194, 194, 194, 258, 194, 194, - /* 500 */ 194, 240, 240, 267, 194, 194, 240, 194, 267, 244, - /* 510 */ 60, 263, 194, 250, 194, 118, 194, 263, 112, 195, - /* 520 */ 194, 254, 194, 124, 194, 194, 194, 263, 194, 194, - /* 530 */ 194, 194, 130, 263, 194, 255, 132, 129, 194, 253, - /* 540 */ 252, 194, 128, 194, 194, 194, 194, 194, 123, 251, - /* 550 */ 194, 122, 249, 121, 120, 194, 248, 194, 119, 194, - /* 560 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - /* 570 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - /* 580 */ 194, 194, 194, 194, 194, 194, 194, 194, 134, 195, - /* 590 */ 195, 195, 107, 195, 90, 89, 50, 86, 88, 54, - /* 600 */ 87, 85, 195, 82, 195, 195, 5, 5, 148, 5, - /* 610 */ 195, 195, 148, 201, 201, 5, 5, 94, 93, 137, - /* 620 */ 80, 114, 195, 109, 196, 81, 206, 196, 210, 212, - /* 630 */ 211, 209, 208, 207, 196, 205, 195, 214, 195, 202, - /* 640 */ 196, 230, 195, 195, 115, 80, 197, 91, 247, 246, - /* 650 */ 245, 230, 91, 81, 80, 91, 81, 80, 1, 81, - /* 660 */ 80, 80, 91, 81, 80, 80, 125, 91, 125, 80, - /* 670 */ 80, 109, 76, 110, 9, 5, 5, 5, 5, 5, - /* 680 */ 83, 15, 76, 80, 24, 112, 81, 80, 58, 142, - /* 690 */ 142, 16, 16, 142, 142, 5, 5, 81, 5, 91, + /* 200 */ 20, 21, 137, 23, 24, 25, 26, 27, 28, 194, + /* 210 */ 259, 146, 147, 33, 34, 61, 84, 37, 38, 39, + /* 220 */ 33, 34, 68, 80, 37, 38, 39, 73, 74, 75, + /* 230 */ 82, 1, 2, 79, 80, 5, 81, 7, 76, 9, + /* 240 */ 259, 1, 2, 199, 194, 5, 84, 7, 204, 9, + /* 250 */ 62, 63, 64, 110, 111, 259, 241, 69, 70, 71, + /* 260 */ 72, 242, 194, 33, 34, 194, 78, 37, 114, 92, + /* 270 */ 115, 94, 95, 33, 34, 68, 99, 259, 101, 102, + /* 280 */ 103, 2, 105, 106, 5, 242, 7, 237, 9, 259, + /* 290 */ 136, 241, 138, 215, 5, 217, 218, 213, 214, 145, + /* 300 */ 222, 68, 224, 225, 226, 237, 228, 229, 194, 241, + /* 310 */ 80, 194, 33, 34, 202, 203, 25, 26, 27, 28, + /* 320 */ 80, 199, 33, 34, 33, 34, 204, 242, 37, 38, + /* 330 */ 39, 62, 63, 64, 201, 264, 259, 266, 69, 70, + /* 340 */ 71, 72, 112, 113, 37, 201, 139, 194, 141, 119, + /* 350 */ 143, 144, 112, 113, 237, 62, 63, 64, 241, 119, + /* 360 */ 194, 194, 69, 70, 71, 72, 233, 234, 235, 236, + /* 370 */ 194, 91, 139, 194, 141, 194, 143, 144, 234, 5, + /* 380 */ 266, 7, 268, 199, 37, 38, 39, 5, 204, 7, + /* 390 */ 237, 112, 113, 91, 241, 65, 66, 67, 62, 63, + /* 400 */ 64, 243, 91, 237, 237, 197, 198, 241, 241, 127, + /* 410 */ 128, 1, 80, 237, 134, 257, 237, 241, 237, 15, + /* 420 */ 241, 81, 241, 81, 117, 81, 81, 81, 259, 118, + /* 430 */ 81, 91, 81, 91, 132, 91, 91, 91, 81, 81, + /* 440 */ 91, 109, 91, 81, 81, 60, 81, 37, 91, 91, + /* 450 */ 140, 80, 142, 91, 91, 140, 91, 142, 140, 5, + /* 460 */ 142, 7, 5, 259, 7, 80, 140, 140, 142, 142, + /* 470 */ 259, 140, 259, 142, 76, 77, 259, 259, 259, 108, + /* 480 */ 259, 259, 259, 259, 259, 232, 232, 232, 232, 232, + /* 490 */ 232, 232, 194, 119, 194, 194, 258, 194, 194, 194, + /* 500 */ 240, 119, 240, 194, 267, 244, 194, 194, 194, 267, + /* 510 */ 240, 194, 60, 194, 194, 194, 112, 194, 194, 194, + /* 520 */ 119, 255, 194, 194, 124, 253, 263, 194, 194, 194, + /* 530 */ 263, 194, 194, 194, 263, 194, 263, 194, 131, 133, + /* 540 */ 254, 130, 194, 125, 194, 129, 194, 194, 194, 194, + /* 550 */ 194, 252, 123, 194, 194, 194, 122, 251, 194, 121, + /* 560 */ 194, 194, 194, 194, 194, 249, 194, 194, 120, 194, + /* 570 */ 194, 194, 194, 194, 194, 194, 135, 194, 194, 107, + /* 580 */ 194, 194, 194, 194, 194, 194, 194, 194, 90, 195, + /* 590 */ 195, 195, 195, 89, 195, 50, 86, 88, 54, 87, + /* 600 */ 85, 82, 5, 5, 195, 5, 148, 148, 195, 195, + /* 610 */ 5, 5, 94, 93, 137, 195, 195, 115, 201, 80, + /* 620 */ 201, 116, 109, 81, 91, 91, 80, 195, 81, 80, + /* 630 */ 195, 206, 196, 210, 212, 211, 209, 207, 205, 208, + /* 640 */ 196, 196, 214, 196, 195, 230, 195, 197, 195, 81, + /* 650 */ 245, 248, 250, 91, 80, 247, 230, 202, 246, 81, + /* 660 */ 80, 1, 80, 91, 81, 80, 126, 91, 80, 126, + /* 670 */ 80, 80, 109, 9, 110, 76, 5, 5, 5, 5, + /* 680 */ 5, 15, 80, 76, 83, 81, 24, 112, 80, 58, + /* 690 */ 142, 5, 16, 142, 91, 16, 142, 142, 5, 81, /* 700 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 710 */ 5, 5, 5, 5, 5, 5, 91, 83, 60, 0, - /* 720 */ 59, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 730 */ 270, 270, 21, 21, 270, 270, 270, 270, 270, 270, + /* 710 */ 5, 5, 5, 5, 5, 5, 5, 91, 83, 60, + /* 720 */ 59, 0, 270, 270, 270, 270, 270, 270, 270, 270, + /* 730 */ 270, 270, 270, 21, 21, 270, 270, 270, 270, 270, /* 740 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, /* 750 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, /* 760 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, @@ -374,109 +374,109 @@ static const YYCODETYPE yy_lookahead[] = { /* 890 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, /* 900 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, /* 910 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 920 */ 270, 270, 270, 270, + /* 920 */ 270, 270, 270, 270, 270, }; #define YY_SHIFT_COUNT (346) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (719) +#define YY_SHIFT_MAX (721) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 154, 74, 74, 181, 181, 47, 235, 245, 245, 2, + /* 0 */ 154, 74, 74, 177, 177, 76, 230, 240, 240, 2, /* 10 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - /* 20 */ 9, 9, 9, 0, 48, 245, 321, 321, 321, 4, - /* 30 */ 4, 9, 9, 9, 212, 9, 9, 213, 47, 57, - /* 40 */ 57, 143, 734, 734, 734, 245, 245, 245, 245, 245, - /* 50 */ 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - /* 60 */ 245, 245, 245, 245, 245, 321, 321, 321, 345, 345, - /* 70 */ 345, 345, 345, 345, 345, 9, 9, 9, 268, 9, - /* 80 */ 9, 9, 4, 4, 9, 9, 9, 9, 291, 291, - /* 90 */ 157, 4, 9, 9, 9, 9, 9, 9, 9, 9, + /* 20 */ 9, 9, 9, 0, 48, 240, 279, 279, 279, 3, + /* 30 */ 3, 9, 9, 9, 148, 9, 9, 162, 76, 132, + /* 40 */ 132, 66, 735, 735, 735, 240, 240, 240, 240, 240, + /* 50 */ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + /* 60 */ 240, 240, 240, 240, 240, 279, 279, 279, 289, 289, + /* 70 */ 289, 289, 289, 289, 289, 9, 9, 9, 307, 9, + /* 80 */ 9, 9, 3, 3, 9, 9, 9, 9, 282, 282, + /* 90 */ 311, 3, 9, 9, 9, 9, 9, 9, 9, 9, /* 100 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 110 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 120 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 130 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - /* 140 */ 9, 9, 9, 9, 450, 450, 450, 397, 397, 397, - /* 150 */ 450, 397, 450, 402, 404, 408, 399, 414, 425, 429, - /* 160 */ 432, 434, 439, 454, 450, 450, 450, 485, 47, 47, - /* 170 */ 450, 450, 504, 506, 546, 511, 510, 545, 513, 516, - /* 180 */ 485, 143, 450, 521, 521, 450, 521, 450, 521, 450, - /* 190 */ 450, 734, 734, 27, 99, 99, 126, 99, 53, 180, - /* 200 */ 283, 283, 283, 283, 193, 269, 273, 327, 327, 327, - /* 210 */ 327, 230, 251, 250, 238, 172, 172, 234, 307, 342, - /* 220 */ 348, 210, 317, 323, 338, 339, 341, 309, 297, 343, - /* 230 */ 354, 355, 357, 358, 346, 359, 360, 70, 171, 406, - /* 240 */ 362, 312, 316, 319, 455, 459, 325, 329, 364, 333, - /* 250 */ 400, 601, 460, 602, 604, 464, 610, 611, 523, 525, - /* 260 */ 482, 507, 514, 540, 529, 544, 565, 556, 561, 572, - /* 270 */ 574, 575, 564, 577, 578, 580, 657, 581, 582, 584, - /* 280 */ 571, 541, 576, 543, 585, 514, 589, 562, 590, 563, - /* 290 */ 596, 665, 670, 671, 672, 673, 674, 597, 666, 606, - /* 300 */ 603, 605, 573, 607, 660, 630, 675, 547, 548, 608, - /* 310 */ 608, 608, 608, 676, 551, 552, 608, 608, 608, 690, - /* 320 */ 691, 616, 608, 693, 695, 696, 697, 698, 699, 700, - /* 330 */ 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, - /* 340 */ 625, 634, 711, 712, 658, 661, 719, + /* 140 */ 9, 9, 9, 9, 452, 452, 452, 401, 401, 401, + /* 150 */ 452, 401, 452, 407, 406, 411, 418, 416, 400, 429, + /* 160 */ 434, 438, 448, 441, 452, 452, 452, 472, 76, 76, + /* 170 */ 452, 452, 498, 504, 545, 510, 509, 544, 512, 515, + /* 180 */ 472, 66, 452, 519, 519, 452, 519, 452, 519, 452, + /* 190 */ 452, 735, 735, 27, 99, 99, 126, 99, 53, 180, + /* 200 */ 291, 291, 291, 291, 188, 269, 293, 187, 187, 187, + /* 210 */ 187, 207, 233, 65, 143, 347, 347, 374, 382, 330, + /* 220 */ 336, 340, 26, 155, 342, 344, 345, 280, 302, 346, + /* 230 */ 349, 351, 357, 358, 332, 362, 363, 410, 385, 404, + /* 240 */ 365, 310, 315, 318, 454, 457, 326, 327, 371, 331, + /* 250 */ 398, 597, 458, 598, 600, 459, 605, 606, 518, 520, + /* 260 */ 477, 502, 513, 539, 505, 542, 546, 533, 534, 547, + /* 270 */ 549, 568, 562, 574, 578, 580, 660, 582, 583, 585, + /* 280 */ 572, 540, 576, 543, 588, 513, 590, 563, 591, 564, + /* 290 */ 599, 664, 671, 672, 673, 674, 675, 601, 666, 607, + /* 300 */ 602, 604, 575, 608, 662, 631, 676, 548, 551, 603, + /* 310 */ 603, 603, 603, 679, 554, 555, 603, 603, 603, 686, + /* 320 */ 693, 618, 603, 695, 696, 697, 698, 699, 700, 701, + /* 330 */ 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, + /* 340 */ 626, 635, 712, 713, 659, 661, 721, }; #define YY_REDUCE_COUNT (192) #define YY_REDUCE_MIN (-259) -#define YY_REDUCE_MAX (449) +#define YY_REDUCE_MAX (455) static const short yy_reduce_ofst[] = { - /* 0 */ -184, -34, -34, 78, 78, 25, -141, -138, -125, -106, - /* 10 */ -152, -36, 119, -80, 8, 29, 44, 135, 140, 152, - /* 20 */ 162, 164, 165, -192, -189, -247, -223, -207, -206, -211, - /* 30 */ -210, -136, -131, 49, -91, -32, 83, 17, 19, 163, - /* 40 */ 187, 11, 125, 211, 218, -259, -253, -176, -24, 68, - /* 50 */ 92, 116, 168, 188, 198, 204, 209, 215, 219, 220, - /* 60 */ 221, 222, 223, 224, 225, 228, 243, 244, 191, 255, - /* 70 */ 256, 257, 258, 259, 260, 299, 300, 301, 239, 302, - /* 80 */ 304, 305, 261, 262, 306, 310, 311, 313, 236, 241, - /* 90 */ 265, 266, 318, 320, 322, 326, 328, 330, 331, 332, - /* 100 */ 334, 335, 336, 337, 340, 344, 347, 349, 350, 351, - /* 110 */ 352, 353, 356, 361, 363, 365, 366, 367, 368, 369, - /* 120 */ 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, - /* 130 */ 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, - /* 140 */ 390, 391, 392, 393, 324, 394, 395, 248, 254, 264, - /* 150 */ 396, 270, 398, 280, 267, 286, 288, 298, 263, 303, - /* 160 */ 308, 401, 403, 405, 407, 409, 410, 411, 412, 413, - /* 170 */ 415, 416, 417, 419, 418, 420, 422, 426, 424, 430, - /* 180 */ 421, 423, 427, 428, 431, 441, 438, 443, 444, 447, - /* 190 */ 448, 437, 449, + /* 0 */ -184, -34, -34, 78, 78, 133, -141, -138, -125, -106, + /* 10 */ -152, 114, 71, -80, 50, 68, 117, 153, 166, 167, + /* 20 */ 176, 179, 181, -192, -189, -247, -223, -207, -206, -211, + /* 30 */ -210, -136, -131, -110, -91, -32, 15, 44, 144, 122, + /* 40 */ 184, 84, 158, 112, 208, -259, -253, -49, -19, -4, + /* 50 */ 18, 30, 77, 169, 204, 211, 213, 217, 218, 219, + /* 60 */ 221, 222, 223, 224, 225, 19, 43, 85, 253, 254, + /* 70 */ 255, 256, 257, 258, 259, 298, 300, 301, 238, 303, + /* 80 */ 304, 305, 260, 262, 309, 312, 313, 314, 237, 242, + /* 90 */ 261, 270, 317, 319, 320, 321, 323, 324, 325, 328, + /* 100 */ 329, 333, 334, 335, 337, 338, 339, 341, 343, 348, + /* 110 */ 350, 352, 353, 354, 355, 356, 359, 360, 361, 364, + /* 120 */ 366, 367, 368, 369, 370, 372, 373, 375, 376, 377, + /* 130 */ 378, 379, 380, 381, 383, 384, 386, 387, 388, 389, + /* 140 */ 390, 391, 392, 393, 394, 395, 396, 263, 267, 271, + /* 150 */ 397, 273, 399, 266, 286, 272, 299, 306, 402, 316, + /* 160 */ 403, 408, 412, 405, 409, 413, 414, 415, 417, 419, + /* 170 */ 420, 421, 422, 424, 423, 425, 427, 430, 431, 433, + /* 180 */ 426, 428, 432, 436, 444, 435, 445, 449, 447, 451, + /* 190 */ 453, 455, 450, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 832, 949, 892, 961, 879, 889, 1097, 1097, 1097, 832, - /* 10 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 20 */ 832, 832, 832, 1008, 851, 1097, 832, 832, 832, 832, - /* 30 */ 832, 832, 832, 832, 889, 832, 832, 895, 889, 895, - /* 40 */ 895, 832, 1003, 933, 951, 832, 832, 832, 832, 832, - /* 50 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 60 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 70 */ 832, 832, 832, 832, 832, 832, 832, 832, 1010, 1016, - /* 80 */ 1013, 832, 832, 832, 1018, 832, 832, 832, 1040, 1040, - /* 90 */ 1001, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 100 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 110 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 120 */ 877, 832, 875, 832, 832, 832, 832, 832, 832, 832, - /* 130 */ 832, 832, 832, 832, 832, 832, 832, 862, 832, 832, - /* 140 */ 832, 832, 832, 832, 853, 853, 853, 832, 832, 832, - /* 150 */ 853, 832, 853, 1047, 1051, 1045, 1033, 1041, 1032, 1028, - /* 160 */ 1026, 1024, 1023, 1055, 853, 853, 853, 893, 889, 889, - /* 170 */ 853, 853, 911, 909, 907, 899, 905, 901, 903, 897, - /* 180 */ 880, 832, 853, 887, 887, 853, 887, 853, 887, 853, - /* 190 */ 853, 933, 951, 832, 1056, 1046, 832, 1096, 1086, 1085, - /* 200 */ 1092, 1084, 1083, 1082, 832, 832, 832, 1078, 1081, 1080, - /* 210 */ 1079, 832, 832, 832, 832, 1088, 1087, 832, 832, 832, - /* 220 */ 832, 832, 832, 832, 832, 832, 832, 1052, 1048, 832, - /* 230 */ 832, 832, 832, 832, 832, 832, 832, 832, 1058, 832, - /* 240 */ 832, 832, 832, 832, 832, 832, 832, 832, 963, 832, - /* 250 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 260 */ 832, 1000, 832, 832, 832, 832, 832, 1012, 1011, 832, - /* 270 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 280 */ 1042, 832, 1034, 832, 832, 975, 832, 832, 832, 832, - /* 290 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 300 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 1115, - /* 310 */ 1110, 1111, 1108, 832, 832, 832, 1107, 1102, 1103, 832, - /* 320 */ 832, 832, 1100, 832, 832, 832, 832, 832, 832, 832, - /* 330 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, - /* 340 */ 917, 832, 860, 858, 832, 849, 832, + /* 0 */ 834, 951, 894, 963, 881, 891, 1100, 1100, 1100, 834, + /* 10 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 20 */ 834, 834, 834, 1011, 853, 1100, 834, 834, 834, 834, + /* 30 */ 834, 834, 834, 834, 891, 834, 834, 897, 891, 897, + /* 40 */ 897, 834, 1006, 935, 953, 834, 834, 834, 834, 834, + /* 50 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 60 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 70 */ 834, 834, 834, 834, 834, 834, 834, 834, 1013, 1019, + /* 80 */ 1016, 834, 834, 834, 1021, 834, 834, 834, 1043, 1043, + /* 90 */ 1004, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 100 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 110 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 120 */ 879, 834, 877, 834, 834, 834, 834, 834, 834, 834, + /* 130 */ 834, 834, 834, 834, 834, 834, 834, 864, 834, 834, + /* 140 */ 834, 834, 834, 834, 855, 855, 855, 834, 834, 834, + /* 150 */ 855, 834, 855, 1050, 1054, 1048, 1036, 1044, 1035, 1031, + /* 160 */ 1029, 1027, 1026, 1058, 855, 855, 855, 895, 891, 891, + /* 170 */ 855, 855, 913, 911, 909, 901, 907, 903, 905, 899, + /* 180 */ 882, 834, 855, 889, 889, 855, 889, 855, 889, 855, + /* 190 */ 855, 935, 953, 834, 1059, 1049, 834, 1099, 1089, 1088, + /* 200 */ 1095, 1087, 1086, 1085, 834, 834, 834, 1081, 1084, 1083, + /* 210 */ 1082, 834, 834, 834, 834, 1091, 1090, 834, 834, 834, + /* 220 */ 834, 834, 834, 834, 834, 834, 834, 1055, 1051, 834, + /* 230 */ 834, 834, 834, 834, 834, 834, 834, 834, 1061, 834, + /* 240 */ 834, 834, 834, 834, 834, 834, 834, 834, 965, 834, + /* 250 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 260 */ 834, 1003, 834, 834, 834, 834, 834, 1015, 1014, 834, + /* 270 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 280 */ 1045, 834, 1037, 834, 834, 977, 834, 834, 834, 834, + /* 290 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 300 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 1118, + /* 310 */ 1113, 1114, 1111, 834, 834, 834, 1110, 1105, 1106, 834, + /* 320 */ 834, 834, 1103, 834, 834, 834, 834, 834, 834, 834, + /* 330 */ 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, + /* 340 */ 919, 834, 862, 860, 834, 851, 834, }; /********** End of lemon-generated parsing tables *****************************/ @@ -609,6 +609,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* USING => nothing */ 0, /* AS => nothing */ 1, /* NULL => ID */ + 1, /* NOW => ID */ 0, /* SELECT => nothing */ 0, /* UNION => nothing */ 1, /* ALL => ID */ @@ -631,7 +632,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SLIMIT => nothing */ 0, /* SOFFSET => nothing */ 0, /* WHERE => nothing */ - 1, /* NOW => ID */ 0, /* RESET => nothing */ 0, /* QUERY => nothing */ 0, /* SYNCDB => nothing */ @@ -885,29 +885,29 @@ static const char *const yyTokenName[] = { /* 110 */ "USING", /* 111 */ "AS", /* 112 */ "NULL", - /* 113 */ "SELECT", - /* 114 */ "UNION", - /* 115 */ "ALL", - /* 116 */ "DISTINCT", - /* 117 */ "FROM", - /* 118 */ "VARIABLE", - /* 119 */ "INTERVAL", - /* 120 */ "SESSION", - /* 121 */ "STATE_WINDOW", - /* 122 */ "FILL", - /* 123 */ "SLIDING", - /* 124 */ "ORDER", - /* 125 */ "BY", - /* 126 */ "ASC", - /* 127 */ "DESC", - /* 128 */ "GROUP", - /* 129 */ "HAVING", - /* 130 */ "LIMIT", - /* 131 */ "OFFSET", - /* 132 */ "SLIMIT", - /* 133 */ "SOFFSET", - /* 134 */ "WHERE", - /* 135 */ "NOW", + /* 113 */ "NOW", + /* 114 */ "SELECT", + /* 115 */ "UNION", + /* 116 */ "ALL", + /* 117 */ "DISTINCT", + /* 118 */ "FROM", + /* 119 */ "VARIABLE", + /* 120 */ "INTERVAL", + /* 121 */ "SESSION", + /* 122 */ "STATE_WINDOW", + /* 123 */ "FILL", + /* 124 */ "SLIDING", + /* 125 */ "ORDER", + /* 126 */ "BY", + /* 127 */ "ASC", + /* 128 */ "DESC", + /* 129 */ "GROUP", + /* 130 */ "HAVING", + /* 131 */ "LIMIT", + /* 132 */ "OFFSET", + /* 133 */ "SLIMIT", + /* 134 */ "SOFFSET", + /* 135 */ "WHERE", /* 136 */ "RESET", /* 137 */ "QUERY", /* 138 */ "SYNCDB", @@ -1206,133 +1206,134 @@ static const char *const yyRuleName[] = { /* 154 */ "tagitem ::= STRING", /* 155 */ "tagitem ::= BOOL", /* 156 */ "tagitem ::= NULL", - /* 157 */ "tagitem ::= MINUS INTEGER", - /* 158 */ "tagitem ::= MINUS FLOAT", - /* 159 */ "tagitem ::= PLUS INTEGER", - /* 160 */ "tagitem ::= PLUS FLOAT", - /* 161 */ "select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", - /* 162 */ "select ::= LP select RP", - /* 163 */ "union ::= select", - /* 164 */ "union ::= union UNION ALL select", - /* 165 */ "cmd ::= union", - /* 166 */ "select ::= SELECT selcollist", - /* 167 */ "sclp ::= selcollist COMMA", - /* 168 */ "sclp ::=", - /* 169 */ "selcollist ::= sclp distinct expr as", - /* 170 */ "selcollist ::= sclp STAR", - /* 171 */ "as ::= AS ids", - /* 172 */ "as ::= ids", - /* 173 */ "as ::=", - /* 174 */ "distinct ::= DISTINCT", - /* 175 */ "distinct ::=", - /* 176 */ "from ::= FROM tablelist", - /* 177 */ "from ::= FROM sub", - /* 178 */ "sub ::= LP union RP", - /* 179 */ "sub ::= LP union RP ids", - /* 180 */ "sub ::= sub COMMA LP union RP ids", - /* 181 */ "tablelist ::= ids cpxName", - /* 182 */ "tablelist ::= ids cpxName ids", - /* 183 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 184 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 185 */ "tmvar ::= VARIABLE", - /* 186 */ "interval_opt ::= INTERVAL LP tmvar RP", - /* 187 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", - /* 188 */ "interval_opt ::=", - /* 189 */ "session_option ::=", - /* 190 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 191 */ "windowstate_option ::=", - /* 192 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 193 */ "fill_opt ::=", - /* 194 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 195 */ "fill_opt ::= FILL LP ID RP", - /* 196 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 197 */ "sliding_opt ::=", - /* 198 */ "orderby_opt ::=", - /* 199 */ "orderby_opt ::= ORDER BY sortlist", - /* 200 */ "sortlist ::= sortlist COMMA item sortorder", - /* 201 */ "sortlist ::= item sortorder", - /* 202 */ "item ::= ids cpxName", - /* 203 */ "sortorder ::= ASC", - /* 204 */ "sortorder ::= DESC", - /* 205 */ "sortorder ::=", - /* 206 */ "groupby_opt ::=", - /* 207 */ "groupby_opt ::= GROUP BY grouplist", - /* 208 */ "grouplist ::= grouplist COMMA item", - /* 209 */ "grouplist ::= item", - /* 210 */ "having_opt ::=", - /* 211 */ "having_opt ::= HAVING expr", - /* 212 */ "limit_opt ::=", - /* 213 */ "limit_opt ::= LIMIT signed", - /* 214 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 215 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 216 */ "slimit_opt ::=", - /* 217 */ "slimit_opt ::= SLIMIT signed", - /* 218 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 219 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 220 */ "where_opt ::=", - /* 221 */ "where_opt ::= WHERE expr", - /* 222 */ "expr ::= LP expr RP", - /* 223 */ "expr ::= ID", - /* 224 */ "expr ::= ID DOT ID", - /* 225 */ "expr ::= ID DOT STAR", - /* 226 */ "expr ::= INTEGER", - /* 227 */ "expr ::= MINUS INTEGER", - /* 228 */ "expr ::= PLUS INTEGER", - /* 229 */ "expr ::= FLOAT", - /* 230 */ "expr ::= MINUS FLOAT", - /* 231 */ "expr ::= PLUS FLOAT", - /* 232 */ "expr ::= STRING", - /* 233 */ "expr ::= NOW", - /* 234 */ "expr ::= VARIABLE", - /* 235 */ "expr ::= PLUS VARIABLE", - /* 236 */ "expr ::= MINUS VARIABLE", - /* 237 */ "expr ::= BOOL", - /* 238 */ "expr ::= NULL", - /* 239 */ "expr ::= ID LP exprlist RP", - /* 240 */ "expr ::= ID LP STAR RP", - /* 241 */ "expr ::= expr IS NULL", - /* 242 */ "expr ::= expr IS NOT NULL", - /* 243 */ "expr ::= expr LT expr", - /* 244 */ "expr ::= expr GT expr", - /* 245 */ "expr ::= expr LE expr", - /* 246 */ "expr ::= expr GE expr", - /* 247 */ "expr ::= expr NE expr", - /* 248 */ "expr ::= expr EQ expr", - /* 249 */ "expr ::= expr BETWEEN expr AND expr", - /* 250 */ "expr ::= expr AND expr", - /* 251 */ "expr ::= expr OR expr", - /* 252 */ "expr ::= expr PLUS expr", - /* 253 */ "expr ::= expr MINUS expr", - /* 254 */ "expr ::= expr STAR expr", - /* 255 */ "expr ::= expr SLASH expr", - /* 256 */ "expr ::= expr REM expr", - /* 257 */ "expr ::= expr LIKE expr", - /* 258 */ "expr ::= expr IN LP exprlist RP", - /* 259 */ "exprlist ::= exprlist COMMA expritem", - /* 260 */ "exprlist ::= expritem", - /* 261 */ "expritem ::= expr", - /* 262 */ "expritem ::=", - /* 263 */ "cmd ::= RESET QUERY CACHE", - /* 264 */ "cmd ::= SYNCDB ids REPLICA", - /* 265 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 266 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 267 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 268 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 269 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 270 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 271 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 272 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 273 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 274 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 275 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 276 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 277 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 278 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 279 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 280 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 281 */ "cmd ::= KILL CONNECTION INTEGER", - /* 282 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 283 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 157 */ "tagitem ::= NOW", + /* 158 */ "tagitem ::= MINUS INTEGER", + /* 159 */ "tagitem ::= MINUS FLOAT", + /* 160 */ "tagitem ::= PLUS INTEGER", + /* 161 */ "tagitem ::= PLUS FLOAT", + /* 162 */ "select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", + /* 163 */ "select ::= LP select RP", + /* 164 */ "union ::= select", + /* 165 */ "union ::= union UNION ALL select", + /* 166 */ "cmd ::= union", + /* 167 */ "select ::= SELECT selcollist", + /* 168 */ "sclp ::= selcollist COMMA", + /* 169 */ "sclp ::=", + /* 170 */ "selcollist ::= sclp distinct expr as", + /* 171 */ "selcollist ::= sclp STAR", + /* 172 */ "as ::= AS ids", + /* 173 */ "as ::= ids", + /* 174 */ "as ::=", + /* 175 */ "distinct ::= DISTINCT", + /* 176 */ "distinct ::=", + /* 177 */ "from ::= FROM tablelist", + /* 178 */ "from ::= FROM sub", + /* 179 */ "sub ::= LP union RP", + /* 180 */ "sub ::= LP union RP ids", + /* 181 */ "sub ::= sub COMMA LP union RP ids", + /* 182 */ "tablelist ::= ids cpxName", + /* 183 */ "tablelist ::= ids cpxName ids", + /* 184 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 185 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 186 */ "tmvar ::= VARIABLE", + /* 187 */ "interval_opt ::= INTERVAL LP tmvar RP", + /* 188 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", + /* 189 */ "interval_opt ::=", + /* 190 */ "session_option ::=", + /* 191 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 192 */ "windowstate_option ::=", + /* 193 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 194 */ "fill_opt ::=", + /* 195 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 196 */ "fill_opt ::= FILL LP ID RP", + /* 197 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 198 */ "sliding_opt ::=", + /* 199 */ "orderby_opt ::=", + /* 200 */ "orderby_opt ::= ORDER BY sortlist", + /* 201 */ "sortlist ::= sortlist COMMA item sortorder", + /* 202 */ "sortlist ::= item sortorder", + /* 203 */ "item ::= ids cpxName", + /* 204 */ "sortorder ::= ASC", + /* 205 */ "sortorder ::= DESC", + /* 206 */ "sortorder ::=", + /* 207 */ "groupby_opt ::=", + /* 208 */ "groupby_opt ::= GROUP BY grouplist", + /* 209 */ "grouplist ::= grouplist COMMA item", + /* 210 */ "grouplist ::= item", + /* 211 */ "having_opt ::=", + /* 212 */ "having_opt ::= HAVING expr", + /* 213 */ "limit_opt ::=", + /* 214 */ "limit_opt ::= LIMIT signed", + /* 215 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 216 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 217 */ "slimit_opt ::=", + /* 218 */ "slimit_opt ::= SLIMIT signed", + /* 219 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 220 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 221 */ "where_opt ::=", + /* 222 */ "where_opt ::= WHERE expr", + /* 223 */ "expr ::= LP expr RP", + /* 224 */ "expr ::= ID", + /* 225 */ "expr ::= ID DOT ID", + /* 226 */ "expr ::= ID DOT STAR", + /* 227 */ "expr ::= INTEGER", + /* 228 */ "expr ::= MINUS INTEGER", + /* 229 */ "expr ::= PLUS INTEGER", + /* 230 */ "expr ::= FLOAT", + /* 231 */ "expr ::= MINUS FLOAT", + /* 232 */ "expr ::= PLUS FLOAT", + /* 233 */ "expr ::= STRING", + /* 234 */ "expr ::= NOW", + /* 235 */ "expr ::= VARIABLE", + /* 236 */ "expr ::= PLUS VARIABLE", + /* 237 */ "expr ::= MINUS VARIABLE", + /* 238 */ "expr ::= BOOL", + /* 239 */ "expr ::= NULL", + /* 240 */ "expr ::= ID LP exprlist RP", + /* 241 */ "expr ::= ID LP STAR RP", + /* 242 */ "expr ::= expr IS NULL", + /* 243 */ "expr ::= expr IS NOT NULL", + /* 244 */ "expr ::= expr LT expr", + /* 245 */ "expr ::= expr GT expr", + /* 246 */ "expr ::= expr LE expr", + /* 247 */ "expr ::= expr GE expr", + /* 248 */ "expr ::= expr NE expr", + /* 249 */ "expr ::= expr EQ expr", + /* 250 */ "expr ::= expr BETWEEN expr AND expr", + /* 251 */ "expr ::= expr AND expr", + /* 252 */ "expr ::= expr OR expr", + /* 253 */ "expr ::= expr PLUS expr", + /* 254 */ "expr ::= expr MINUS expr", + /* 255 */ "expr ::= expr STAR expr", + /* 256 */ "expr ::= expr SLASH expr", + /* 257 */ "expr ::= expr REM expr", + /* 258 */ "expr ::= expr LIKE expr", + /* 259 */ "expr ::= expr IN LP exprlist RP", + /* 260 */ "exprlist ::= exprlist COMMA expritem", + /* 261 */ "exprlist ::= expritem", + /* 262 */ "expritem ::= expr", + /* 263 */ "expritem ::=", + /* 264 */ "cmd ::= RESET QUERY CACHE", + /* 265 */ "cmd ::= SYNCDB ids REPLICA", + /* 266 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 267 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 268 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 269 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 270 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 271 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 272 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 273 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 274 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 275 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 276 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 277 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 278 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 279 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 280 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 281 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 282 */ "cmd ::= KILL CONNECTION INTEGER", + /* 283 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 284 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1957,133 +1958,134 @@ static const struct { { 242, -1 }, /* (154) tagitem ::= STRING */ { 242, -1 }, /* (155) tagitem ::= BOOL */ { 242, -1 }, /* (156) tagitem ::= NULL */ - { 242, -2 }, /* (157) tagitem ::= MINUS INTEGER */ - { 242, -2 }, /* (158) tagitem ::= MINUS FLOAT */ - { 242, -2 }, /* (159) tagitem ::= PLUS INTEGER */ - { 242, -2 }, /* (160) tagitem ::= PLUS FLOAT */ - { 240, -14 }, /* (161) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 240, -3 }, /* (162) select ::= LP select RP */ - { 256, -1 }, /* (163) union ::= select */ - { 256, -4 }, /* (164) union ::= union UNION ALL select */ - { 192, -1 }, /* (165) cmd ::= union */ - { 240, -2 }, /* (166) select ::= SELECT selcollist */ - { 257, -2 }, /* (167) sclp ::= selcollist COMMA */ - { 257, 0 }, /* (168) sclp ::= */ - { 243, -4 }, /* (169) selcollist ::= sclp distinct expr as */ - { 243, -2 }, /* (170) selcollist ::= sclp STAR */ - { 260, -2 }, /* (171) as ::= AS ids */ - { 260, -1 }, /* (172) as ::= ids */ - { 260, 0 }, /* (173) as ::= */ - { 258, -1 }, /* (174) distinct ::= DISTINCT */ - { 258, 0 }, /* (175) distinct ::= */ - { 244, -2 }, /* (176) from ::= FROM tablelist */ - { 244, -2 }, /* (177) from ::= FROM sub */ - { 262, -3 }, /* (178) sub ::= LP union RP */ - { 262, -4 }, /* (179) sub ::= LP union RP ids */ - { 262, -6 }, /* (180) sub ::= sub COMMA LP union RP ids */ - { 261, -2 }, /* (181) tablelist ::= ids cpxName */ - { 261, -3 }, /* (182) tablelist ::= ids cpxName ids */ - { 261, -4 }, /* (183) tablelist ::= tablelist COMMA ids cpxName */ - { 261, -5 }, /* (184) tablelist ::= tablelist COMMA ids cpxName ids */ - { 263, -1 }, /* (185) tmvar ::= VARIABLE */ - { 246, -4 }, /* (186) interval_opt ::= INTERVAL LP tmvar RP */ - { 246, -6 }, /* (187) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 246, 0 }, /* (188) interval_opt ::= */ - { 247, 0 }, /* (189) session_option ::= */ - { 247, -7 }, /* (190) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 248, 0 }, /* (191) windowstate_option ::= */ - { 248, -4 }, /* (192) windowstate_option ::= STATE_WINDOW LP ids RP */ - { 249, 0 }, /* (193) fill_opt ::= */ - { 249, -6 }, /* (194) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 249, -4 }, /* (195) fill_opt ::= FILL LP ID RP */ - { 250, -4 }, /* (196) sliding_opt ::= SLIDING LP tmvar RP */ - { 250, 0 }, /* (197) sliding_opt ::= */ - { 252, 0 }, /* (198) orderby_opt ::= */ - { 252, -3 }, /* (199) orderby_opt ::= ORDER BY sortlist */ - { 264, -4 }, /* (200) sortlist ::= sortlist COMMA item sortorder */ - { 264, -2 }, /* (201) sortlist ::= item sortorder */ - { 266, -2 }, /* (202) item ::= ids cpxName */ - { 267, -1 }, /* (203) sortorder ::= ASC */ - { 267, -1 }, /* (204) sortorder ::= DESC */ - { 267, 0 }, /* (205) sortorder ::= */ - { 251, 0 }, /* (206) groupby_opt ::= */ - { 251, -3 }, /* (207) groupby_opt ::= GROUP BY grouplist */ - { 268, -3 }, /* (208) grouplist ::= grouplist COMMA item */ - { 268, -1 }, /* (209) grouplist ::= item */ - { 253, 0 }, /* (210) having_opt ::= */ - { 253, -2 }, /* (211) having_opt ::= HAVING expr */ - { 255, 0 }, /* (212) limit_opt ::= */ - { 255, -2 }, /* (213) limit_opt ::= LIMIT signed */ - { 255, -4 }, /* (214) limit_opt ::= LIMIT signed OFFSET signed */ - { 255, -4 }, /* (215) limit_opt ::= LIMIT signed COMMA signed */ - { 254, 0 }, /* (216) slimit_opt ::= */ - { 254, -2 }, /* (217) slimit_opt ::= SLIMIT signed */ - { 254, -4 }, /* (218) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 254, -4 }, /* (219) slimit_opt ::= SLIMIT signed COMMA signed */ - { 245, 0 }, /* (220) where_opt ::= */ - { 245, -2 }, /* (221) where_opt ::= WHERE expr */ - { 259, -3 }, /* (222) expr ::= LP expr RP */ - { 259, -1 }, /* (223) expr ::= ID */ - { 259, -3 }, /* (224) expr ::= ID DOT ID */ - { 259, -3 }, /* (225) expr ::= ID DOT STAR */ - { 259, -1 }, /* (226) expr ::= INTEGER */ - { 259, -2 }, /* (227) expr ::= MINUS INTEGER */ - { 259, -2 }, /* (228) expr ::= PLUS INTEGER */ - { 259, -1 }, /* (229) expr ::= FLOAT */ - { 259, -2 }, /* (230) expr ::= MINUS FLOAT */ - { 259, -2 }, /* (231) expr ::= PLUS FLOAT */ - { 259, -1 }, /* (232) expr ::= STRING */ - { 259, -1 }, /* (233) expr ::= NOW */ - { 259, -1 }, /* (234) expr ::= VARIABLE */ - { 259, -2 }, /* (235) expr ::= PLUS VARIABLE */ - { 259, -2 }, /* (236) expr ::= MINUS VARIABLE */ - { 259, -1 }, /* (237) expr ::= BOOL */ - { 259, -1 }, /* (238) expr ::= NULL */ - { 259, -4 }, /* (239) expr ::= ID LP exprlist RP */ - { 259, -4 }, /* (240) expr ::= ID LP STAR RP */ - { 259, -3 }, /* (241) expr ::= expr IS NULL */ - { 259, -4 }, /* (242) expr ::= expr IS NOT NULL */ - { 259, -3 }, /* (243) expr ::= expr LT expr */ - { 259, -3 }, /* (244) expr ::= expr GT expr */ - { 259, -3 }, /* (245) expr ::= expr LE expr */ - { 259, -3 }, /* (246) expr ::= expr GE expr */ - { 259, -3 }, /* (247) expr ::= expr NE expr */ - { 259, -3 }, /* (248) expr ::= expr EQ expr */ - { 259, -5 }, /* (249) expr ::= expr BETWEEN expr AND expr */ - { 259, -3 }, /* (250) expr ::= expr AND expr */ - { 259, -3 }, /* (251) expr ::= expr OR expr */ - { 259, -3 }, /* (252) expr ::= expr PLUS expr */ - { 259, -3 }, /* (253) expr ::= expr MINUS expr */ - { 259, -3 }, /* (254) expr ::= expr STAR expr */ - { 259, -3 }, /* (255) expr ::= expr SLASH expr */ - { 259, -3 }, /* (256) expr ::= expr REM expr */ - { 259, -3 }, /* (257) expr ::= expr LIKE expr */ - { 259, -5 }, /* (258) expr ::= expr IN LP exprlist RP */ - { 200, -3 }, /* (259) exprlist ::= exprlist COMMA expritem */ - { 200, -1 }, /* (260) exprlist ::= expritem */ - { 269, -1 }, /* (261) expritem ::= expr */ - { 269, 0 }, /* (262) expritem ::= */ - { 192, -3 }, /* (263) cmd ::= RESET QUERY CACHE */ - { 192, -3 }, /* (264) cmd ::= SYNCDB ids REPLICA */ - { 192, -7 }, /* (265) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 192, -7 }, /* (266) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 192, -7 }, /* (267) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - { 192, -7 }, /* (268) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 192, -7 }, /* (269) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 192, -8 }, /* (270) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 192, -9 }, /* (271) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 192, -7 }, /* (272) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - { 192, -7 }, /* (273) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 192, -7 }, /* (274) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 192, -7 }, /* (275) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - { 192, -7 }, /* (276) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 192, -7 }, /* (277) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 192, -8 }, /* (278) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 192, -9 }, /* (279) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - { 192, -7 }, /* (280) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - { 192, -3 }, /* (281) cmd ::= KILL CONNECTION INTEGER */ - { 192, -5 }, /* (282) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 192, -5 }, /* (283) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 242, -1 }, /* (157) tagitem ::= NOW */ + { 242, -2 }, /* (158) tagitem ::= MINUS INTEGER */ + { 242, -2 }, /* (159) tagitem ::= MINUS FLOAT */ + { 242, -2 }, /* (160) tagitem ::= PLUS INTEGER */ + { 242, -2 }, /* (161) tagitem ::= PLUS FLOAT */ + { 240, -14 }, /* (162) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 240, -3 }, /* (163) select ::= LP select RP */ + { 256, -1 }, /* (164) union ::= select */ + { 256, -4 }, /* (165) union ::= union UNION ALL select */ + { 192, -1 }, /* (166) cmd ::= union */ + { 240, -2 }, /* (167) select ::= SELECT selcollist */ + { 257, -2 }, /* (168) sclp ::= selcollist COMMA */ + { 257, 0 }, /* (169) sclp ::= */ + { 243, -4 }, /* (170) selcollist ::= sclp distinct expr as */ + { 243, -2 }, /* (171) selcollist ::= sclp STAR */ + { 260, -2 }, /* (172) as ::= AS ids */ + { 260, -1 }, /* (173) as ::= ids */ + { 260, 0 }, /* (174) as ::= */ + { 258, -1 }, /* (175) distinct ::= DISTINCT */ + { 258, 0 }, /* (176) distinct ::= */ + { 244, -2 }, /* (177) from ::= FROM tablelist */ + { 244, -2 }, /* (178) from ::= FROM sub */ + { 262, -3 }, /* (179) sub ::= LP union RP */ + { 262, -4 }, /* (180) sub ::= LP union RP ids */ + { 262, -6 }, /* (181) sub ::= sub COMMA LP union RP ids */ + { 261, -2 }, /* (182) tablelist ::= ids cpxName */ + { 261, -3 }, /* (183) tablelist ::= ids cpxName ids */ + { 261, -4 }, /* (184) tablelist ::= tablelist COMMA ids cpxName */ + { 261, -5 }, /* (185) tablelist ::= tablelist COMMA ids cpxName ids */ + { 263, -1 }, /* (186) tmvar ::= VARIABLE */ + { 246, -4 }, /* (187) interval_opt ::= INTERVAL LP tmvar RP */ + { 246, -6 }, /* (188) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 246, 0 }, /* (189) interval_opt ::= */ + { 247, 0 }, /* (190) session_option ::= */ + { 247, -7 }, /* (191) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + { 248, 0 }, /* (192) windowstate_option ::= */ + { 248, -4 }, /* (193) windowstate_option ::= STATE_WINDOW LP ids RP */ + { 249, 0 }, /* (194) fill_opt ::= */ + { 249, -6 }, /* (195) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 249, -4 }, /* (196) fill_opt ::= FILL LP ID RP */ + { 250, -4 }, /* (197) sliding_opt ::= SLIDING LP tmvar RP */ + { 250, 0 }, /* (198) sliding_opt ::= */ + { 252, 0 }, /* (199) orderby_opt ::= */ + { 252, -3 }, /* (200) orderby_opt ::= ORDER BY sortlist */ + { 264, -4 }, /* (201) sortlist ::= sortlist COMMA item sortorder */ + { 264, -2 }, /* (202) sortlist ::= item sortorder */ + { 266, -2 }, /* (203) item ::= ids cpxName */ + { 267, -1 }, /* (204) sortorder ::= ASC */ + { 267, -1 }, /* (205) sortorder ::= DESC */ + { 267, 0 }, /* (206) sortorder ::= */ + { 251, 0 }, /* (207) groupby_opt ::= */ + { 251, -3 }, /* (208) groupby_opt ::= GROUP BY grouplist */ + { 268, -3 }, /* (209) grouplist ::= grouplist COMMA item */ + { 268, -1 }, /* (210) grouplist ::= item */ + { 253, 0 }, /* (211) having_opt ::= */ + { 253, -2 }, /* (212) having_opt ::= HAVING expr */ + { 255, 0 }, /* (213) limit_opt ::= */ + { 255, -2 }, /* (214) limit_opt ::= LIMIT signed */ + { 255, -4 }, /* (215) limit_opt ::= LIMIT signed OFFSET signed */ + { 255, -4 }, /* (216) limit_opt ::= LIMIT signed COMMA signed */ + { 254, 0 }, /* (217) slimit_opt ::= */ + { 254, -2 }, /* (218) slimit_opt ::= SLIMIT signed */ + { 254, -4 }, /* (219) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 254, -4 }, /* (220) slimit_opt ::= SLIMIT signed COMMA signed */ + { 245, 0 }, /* (221) where_opt ::= */ + { 245, -2 }, /* (222) where_opt ::= WHERE expr */ + { 259, -3 }, /* (223) expr ::= LP expr RP */ + { 259, -1 }, /* (224) expr ::= ID */ + { 259, -3 }, /* (225) expr ::= ID DOT ID */ + { 259, -3 }, /* (226) expr ::= ID DOT STAR */ + { 259, -1 }, /* (227) expr ::= INTEGER */ + { 259, -2 }, /* (228) expr ::= MINUS INTEGER */ + { 259, -2 }, /* (229) expr ::= PLUS INTEGER */ + { 259, -1 }, /* (230) expr ::= FLOAT */ + { 259, -2 }, /* (231) expr ::= MINUS FLOAT */ + { 259, -2 }, /* (232) expr ::= PLUS FLOAT */ + { 259, -1 }, /* (233) expr ::= STRING */ + { 259, -1 }, /* (234) expr ::= NOW */ + { 259, -1 }, /* (235) expr ::= VARIABLE */ + { 259, -2 }, /* (236) expr ::= PLUS VARIABLE */ + { 259, -2 }, /* (237) expr ::= MINUS VARIABLE */ + { 259, -1 }, /* (238) expr ::= BOOL */ + { 259, -1 }, /* (239) expr ::= NULL */ + { 259, -4 }, /* (240) expr ::= ID LP exprlist RP */ + { 259, -4 }, /* (241) expr ::= ID LP STAR RP */ + { 259, -3 }, /* (242) expr ::= expr IS NULL */ + { 259, -4 }, /* (243) expr ::= expr IS NOT NULL */ + { 259, -3 }, /* (244) expr ::= expr LT expr */ + { 259, -3 }, /* (245) expr ::= expr GT expr */ + { 259, -3 }, /* (246) expr ::= expr LE expr */ + { 259, -3 }, /* (247) expr ::= expr GE expr */ + { 259, -3 }, /* (248) expr ::= expr NE expr */ + { 259, -3 }, /* (249) expr ::= expr EQ expr */ + { 259, -5 }, /* (250) expr ::= expr BETWEEN expr AND expr */ + { 259, -3 }, /* (251) expr ::= expr AND expr */ + { 259, -3 }, /* (252) expr ::= expr OR expr */ + { 259, -3 }, /* (253) expr ::= expr PLUS expr */ + { 259, -3 }, /* (254) expr ::= expr MINUS expr */ + { 259, -3 }, /* (255) expr ::= expr STAR expr */ + { 259, -3 }, /* (256) expr ::= expr SLASH expr */ + { 259, -3 }, /* (257) expr ::= expr REM expr */ + { 259, -3 }, /* (258) expr ::= expr LIKE expr */ + { 259, -5 }, /* (259) expr ::= expr IN LP exprlist RP */ + { 200, -3 }, /* (260) exprlist ::= exprlist COMMA expritem */ + { 200, -1 }, /* (261) exprlist ::= expritem */ + { 269, -1 }, /* (262) expritem ::= expr */ + { 269, 0 }, /* (263) expritem ::= */ + { 192, -3 }, /* (264) cmd ::= RESET QUERY CACHE */ + { 192, -3 }, /* (265) cmd ::= SYNCDB ids REPLICA */ + { 192, -7 }, /* (266) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 192, -7 }, /* (267) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 192, -7 }, /* (268) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + { 192, -7 }, /* (269) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 192, -7 }, /* (270) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 192, -8 }, /* (271) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 192, -9 }, /* (272) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 192, -7 }, /* (273) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + { 192, -7 }, /* (274) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 192, -7 }, /* (275) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 192, -7 }, /* (276) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + { 192, -7 }, /* (277) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 192, -7 }, /* (278) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 192, -8 }, /* (279) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 192, -9 }, /* (280) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + { 192, -7 }, /* (281) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + { 192, -3 }, /* (282) cmd ::= KILL CONNECTION INTEGER */ + { 192, -5 }, /* (283) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 192, -5 }, /* (284) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2357,7 +2359,7 @@ static void yy_reduce( break; case 52: /* ifexists ::= */ case 54: /* ifnotexists ::= */ yytestcase(yyruleno==54); - case 175: /* distinct ::= */ yytestcase(yyruleno==175); + case 176: /* distinct ::= */ yytestcase(yyruleno==176); { yymsp[1].minor.yy0.n = 0;} break; case 53: /* ifnotexists ::= IF NOT EXISTS */ @@ -2665,10 +2667,14 @@ static void yy_reduce( { yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); } yymsp[0].minor.yy506 = yylhsminor.yy506; break; - case 157: /* tagitem ::= MINUS INTEGER */ - case 158: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==158); - case 159: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==159); - case 160: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==160); + case 157: /* tagitem ::= NOW */ +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy506 = yylhsminor.yy506; + break; + case 158: /* tagitem ::= MINUS INTEGER */ + case 159: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==159); + case 160: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==160); + case 161: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==161); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; @@ -2677,142 +2683,142 @@ static void yy_reduce( } yymsp[-1].minor.yy506 = yylhsminor.yy506; break; - case 161: /* select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + case 162: /* select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { yylhsminor.yy236 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy441, yymsp[-11].minor.yy244, yymsp[-10].minor.yy166, yymsp[-4].minor.yy441, yymsp[-3].minor.yy441, &yymsp[-9].minor.yy340, &yymsp[-8].minor.yy259, &yymsp[-7].minor.yy348, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy441, &yymsp[0].minor.yy414, &yymsp[-1].minor.yy414, yymsp[-2].minor.yy166); } yymsp[-13].minor.yy236 = yylhsminor.yy236; break; - case 162: /* select ::= LP select RP */ + case 163: /* select ::= LP select RP */ {yymsp[-2].minor.yy236 = yymsp[-1].minor.yy236;} break; - case 163: /* union ::= select */ + case 164: /* union ::= select */ { yylhsminor.yy441 = setSubclause(NULL, yymsp[0].minor.yy236); } yymsp[0].minor.yy441 = yylhsminor.yy441; break; - case 164: /* union ::= union UNION ALL select */ + case 165: /* union ::= union UNION ALL select */ { yylhsminor.yy441 = appendSelectClause(yymsp[-3].minor.yy441, yymsp[0].minor.yy236); } yymsp[-3].minor.yy441 = yylhsminor.yy441; break; - case 165: /* cmd ::= union */ + case 166: /* cmd ::= union */ { setSqlInfo(pInfo, yymsp[0].minor.yy441, NULL, TSDB_SQL_SELECT); } break; - case 166: /* select ::= SELECT selcollist */ + case 167: /* select ::= SELECT selcollist */ { yylhsminor.yy236 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy441, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } yymsp[-1].minor.yy236 = yylhsminor.yy236; break; - case 167: /* sclp ::= selcollist COMMA */ + case 168: /* sclp ::= selcollist COMMA */ {yylhsminor.yy441 = yymsp[-1].minor.yy441;} yymsp[-1].minor.yy441 = yylhsminor.yy441; break; - case 168: /* sclp ::= */ - case 198: /* orderby_opt ::= */ yytestcase(yyruleno==198); + case 169: /* sclp ::= */ + case 199: /* orderby_opt ::= */ yytestcase(yyruleno==199); {yymsp[1].minor.yy441 = 0;} break; - case 169: /* selcollist ::= sclp distinct expr as */ + case 170: /* selcollist ::= sclp distinct expr as */ { yylhsminor.yy441 = tSqlExprListAppend(yymsp[-3].minor.yy441, yymsp[-1].minor.yy166, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } yymsp[-3].minor.yy441 = yylhsminor.yy441; break; - case 170: /* selcollist ::= sclp STAR */ + case 171: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); yylhsminor.yy441 = tSqlExprListAppend(yymsp[-1].minor.yy441, pNode, 0, 0); } yymsp[-1].minor.yy441 = yylhsminor.yy441; break; - case 171: /* as ::= AS ids */ + case 172: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 172: /* as ::= ids */ + case 173: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 173: /* as ::= */ + case 174: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 174: /* distinct ::= DISTINCT */ + case 175: /* distinct ::= DISTINCT */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 176: /* from ::= FROM tablelist */ - case 177: /* from ::= FROM sub */ yytestcase(yyruleno==177); + case 177: /* from ::= FROM tablelist */ + case 178: /* from ::= FROM sub */ yytestcase(yyruleno==178); {yymsp[-1].minor.yy244 = yymsp[0].minor.yy244;} break; - case 178: /* sub ::= LP union RP */ + case 179: /* sub ::= LP union RP */ {yymsp[-2].minor.yy244 = addSubqueryElem(NULL, yymsp[-1].minor.yy441, NULL);} break; - case 179: /* sub ::= LP union RP ids */ + case 180: /* sub ::= LP union RP ids */ {yymsp[-3].minor.yy244 = addSubqueryElem(NULL, yymsp[-2].minor.yy441, &yymsp[0].minor.yy0);} break; - case 180: /* sub ::= sub COMMA LP union RP ids */ + case 181: /* sub ::= sub COMMA LP union RP ids */ {yylhsminor.yy244 = addSubqueryElem(yymsp[-5].minor.yy244, yymsp[-2].minor.yy441, &yymsp[0].minor.yy0);} yymsp[-5].minor.yy244 = yylhsminor.yy244; break; - case 181: /* tablelist ::= ids cpxName */ + case 182: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy244 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } yymsp[-1].minor.yy244 = yylhsminor.yy244; break; - case 182: /* tablelist ::= ids cpxName ids */ + case 183: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy244 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy244 = yylhsminor.yy244; break; - case 183: /* tablelist ::= tablelist COMMA ids cpxName */ + case 184: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy244 = setTableNameList(yymsp[-3].minor.yy244, &yymsp[-1].minor.yy0, NULL); } yymsp[-3].minor.yy244 = yylhsminor.yy244; break; - case 184: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 185: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yylhsminor.yy244 = setTableNameList(yymsp[-4].minor.yy244, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } yymsp[-4].minor.yy244 = yylhsminor.yy244; break; - case 185: /* tmvar ::= VARIABLE */ + case 186: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 186: /* interval_opt ::= INTERVAL LP tmvar RP */ + case 187: /* interval_opt ::= INTERVAL LP tmvar RP */ {yymsp[-3].minor.yy340.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy340.offset.n = 0;} break; - case 187: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + case 188: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ {yymsp[-5].minor.yy340.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy340.offset = yymsp[-1].minor.yy0;} break; - case 188: /* interval_opt ::= */ + case 189: /* interval_opt ::= */ {memset(&yymsp[1].minor.yy340, 0, sizeof(yymsp[1].minor.yy340));} break; - case 189: /* session_option ::= */ + case 190: /* session_option ::= */ {yymsp[1].minor.yy259.col.n = 0; yymsp[1].minor.yy259.gap.n = 0;} break; - case 190: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + case 191: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-6].minor.yy259.col = yymsp[-4].minor.yy0; yymsp[-6].minor.yy259.gap = yymsp[-1].minor.yy0; } break; - case 191: /* windowstate_option ::= */ + case 192: /* windowstate_option ::= */ { yymsp[1].minor.yy348.col.n = 0; yymsp[1].minor.yy348.col.z = NULL;} break; - case 192: /* windowstate_option ::= STATE_WINDOW LP ids RP */ + case 193: /* windowstate_option ::= STATE_WINDOW LP ids RP */ { yymsp[-3].minor.yy348.col = yymsp[-1].minor.yy0; } break; - case 193: /* fill_opt ::= */ + case 194: /* fill_opt ::= */ { yymsp[1].minor.yy441 = 0; } break; - case 194: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 195: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); @@ -2822,34 +2828,34 @@ static void yy_reduce( yymsp[-5].minor.yy441 = yymsp[-1].minor.yy441; } break; - case 195: /* fill_opt ::= FILL LP ID RP */ + case 196: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-3].minor.yy441 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 196: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 197: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 197: /* sliding_opt ::= */ + case 198: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 199: /* orderby_opt ::= ORDER BY sortlist */ + case 200: /* orderby_opt ::= ORDER BY sortlist */ {yymsp[-2].minor.yy441 = yymsp[0].minor.yy441;} break; - case 200: /* sortlist ::= sortlist COMMA item sortorder */ + case 201: /* sortlist ::= sortlist COMMA item sortorder */ { yylhsminor.yy441 = tVariantListAppend(yymsp[-3].minor.yy441, &yymsp[-1].minor.yy506, yymsp[0].minor.yy112); } yymsp[-3].minor.yy441 = yylhsminor.yy441; break; - case 201: /* sortlist ::= item sortorder */ + case 202: /* sortlist ::= item sortorder */ { yylhsminor.yy441 = tVariantListAppend(NULL, &yymsp[-1].minor.yy506, yymsp[0].minor.yy112); } yymsp[-1].minor.yy441 = yylhsminor.yy441; break; - case 202: /* item ::= ids cpxName */ + case 203: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; @@ -2858,227 +2864,227 @@ static void yy_reduce( } yymsp[-1].minor.yy506 = yylhsminor.yy506; break; - case 203: /* sortorder ::= ASC */ + case 204: /* sortorder ::= ASC */ { yymsp[0].minor.yy112 = TSDB_ORDER_ASC; } break; - case 204: /* sortorder ::= DESC */ + case 205: /* sortorder ::= DESC */ { yymsp[0].minor.yy112 = TSDB_ORDER_DESC;} break; - case 205: /* sortorder ::= */ + case 206: /* sortorder ::= */ { yymsp[1].minor.yy112 = TSDB_ORDER_ASC; } break; - case 206: /* groupby_opt ::= */ + case 207: /* groupby_opt ::= */ { yymsp[1].minor.yy441 = 0;} break; - case 207: /* groupby_opt ::= GROUP BY grouplist */ + case 208: /* groupby_opt ::= GROUP BY grouplist */ { yymsp[-2].minor.yy441 = yymsp[0].minor.yy441;} break; - case 208: /* grouplist ::= grouplist COMMA item */ + case 209: /* grouplist ::= grouplist COMMA item */ { yylhsminor.yy441 = tVariantListAppend(yymsp[-2].minor.yy441, &yymsp[0].minor.yy506, -1); } yymsp[-2].minor.yy441 = yylhsminor.yy441; break; - case 209: /* grouplist ::= item */ + case 210: /* grouplist ::= item */ { yylhsminor.yy441 = tVariantListAppend(NULL, &yymsp[0].minor.yy506, -1); } yymsp[0].minor.yy441 = yylhsminor.yy441; break; - case 210: /* having_opt ::= */ - case 220: /* where_opt ::= */ yytestcase(yyruleno==220); - case 262: /* expritem ::= */ yytestcase(yyruleno==262); + case 211: /* having_opt ::= */ + case 221: /* where_opt ::= */ yytestcase(yyruleno==221); + case 263: /* expritem ::= */ yytestcase(yyruleno==263); {yymsp[1].minor.yy166 = 0;} break; - case 211: /* having_opt ::= HAVING expr */ - case 221: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==221); + case 212: /* having_opt ::= HAVING expr */ + case 222: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==222); {yymsp[-1].minor.yy166 = yymsp[0].minor.yy166;} break; - case 212: /* limit_opt ::= */ - case 216: /* slimit_opt ::= */ yytestcase(yyruleno==216); + case 213: /* limit_opt ::= */ + case 217: /* slimit_opt ::= */ yytestcase(yyruleno==217); {yymsp[1].minor.yy414.limit = -1; yymsp[1].minor.yy414.offset = 0;} break; - case 213: /* limit_opt ::= LIMIT signed */ - case 217: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==217); + case 214: /* limit_opt ::= LIMIT signed */ + case 218: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==218); {yymsp[-1].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-1].minor.yy414.offset = 0;} break; - case 214: /* limit_opt ::= LIMIT signed OFFSET signed */ + case 215: /* limit_opt ::= LIMIT signed OFFSET signed */ { yymsp[-3].minor.yy414.limit = yymsp[-2].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[0].minor.yy369;} break; - case 215: /* limit_opt ::= LIMIT signed COMMA signed */ + case 216: /* limit_opt ::= LIMIT signed COMMA signed */ { yymsp[-3].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[-2].minor.yy369;} break; - case 218: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ + case 219: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ {yymsp[-3].minor.yy414.limit = yymsp[-2].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[0].minor.yy369;} break; - case 219: /* slimit_opt ::= SLIMIT signed COMMA signed */ + case 220: /* slimit_opt ::= SLIMIT signed COMMA signed */ {yymsp[-3].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[-2].minor.yy369;} break; - case 222: /* expr ::= LP expr RP */ + case 223: /* expr ::= LP expr RP */ {yylhsminor.yy166 = yymsp[-1].minor.yy166; yylhsminor.yy166->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy166->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 223: /* expr ::= ID */ + case 224: /* expr ::= ID */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 224: /* expr ::= ID DOT ID */ + case 225: /* expr ::= ID DOT ID */ { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 225: /* expr ::= ID DOT STAR */ + case 226: /* expr ::= ID DOT STAR */ { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 226: /* expr ::= INTEGER */ + case 227: /* expr ::= INTEGER */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 227: /* expr ::= MINUS INTEGER */ - case 228: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==228); + case 228: /* expr ::= MINUS INTEGER */ + case 229: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==229); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} yymsp[-1].minor.yy166 = yylhsminor.yy166; break; - case 229: /* expr ::= FLOAT */ + case 230: /* expr ::= FLOAT */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 230: /* expr ::= MINUS FLOAT */ - case 231: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==231); + case 231: /* expr ::= MINUS FLOAT */ + case 232: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==232); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} yymsp[-1].minor.yy166 = yylhsminor.yy166; break; - case 232: /* expr ::= STRING */ + case 233: /* expr ::= STRING */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 233: /* expr ::= NOW */ + case 234: /* expr ::= NOW */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 234: /* expr ::= VARIABLE */ + case 235: /* expr ::= VARIABLE */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 235: /* expr ::= PLUS VARIABLE */ - case 236: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==236); + case 236: /* expr ::= PLUS VARIABLE */ + case 237: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==237); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);} yymsp[-1].minor.yy166 = yylhsminor.yy166; break; - case 237: /* expr ::= BOOL */ + case 238: /* expr ::= BOOL */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 238: /* expr ::= NULL */ + case 239: /* expr ::= NULL */ { yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 239: /* expr ::= ID LP exprlist RP */ + case 240: /* expr ::= ID LP exprlist RP */ { yylhsminor.yy166 = tSqlExprCreateFunction(yymsp[-1].minor.yy441, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy166 = yylhsminor.yy166; break; - case 240: /* expr ::= ID LP STAR RP */ + case 241: /* expr ::= ID LP STAR RP */ { yylhsminor.yy166 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy166 = yylhsminor.yy166; break; - case 241: /* expr ::= expr IS NULL */ + case 242: /* expr ::= expr IS NULL */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, NULL, TK_ISNULL);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 242: /* expr ::= expr IS NOT NULL */ + case 243: /* expr ::= expr IS NOT NULL */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-3].minor.yy166, NULL, TK_NOTNULL);} yymsp[-3].minor.yy166 = yylhsminor.yy166; break; - case 243: /* expr ::= expr LT expr */ + case 244: /* expr ::= expr LT expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LT);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 244: /* expr ::= expr GT expr */ + case 245: /* expr ::= expr GT expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_GT);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 245: /* expr ::= expr LE expr */ + case 246: /* expr ::= expr LE expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LE);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 246: /* expr ::= expr GE expr */ + case 247: /* expr ::= expr GE expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_GE);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 247: /* expr ::= expr NE expr */ + case 248: /* expr ::= expr NE expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_NE);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 248: /* expr ::= expr EQ expr */ + case 249: /* expr ::= expr EQ expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_EQ);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 249: /* expr ::= expr BETWEEN expr AND expr */ + case 250: /* expr ::= expr BETWEEN expr AND expr */ { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy166); yylhsminor.yy166 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy166, yymsp[-2].minor.yy166, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy166, TK_LE), TK_AND);} yymsp[-4].minor.yy166 = yylhsminor.yy166; break; - case 250: /* expr ::= expr AND expr */ + case 251: /* expr ::= expr AND expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_AND);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 251: /* expr ::= expr OR expr */ + case 252: /* expr ::= expr OR expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_OR); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 252: /* expr ::= expr PLUS expr */ + case 253: /* expr ::= expr PLUS expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_PLUS); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 253: /* expr ::= expr MINUS expr */ + case 254: /* expr ::= expr MINUS expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_MINUS); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 254: /* expr ::= expr STAR expr */ + case 255: /* expr ::= expr STAR expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_STAR); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 255: /* expr ::= expr SLASH expr */ + case 256: /* expr ::= expr SLASH expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_DIVIDE);} yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 256: /* expr ::= expr REM expr */ + case 257: /* expr ::= expr REM expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_REM); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 257: /* expr ::= expr LIKE expr */ + case 258: /* expr ::= expr LIKE expr */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LIKE); } yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 258: /* expr ::= expr IN LP exprlist RP */ + case 259: /* expr ::= expr IN LP exprlist RP */ {yylhsminor.yy166 = tSqlExprCreate(yymsp[-4].minor.yy166, (tSqlExpr*)yymsp[-1].minor.yy441, TK_IN); } yymsp[-4].minor.yy166 = yylhsminor.yy166; break; - case 259: /* exprlist ::= exprlist COMMA expritem */ + case 260: /* exprlist ::= exprlist COMMA expritem */ {yylhsminor.yy441 = tSqlExprListAppend(yymsp[-2].minor.yy441,yymsp[0].minor.yy166,0, 0);} yymsp[-2].minor.yy441 = yylhsminor.yy441; break; - case 260: /* exprlist ::= expritem */ + case 261: /* exprlist ::= expritem */ {yylhsminor.yy441 = tSqlExprListAppend(0,yymsp[0].minor.yy166,0, 0);} yymsp[0].minor.yy441 = yylhsminor.yy441; break; - case 261: /* expritem ::= expr */ + case 262: /* expritem ::= expr */ {yylhsminor.yy166 = yymsp[0].minor.yy166;} yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 263: /* cmd ::= RESET QUERY CACHE */ + case 264: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 264: /* cmd ::= SYNCDB ids REPLICA */ + case 265: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 265: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 266: /* 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.yy441, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 266: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 267: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3089,21 +3095,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 267: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 268: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy441, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 268: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 269: /* 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.yy441, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 269: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 270: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3114,7 +3120,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 270: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 271: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3128,7 +3134,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 271: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 272: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3140,21 +3146,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 272: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 273: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy441, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 273: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 274: /* 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.yy441, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 274: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 275: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3165,21 +3171,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 275: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 276: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy441, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 276: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 277: /* 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.yy441, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 277: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 278: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3190,7 +3196,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 278: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 279: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3204,7 +3210,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 279: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 280: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3216,20 +3222,20 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 280: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 281: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy441, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 281: /* cmd ::= KILL CONNECTION INTEGER */ + case 282: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 282: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 283: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 283: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 284: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 4ac900e30ef0418e47c970c6cb9da813b6b83104..92edd4d160f56973d465a80018ebac8df3efce50 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3355,11 +3355,16 @@ static bool tableFilterFp(const void* pNode, void* param) { } } else if (pInfo->optr == TSDB_RELATION_IN) { int type = pInfo->sch.type; - if (type == TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_TINYINT || type == TSDB_DATA_TYPE_SMALLINT || type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_INT) { + if (type == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_TIMESTAMP) { int64_t v; GET_TYPED_DATA(v, int64_t, pInfo->sch.type, val); return NULL != taosHashGet((SHashObj *)pInfo->q, (char *)&v, sizeof(v)); - } else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_DOUBLE) { + } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { + uint64_t v; + GET_TYPED_DATA(v, uint64_t, pInfo->sch.type, val); + return NULL != taosHashGet((SHashObj *)pInfo->q, (char *)&v, sizeof(v)); + } + else if (type == TSDB_DATA_TYPE_DOUBLE || type == TSDB_DATA_TYPE_DOUBLE) { double v; GET_TYPED_DATA(v, double, pInfo->sch.type, val); return NULL != taosHashGet((SHashObj *)pInfo->q, (char *)&v, sizeof(v)); diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 5b4a69af206d1f0018dd1d90936888c940ac8537..e68d868b7095f712eac49137ee338e176a27b92c 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -73,6 +73,7 @@ python3 ./test.py -f tag_lite/int.py python3 ./test.py -f tag_lite/set.py python3 ./test.py -f tag_lite/smallint.py python3 ./test.py -f tag_lite/tinyint.py +python3 ./test.py -f tag_lite/timestamp.py #python3 ./test.py -f dbmgmt/database-name-boundary.py python3 test.py -f dbmgmt/nanoSecondCheck.py diff --git a/tests/pytest/functions/function_operations.py b/tests/pytest/functions/function_operations.py index 859cd78a3d396cf6a4fd9d08c24f6f7bd6ac324c..3e90d1d3eab8288fb9b6b0bb293250e6cf7ae2a1 100644 --- a/tests/pytest/functions/function_operations.py +++ b/tests/pytest/functions/function_operations.py @@ -16,7 +16,7 @@ import taos from util.log import * from util.cases import * from util.sql import * -import numpy as np +#import numpy as np class TDTestCase: diff --git a/tests/pytest/tag_lite/timestamp.py b/tests/pytest/tag_lite/timestamp.py new file mode 100644 index 0000000000000000000000000000000000000000..fa71c2e15422e80076f2b6a6eb26e8198a69a569 --- /dev/null +++ b/tests/pytest/tag_lite/timestamp.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdLog.info('======================== dnode1 start') + tbPrefix = "ta_fl_tb" + mtPrefix = "ta_fl_mt" + tbNum = 10 + rowNum = 20 + totalNum = 200 + tdLog.info('=============== step1') + i = 0 + mt = "%s%d" % (mtPrefix, i) + tdSql.execute( + 'create table %s (ts timestamp, tbcol int) TAGS(tgcol float, tgTs timestamp, tgcol2 int)' %(mt)) + i = 0 + ts = 1605045600000 + tsStr = "2020-11-11 06:00:00" + while (i < 5): + tb = "%s%d" % (tbPrefix, i) + tdLog.info('create table %s using %s tags(%d, %d, %d)' % (tb, mt, i, ts + i, i)) + tdSql.execute('create table %s using %s tags(%d, %d, %d)' % (tb, mt, i, ts + i, i)) + x = 0 + while (x < rowNum): + ms = x * 60000 + #tdLog.info( + # "insert into %s values (%d, %d)" % + # (tb, 1605045600000 + ms, x)) + tdSql.execute( + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) + x = x + 1 + i = i + 1 + tdLog.info('=============== step2') + tdSql.query('select * from %s' % (mt)) + tdSql.checkRows(5 * rowNum) + + tdSql.query('select * from %s where tgTs = %ld and tgcol2 = 0' % (mt, ts)) + tdSql.checkRows(rowNum) + + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 0' % (mt, tsStr)) + tdSql.checkRows(rowNum) + + tdLog.info('=============== step3') + i = 0 + while (i < 5): + tb = "%s%d" % (tbPrefix, i + 100) + tdLog.info('create table %s using %s tags(%d, \"%s\", %d)' % (tb, mt, i + 100, tsStr, i + 100)) + tdSql.execute('create table %s using %s tags(%d, \"%s\", %d)' % (tb, mt, i + 100, tsStr, i + 100)) + x = 0 + while (x < rowNum): + ms = x * 60000 + #tdLog.info( + # "insert into %s values (%d, %d)" % + # (tb, 1605045600000 + ms, x)) + tdSql.execute( + "insert into %s values (%d, %d)" % + (tb, 1605045600000 + ms, x)) + x = x + 1 + i = i + 1 + + tdSql.query('select * from %s where tgTs = %ld and tgcol2 = 100' % (mt, ts)) + tdSql.checkRows(rowNum) + + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 100' % (mt, tsStr)) + tdSql.checkRows(rowNum) + + tdLog.info('=============== step4') + + i = 0 + tb = "%s%d"%(tbPrefix, i + 1000) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+2s, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+3s, 10)' % (tb, mt, i + 100, tsStr, i + 1000)) + tdSql.query('select * from %s where tgTs = \"%s\" and tgcol2 = 1000' % (mt, tsStr)) + tdSql.checkRows(3) + + i = 0 + tb = "%s%d"%(tbPrefix, i + 10000) + tdSql.execute('create table %s using %s tags(%d, now, %d)' % (tb, mt, i + 10000,i + 10000)) + tdSql.checkRows(3) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/general/parser/create_mt.sim index ae1629dce9861d7540bda4b6d4014e32ce2ce52d..c606ba99ecb5f9060de9bb8f52af916c2d2b96b6 100644 --- a/tests/script/general/parser/create_mt.sim +++ b/tests/script/general/parser/create_mt.sim @@ -99,7 +99,7 @@ $i_binary2 = varchar(20) # illegal string $i_bool = boolean $nchar = nchar # nchar with unspecified length print ========== create_mt.sim case4: illegal data types in tags test -sql_error create table $mt (ts timestamp, col int) tags (tag1 timestamp ) +##sql_error create table $mt (ts timestamp, col int) tags (tag1 timestamp ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_ts ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bigint ) @@ -253,4 +253,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/where.sim b/tests/script/general/parser/where.sim index 6dfea3d2e70e75f82fd7bd48cd5578971e158de4..00a22eede6a584e99c80bc80919ff04d4f80790b 100644 --- a/tests/script/general/parser/where.sim +++ b/tests/script/general/parser/where.sim @@ -155,8 +155,8 @@ sql_error select last(*) from wh_mt1_tb1 where c6 in ('1') #sql_error select last(*) from wh_mt1_tb1 where c7 in ('binary') #sql_error select last(*) from wh_mt1 where c8 in ('nchar') #sql_error select last(*) from wh_mt1_tb1 where c9 in (true, false) -sql_error select last(*) from wh_mt1 where c10 in ('2019-01-01 00:00:00.000') -sql_error select last(*) from wh_mt1_tb1 where c10 in ('2019-01-01 00:00:00.000') +#sql_error select last(*) from wh_mt1 where c10 in ('2019-01-01 00:00:00.000') +#sql_error select last(*) from wh_mt1_tb1 where c10 in ('2019-01-01 00:00:00.000') sql select last(*) from wh_mt1 where c1 = 1 if $rows != 1 then return -1