diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index acd6e577703b7ddc028ff487fb8b48f5bbce73f9..b183598fcceff926cfba235e42d8634546b36a48 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -83,6 +83,11 @@ typedef struct SJoinSupporter { int32_t totalLen; int32_t num; SArray* pVgroupTables; + + int16_t fillType; // final result fill type + int64_t * fillVal; // default value for fill + int32_t numOfFillVal; // fill value size + } SJoinSupporter; @@ -148,6 +153,7 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i * @return */ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo); +bool tscGetPointInterpQuery(SQueryInfo* pQueryInfo); bool tscIsTWAQuery(SQueryInfo* pQueryInfo); bool tscIsIrateQuery(SQueryInfo* pQueryInfo); bool tscQueryContainsFunction(SQueryInfo* pQueryInfo, int16_t functionId); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 4a53dcd1c54d943ecadf144dcc701652f4c1d6e6..a42fbfcfd473127812c0473fe92c3dadb6904be6 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -101,6 +101,7 @@ static int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQuery static int32_t validateWhereNode(SQueryInfo* pQueryInfo, tSqlExpr** pExpr, SSqlObj* pSql); static int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode); +static int32_t validateRangeNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode); static int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSchema* pSchema); static int32_t tsRewriteFieldNameIfNecessary(SSqlCmd* pCmd, SQueryInfo* pQueryInfo); @@ -116,7 +117,6 @@ static int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo, int32_t killTy static int32_t setCompactVnodeInfo(SSqlObj* pSql, struct SSqlInfo* pInfo); static int32_t validateOneTag(SSqlCmd* pCmd, TAOS_FIELD* pTagField); -static bool hasTimestampForPointInterpQuery(SQueryInfo* pQueryInfo); static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo); static int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql); @@ -1120,7 +1120,8 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS const char* msg1 = "sliding cannot be used without interval"; const char* msg2 = "interval cannot be less than 1 us"; const char* msg3 = "interval value is too small"; - const char* msg4 = "only point interpolation query requires keyword EVERY"; + const char* msg4 = "invalid usage of EVERY"; + const char* msg5 = "EVERY instead of INTERVAL required for interp clause"; SSqlCmd* pCmd = &pSql->cmd; @@ -1132,6 +1133,12 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + + if (interpQuery) { + return addPrimaryTsColumnForTimeWindowQuery(pQueryInfo, pCmd); + } + return TSDB_CODE_SUCCESS; } @@ -1166,11 +1173,15 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS return TSDB_CODE_TSC_INVALID_OPERATION; } - bool interpQuery = tscIsPointInterpQuery(pQueryInfo); - if ((pSqlNode->interval.token == TK_EVERY && (!interpQuery)) || (pSqlNode->interval.token == TK_INTERVAL && interpQuery)) { + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (pSqlNode->interval.token == TK_EVERY && (!interpQuery)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); } + if (pSqlNode->interval.token == TK_INTERVAL && interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); + } + // The following part is used to check for the invalid query expression. return checkInvalidExprForTimeWindow(pCmd, pQueryInfo); } @@ -1182,6 +1193,7 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS const char* msg3 = "not support state_window with group by "; const char* msg4 = "function not support for super table query"; const char* msg5 = "not support state_window on tag column"; + const char* msg6 = "function not support for state_window"; SStrToken *col = &(pSqlNode->windowstateVal.col) ; if (col->z == NULL || col->n <= 0) { @@ -1227,6 +1239,11 @@ static int32_t validateStateWindowNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); + } + tscColumnListInsert(pQueryInfo->colList, index.columnIndex, pTableMeta->id.uid, pSchema); SColIndex colIndex = { .colIndex = index.columnIndex, .flag = TSDB_COL_NORMAL, .colId = pSchema->colId }; taosArrayPush(pGroupExpr->columnInfo, &colIndex); @@ -1240,6 +1257,7 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS const char* msg2 = "only one type time window allowed"; const char* msg3 = "invalid column name"; const char* msg4 = "invalid time window"; + const char* msg5 = "function not support for session"; STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -1275,6 +1293,11 @@ int32_t validateSessionNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode * pS return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } + bool interpQuery = tscGetPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); + } + pQueryInfo->sessionWindow.primaryColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; // The following part is used to check for the invalid query expression. @@ -1285,6 +1308,7 @@ int32_t parseIntervalOffset(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* of const char* msg1 = "interval offset cannot be negative"; const char* msg2 = "interval offset should be shorter than interval"; const char* msg3 = "cannot use 'year' as offset when interval is 'month'"; + const char* msg4 = "wrong every format"; STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -1296,6 +1320,11 @@ int32_t parseIntervalOffset(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* of return TSDB_CODE_SUCCESS; } + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + if (parseNatualDuration(t->z, t->n, &pQueryInfo->interval.offset, &pQueryInfo->interval.offsetUnit, tinfo.precision) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; @@ -1334,6 +1363,7 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl const char* msg1 = "sliding value no larger than the interval value"; const char* msg2 = "sliding value can not less than 1% of interval value"; const char* msg3 = "does not support sliding when interval is natural month/year"; + const char* msg4 = "sliding not support for interp query"; const static int32_t INTERVAL_SLIDING_FACTOR = 100; @@ -1347,6 +1377,11 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl return TSDB_CODE_SUCCESS; } + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + if (interpQuery) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4); + } + if (pInterval->intervalUnit == 'n' || pInterval->intervalUnit == 'y') { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); } @@ -2350,6 +2385,12 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return -1; } + } else if (f == TSDB_FUNC_INTERP) { + int32_t t1 = pSchema->type; + if (!IS_NUMERIC_TYPE(t1)) { + invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + return -1; + } } int16_t resType = 0; @@ -3185,6 +3226,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // create tmp buf to avoid alter orginal sqlstr strncpy(tmpTokenBuf, pToken->z, pToken->n); + pToken->z = tmpTokenBuf; if (pToken->type == TK_ID) { @@ -3502,8 +3544,8 @@ void tscRestoreFuncForSTableQuery(SQueryInfo* pQueryInfo) { } bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { - const char* msg1 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE are not allowed to apply to super table directly"; - const char* msg2 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE only support group by tbname for super table query"; + const char* msg1 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE/INTERP are not allowed to apply to super table directly"; + const char* msg2 = "TWA/Diff/Derivative/Irate/CSUM/MAVG/SAMPLE/INTERP only support group by tbname for super table query"; const char* msg3 = "functions not support for super table query"; // filter sql function not supported by metric query yet. @@ -3521,7 +3563,7 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) } if (tscIsTWAQuery(pQueryInfo) || tscIsDiffDerivLikeQuery(pQueryInfo) || tscIsIrateQuery(pQueryInfo) || - tscQueryContainsFunction(pQueryInfo, TSDB_FUNC_SAMPLE)) { + tscQueryContainsFunction(pQueryInfo, TSDB_FUNC_SAMPLE) || tscGetPointInterpQuery(pQueryInfo)) { if (pQueryInfo->groupbyExpr.numOfGroupCols == 0) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return true; @@ -3532,6 +3574,11 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return true; } + + if (tscGetPointInterpQuery(pQueryInfo) && taosArrayGetSize(pQueryInfo->groupbyExpr.columnInfo) > 1) { + invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); + return true; + } } else if (tscIsSessionWindowQuery(pQueryInfo)) { invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return true; @@ -5608,13 +5655,14 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo const char* msg3 = "top/bottom/sample not support fill"; const char* msg4 = "illegal value or data overflow"; const char* msg5 = "fill only available for interval query"; - const char* msg6 = "not supported function now"; const char* msg7 = "join query not supported fill operation"; - if ((!isTimeWindowQuery(pQueryInfo)) && (!tscIsPointInterpQuery(pQueryInfo))) { + bool pointInterp = tscIsPointInterpQuery(pQueryInfo); + if ((!isTimeWindowQuery(pQueryInfo)) && (!pointInterp)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg5); } - if(QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { + + if (QUERY_IS_JOIN_QUERY(pQueryInfo->type) && (!pointInterp)) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7); } @@ -5622,11 +5670,10 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo * fill options are set at the end position, when all columns are set properly * the columns may be increased due to group by operation */ - if (checkQueryRangeForFill(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS) { + if ((!pointInterp) && checkQueryRangeForFill(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; } - if (pItem->pVar.nType != TSDB_DATA_TYPE_BINARY) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -5651,9 +5698,6 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo } } else if (strncasecmp(pItem->pVar.pz, "prev", 4) == 0 && pItem->pVar.nLen == 4) { pQueryInfo->fillType = TSDB_FILL_PREV; - if (tscIsPointInterpQuery(pQueryInfo) && pQueryInfo->order.order == TSDB_ORDER_DESC) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); - } } else if (strncasecmp(pItem->pVar.pz, "next", 4) == 0 && pItem->pVar.nLen == 4) { pQueryInfo->fillType = TSDB_FILL_NEXT; } else if (strncasecmp(pItem->pVar.pz, "linear", 6) == 0 && pItem->pVar.nLen == 6) { @@ -5670,7 +5714,7 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo int32_t numOfFillVal = (int32_t)(num - 1); /* for point interpolation query, we do not have the timestamp column */ - if (tscIsPointInterpQuery(pQueryInfo)) { + if (pointInterp) { startPos = 0; if (numOfFillVal > numOfFields) { @@ -5697,7 +5741,7 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo } } - if ((num < numOfFields) || ((num - 1 < numOfFields) && (tscIsPointInterpQuery(pQueryInfo)))) { + if ((num < numOfFields) || ((num - 1 < numOfFields) && pointInterp)) { tVariantListItem* lastItem = taosArrayGetLast(pFillToken); for (int32_t i = numOfFillVal; i < numOfFields; ++i) { @@ -5726,6 +5770,55 @@ int32_t validateFillNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNo return TSDB_CODE_SUCCESS; } + + +int32_t validateRangeNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode) { + const char *msg0 = "invalid usage of range clause"; + const char* msg1 = "invalid timestamp in range"; + SSqlCmd* pCmd = &pSql->cmd; + + bool interpQuery = tscIsPointInterpQuery(pQueryInfo); + + if ((!interpQuery) && (pSqlNode->pRange.start || pSqlNode->pRange.end)) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0); + } + + if (pSqlNode->pRange.start == NULL || pSqlNode->pRange.end == NULL) { + pQueryInfo->range.skey = INT64_MIN; + pQueryInfo->range.ekey = INT64_MIN; + + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"]", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + return TSDB_CODE_SUCCESS; + } + + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); + + if (getTimeRange(&pQueryInfo->range, pSqlNode->pRange.start, TK_GE, tinfo.precision) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (getTimeRange(&pQueryInfo->range, pSqlNode->pRange.end, TK_LE, tinfo.precision) != TSDB_CODE_SUCCESS) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if (pQueryInfo->range.ekey < pQueryInfo->range.skey) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + if ((pQueryInfo->range.skey > pQueryInfo->window.ekey && (pQueryInfo->fillType == TSDB_FILL_NONE || pQueryInfo->fillType == TSDB_FILL_LINEAR || pQueryInfo->fillType == TSDB_FILL_NEXT)) + || (pQueryInfo->range.ekey < pQueryInfo->window.skey && (pQueryInfo->fillType == TSDB_FILL_NONE || pQueryInfo->fillType == TSDB_FILL_LINEAR || pQueryInfo->fillType == TSDB_FILL_PREV))) { + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"], no output result", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + pQueryInfo->command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + return TSDB_CODE_SUCCESS; + } + + tscDebug("0x%"PRIx64" range [%"PRId64",%"PRId64"], ts [%"PRId64",%"PRId64"]", pSql->self, pQueryInfo->range.skey, pQueryInfo->range.ekey, pQueryInfo->window.skey, pQueryInfo->window.ekey); + + return TSDB_CODE_SUCCESS; +} + + static void setDefaultOrderInfo(SQueryInfo* pQueryInfo) { /* set default timestamp order information for all queries */ STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -6705,18 +6798,6 @@ int32_t validateColumnName(char* name) { return TSDB_CODE_SUCCESS; } -bool hasTimestampForPointInterpQuery(SQueryInfo* pQueryInfo) { - if (!tscIsPointInterpQuery(pQueryInfo)) { - return true; - } - - if (pQueryInfo->window.skey == INT64_MIN || pQueryInfo->window.ekey == INT64_MAX) { - return false; - } - - return !(pQueryInfo->window.skey != pQueryInfo->window.ekey && pQueryInfo->interval.interval == 0); -} - int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode, SSqlObj* pSql) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -7198,7 +7279,7 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) { continue; } - if ((functionId == TSDB_FUNC_LAST_ROW) || + if ((functionId == TSDB_FUNC_LAST_ROW) || (functionId == TSDB_FUNC_INTERP) || (functionId == TSDB_FUNC_LAST_DST && (pExpr->base.colInfo.flag & TSDB_COL_NULL) != 0)) { // do nothing } else { @@ -7452,6 +7533,10 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) { const char* msg1 = "TWA/Diff/Derivative/Irate are not allowed to apply to super table without group by tbname"; + const char* msg2 = "group by not supported in nested interp query"; + const char* msg3 = "order by not supported in nested interp query"; + const char* msg4 = "first column should be timestamp for interp query"; + const char* msg5 = "interp input may be invalid"; int32_t numOfExprs = (int32_t)tscNumOfExprs(pQueryInfo); size_t upNum = taosArrayGetSize(pQueryInfo->pUpstream); @@ -7471,6 +7556,54 @@ int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) { } return invalidOperationMsg(msg, msg1); + } else if (f == TSDB_FUNC_INTERP) { + if (pQueryInfo->groupbyExpr.columnInfo) { + return invalidOperationMsg(msg, msg2); + } + + if (pQueryInfo->order.order == TSDB_ORDER_DESC || (pQueryInfo->order.orderColId != INT32_MIN && pQueryInfo->order.orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX)) { + return invalidOperationMsg(msg, msg3); + } + + for (int32_t j = 0; j < upNum; ++j) { + SQueryInfo* pUp = taosArrayGetP(pQueryInfo->pUpstream, j); + if (pUp->groupbyExpr.columnInfo) { + return invalidOperationMsg(msg, msg2); + } + + if (pUp->order.order == TSDB_ORDER_DESC || (pUp->order.orderColId != INT32_MIN && pUp->order.orderColId != PRIMARYKEY_TIMESTAMP_COL_INDEX)) { + return invalidOperationMsg(msg, msg3); + } + + int32_t exprNum = (int32_t)taosArrayGetSize(pUp->exprList); + if (exprNum > 0) { + SSqlExpr* expr = taosArrayGetP(pUp->exprList, 0); + if (expr->resType != TSDB_DATA_TYPE_TIMESTAMP) { + return invalidOperationMsg(msg, msg4); + } + + STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pUp, 0); + bool isSTable = UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo); + if (!isSTable) { + continue; + } + + if (TSDB_QUERY_HAS_TYPE(pUp->type, TSDB_QUERY_TYPE_PROJECTION_QUERY)) { + return invalidOperationMsg(msg, msg5); + } + + for (int32_t n = 0; n < exprNum; ++n) { + expr = taosArrayGetP(pUp->exprList, n); + if (expr->functionId == TSDB_FUNC_TOP || + expr->functionId == TSDB_FUNC_BOTTOM || + expr->functionId == TSDB_FUNC_SAMPLE) { + if (expr->param[0].i64 > 1) { + return invalidOperationMsg(msg, msg5); + } + } + } + } + } } } @@ -8930,7 +9063,6 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInfo) { assert(pSqlNode != NULL && (pSqlNode->from == NULL || taosArrayGetSize(pSqlNode->from->list) > 0)); - const char* msg1 = "point interpolation query needs timestamp"; const char* msg2 = "too many tables in from clause"; const char* msg3 = "start(end) time of query range required or time range too large"; const char* msg4 = "interval query not supported, since the result of sub query not include valid timestamp column"; @@ -9000,7 +9132,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf for (int32_t i = 0; i < tscNumOfExprs(pQueryInfo); ++i) { SExprInfo* pExpr = tscExprGet(pQueryInfo, i); int32_t f = pExpr->base.functionId; - if (f == TSDB_FUNC_STDDEV || f == TSDB_FUNC_PERCT || f == TSDB_FUNC_INTERP) { + if (f == TSDB_FUNC_STDDEV || f == TSDB_FUNC_PERCT) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg6); } @@ -9103,6 +9235,10 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf if ((code = validateFillNode(pCmd, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { return code; } + + if ((code = validateRangeNode(pSql, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { + return code; + } } else { pQueryInfo->command = TSDB_SQL_SELECT; @@ -9210,10 +9346,6 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf return TSDB_CODE_SUCCESS; } - if (!hasTimestampForPointInterpQuery(pQueryInfo)) { - return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); - } - // in case of join query, time range is required. if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { uint64_t timeRange = (uint64_t)pQueryInfo->window.ekey - pQueryInfo->window.skey; @@ -9237,6 +9369,11 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf if ((code = validateFillNode(pCmd, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { return code; } + + if ((code = validateRangeNode(pSql, pQueryInfo, pSqlNode)) != TSDB_CODE_SUCCESS) { + return code; + } + } { // set the query info diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 4d592211d0b59d03924165ace0dd20f4fd769361..52a918bbe22589d85fc89cbff8249065129f1618 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -916,7 +916,9 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pQueryMsg->window.skey = htobe64(query.window.skey); pQueryMsg->window.ekey = htobe64(query.window.ekey); - + pQueryMsg->range.skey = htobe64(query.range.skey); + pQueryMsg->range.ekey = htobe64(query.range.ekey); + pQueryMsg->order = htons(query.order.order); pQueryMsg->orderColId = htons(query.order.orderColId); pQueryMsg->fillType = htons(query.fillType); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index f5702b4e35d69ced9bf024285f86dfb306900a60..2412b8336efbcf289fc4d2e11796b01b02f8174d 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -394,6 +394,12 @@ SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index) { memcpy(&pSupporter->interval, &pQueryInfo->interval, sizeof(pSupporter->interval)); pSupporter->limit = pQueryInfo->limit; + if (tscIsPointInterpQuery(pQueryInfo)) { + pSupporter->fillType = pQueryInfo->fillType; + pSupporter->fillVal = pQueryInfo->fillVal; + pSupporter->numOfFillVal = pQueryInfo->numOfFillVal; + } + STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, index); pSupporter->uid = pTableMetaInfo->pTableMeta->id.uid; assert (pSupporter->uid != 0); @@ -579,6 +585,13 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { pQueryInfo->fieldsInfo = pSupporter->fieldsInfo; pQueryInfo->groupbyExpr = pSupporter->groupInfo; pQueryInfo->pUpstream = taosArrayInit(4, sizeof(POINTER_BYTES)); + + if (tscIsPointInterpQuery(pQueryInfo)) { + pQueryInfo->fillType = pSupporter->fillType; + pQueryInfo->numOfFillVal = pSupporter->numOfFillVal; + pQueryInfo->fillVal = malloc(pQueryInfo->numOfFillVal * sizeof(*pSupporter->fillVal)); + memcpy(pQueryInfo->fillVal, pSupporter->fillVal, sizeof(*pSupporter->fillVal) * pQueryInfo->numOfFillVal); + } assert(pNew->subState.numOfSub == 0 && pQueryInfo->numOfTables == 1); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 96f84dfa4865500921cafdd87487c28f50914fb1..50b9a8fd7eea703dffe34f8ad5eb204b310f0d7e 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -367,7 +367,7 @@ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo) { assert(pExpr != NULL); int32_t functionId = pExpr->base.functionId; - if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TS) { + if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TS_DUMMY) { continue; } @@ -379,6 +379,23 @@ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo) { return true; } +bool tscGetPointInterpQuery(SQueryInfo* pQueryInfo) { + size_t size = tscNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < size; ++i) { + SExprInfo* pExpr = tscExprGet(pQueryInfo, i); + assert(pExpr != NULL); + + int32_t functionId = pExpr->base.functionId; + + if (functionId == TSDB_FUNC_INTERP) { + return true; + } + } + + return false; +} + + bool tsIsArithmeticQueryOnAggResult(SQueryInfo* pQueryInfo) { if (tscIsProjectionQuery(pQueryInfo)) { return false; @@ -3441,7 +3458,7 @@ int32_t tscQueryInfoCopy(SQueryInfo* pQueryInfo, const SQueryInfo* pSrc) { pQueryInfo->clauseLimit = pSrc->clauseLimit; pQueryInfo->prjOffset = pSrc->prjOffset; pQueryInfo->numOfTables = 0; - pQueryInfo->window = pSrc->window; + pQueryInfo->range = pSrc->range; pQueryInfo->sessionWindow = pSrc->sessionWindow; pQueryInfo->pTableMetaInfo = NULL; pQueryInfo->multigroupResult = pSrc->multigroupResult; @@ -3834,6 +3851,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t memcpy(&pNewQueryInfo->interval, &pQueryInfo->interval, sizeof(pNewQueryInfo->interval)); pNewQueryInfo->type = pQueryInfo->type; pNewQueryInfo->window = pQueryInfo->window; + pNewQueryInfo->range = pQueryInfo->range; pNewQueryInfo->limit = pQueryInfo->limit; pNewQueryInfo->slimit = pQueryInfo->slimit; pNewQueryInfo->order = pQueryInfo->order; @@ -5053,6 +5071,7 @@ int32_t tscCreateQueryFromQueryInfo(SQueryInfo* pQueryInfo, SQueryAttr* pQueryAt pQueryAttr->fillType = pQueryInfo->fillType; pQueryAttr->havingNum = pQueryInfo->havingFieldNum; pQueryAttr->pUdfInfo = pQueryInfo->pUdfInfo; + pQueryAttr->range = pQueryInfo->range; if (pQueryInfo->order.order == TSDB_ORDER_ASC) { // TODO refactor pQueryAttr->window = pQueryInfo->window; @@ -5352,4 +5371,3 @@ char* cloneCurrentDBName(SSqlObj* pSql) { return p; } - diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 8444425b51a3063aed54ae5d2b1566d6d191a7d2..ea6a69aa386261d5742c732794580bbc14daf831 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -479,6 +479,7 @@ typedef struct { bool stateWindow; // state window flag STimeWindow window; + STimeWindow range; // result range for interp query int32_t numOfTables; int16_t order; int16_t orderColId; diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 9d82245c2199b5fa0b62d709a08633e5a976b007..f98e7eec31f9cea99505bada1e0e3e8729b8d139 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -405,6 +405,7 @@ void tsdbDestroyCommitQueue(); int tsdbSyncCommit(STsdbRepo *repo); void tsdbIncCommitRef(int vgId); void tsdbDecCommitRef(int vgId); +void tsdbSwitchTable(TsdbQueryHandleT pQueryHandle); // For TSDB file sync int tsdbSyncSend(void *pRepo, SOCKET socketFd); diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index b38dcb0871d7bac99af891c51671e82a68528470..4b6602b4124fe5e16c60700aebf3a1a2d55c77fd 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -142,77 +142,78 @@ #define TK_DISTINCT 124 #define TK_FROM 125 #define TK_VARIABLE 126 -#define TK_INTERVAL 127 -#define TK_EVERY 128 -#define TK_SESSION 129 -#define TK_STATE_WINDOW 130 -#define TK_FILL 131 -#define TK_SLIDING 132 -#define TK_ORDER 133 -#define TK_BY 134 -#define TK_ASC 135 -#define TK_GROUP 136 -#define TK_HAVING 137 -#define TK_LIMIT 138 -#define TK_OFFSET 139 -#define TK_SLIMIT 140 -#define TK_SOFFSET 141 -#define TK_WHERE 142 -#define TK_RESET 143 -#define TK_QUERY 144 -#define TK_SYNCDB 145 -#define TK_ADD 146 -#define TK_COLUMN 147 -#define TK_MODIFY 148 -#define TK_TAG 149 -#define TK_CHANGE 150 -#define TK_SET 151 -#define TK_KILL 152 -#define TK_CONNECTION 153 -#define TK_STREAM 154 -#define TK_COLON 155 -#define TK_ABORT 156 -#define TK_AFTER 157 -#define TK_ATTACH 158 -#define TK_BEFORE 159 -#define TK_BEGIN 160 -#define TK_CASCADE 161 -#define TK_CLUSTER 162 -#define TK_CONFLICT 163 -#define TK_COPY 164 -#define TK_DEFERRED 165 -#define TK_DELIMITERS 166 -#define TK_DETACH 167 -#define TK_EACH 168 -#define TK_END 169 -#define TK_EXPLAIN 170 -#define TK_FAIL 171 -#define TK_FOR 172 -#define TK_IGNORE 173 -#define TK_IMMEDIATE 174 -#define TK_INITIALLY 175 -#define TK_INSTEAD 176 -#define TK_KEY 177 -#define TK_OF 178 -#define TK_RAISE 179 -#define TK_REPLACE 180 -#define TK_RESTRICT 181 -#define TK_ROW 182 -#define TK_STATEMENT 183 -#define TK_TRIGGER 184 -#define TK_VIEW 185 -#define TK_IPTOKEN 186 -#define TK_SEMI 187 -#define TK_NONE 188 -#define TK_PREV 189 -#define TK_LINEAR 190 -#define TK_IMPORT 191 -#define TK_TBNAME 192 -#define TK_JOIN 193 -#define TK_INSERT 194 -#define TK_INTO 195 -#define TK_VALUES 196 -#define TK_FILE 197 +#define TK_RANGE 127 +#define TK_INTERVAL 128 +#define TK_EVERY 129 +#define TK_SESSION 130 +#define TK_STATE_WINDOW 131 +#define TK_FILL 132 +#define TK_SLIDING 133 +#define TK_ORDER 134 +#define TK_BY 135 +#define TK_ASC 136 +#define TK_GROUP 137 +#define TK_HAVING 138 +#define TK_LIMIT 139 +#define TK_OFFSET 140 +#define TK_SLIMIT 141 +#define TK_SOFFSET 142 +#define TK_WHERE 143 +#define TK_RESET 144 +#define TK_QUERY 145 +#define TK_SYNCDB 146 +#define TK_ADD 147 +#define TK_COLUMN 148 +#define TK_MODIFY 149 +#define TK_TAG 150 +#define TK_CHANGE 151 +#define TK_SET 152 +#define TK_KILL 153 +#define TK_CONNECTION 154 +#define TK_STREAM 155 +#define TK_COLON 156 +#define TK_ABORT 157 +#define TK_AFTER 158 +#define TK_ATTACH 159 +#define TK_BEFORE 160 +#define TK_BEGIN 161 +#define TK_CASCADE 162 +#define TK_CLUSTER 163 +#define TK_CONFLICT 164 +#define TK_COPY 165 +#define TK_DEFERRED 166 +#define TK_DELIMITERS 167 +#define TK_DETACH 168 +#define TK_EACH 169 +#define TK_END 170 +#define TK_EXPLAIN 171 +#define TK_FAIL 172 +#define TK_FOR 173 +#define TK_IGNORE 174 +#define TK_IMMEDIATE 175 +#define TK_INITIALLY 176 +#define TK_INSTEAD 177 +#define TK_KEY 178 +#define TK_OF 179 +#define TK_RAISE 180 +#define TK_REPLACE 181 +#define TK_RESTRICT 182 +#define TK_ROW 183 +#define TK_STATEMENT 184 +#define TK_TRIGGER 185 +#define TK_VIEW 186 +#define TK_IPTOKEN 187 +#define TK_SEMI 188 +#define TK_NONE 189 +#define TK_PREV 190 +#define TK_LINEAR 191 +#define TK_IMPORT 192 +#define TK_TBNAME 193 +#define TK_JOIN 194 +#define TK_INSERT 195 +#define TK_INTO 196 +#define TK_VALUES 197 +#define TK_FILE 198 diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 3f1606e957564f0a86988a389071957d2204d391..095b593ab7d1fb74effd7991feeeb60f54cbc1b8 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -50,6 +50,47 @@ typedef struct { #define TSDB_DATA_TYPE_POINTER_ARRAY (1000) #define TSDB_DATA_TYPE_VALUE_ARRAY (1001) +#define COPY_DATA(dst, src) *((int64_t *)(dst)) = *((int64_t *)(src)) + +#define COPY_TYPED_DATA(_v, _type, _data) \ + do { \ + switch (_type) { \ + case TSDB_DATA_TYPE_BOOL: \ + case TSDB_DATA_TYPE_TINYINT: \ + (*(int8_t *)_v) = GET_INT8_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UTINYINT: \ + (*(uint8_t *)_v) = GET_UINT8_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_SMALLINT: \ + (*(int16_t *)_v) = GET_INT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_USMALLINT: \ + (*(uint16_t *)_v) = GET_UINT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_TIMESTAMP: \ + case TSDB_DATA_TYPE_BIGINT: \ + (*(int64_t *)_v) = (GET_INT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_UBIGINT: \ + (*(uint64_t *)_v) = (GET_UINT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_FLOAT: \ + (*(float *)_v) = GET_FLOAT_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_DOUBLE: \ + (*(double *)_v) = GET_DOUBLE_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UINT: \ + (*(uint32_t *)_v) = GET_UINT32_VAL(_data); \ + break; \ + default: \ + (*(int32_t *)_v) = GET_INT32_VAL(_data); \ + break; \ + } \ + } while (0) + + #define GET_TYPED_DATA(_v, _finalType, _type, _data) \ do { \ switch (_type) { \ diff --git a/src/os/inc/osTime.h b/src/os/inc/osTime.h index dcb0e4c9b630216600c4f8f017b8154e9bb9dac4..798a08e3e6e16470a750cbd8bfed429539b44d8d 100644 --- a/src/os/inc/osTime.h +++ b/src/os/inc/osTime.h @@ -94,6 +94,8 @@ typedef struct SSessionWindow { } SSessionWindow; int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision); +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision); + int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision); int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision); diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index ec442f42a64b30611137a66b6993fd7309ea0cab..73345426c9a266c57ac286efac716f5c5490b8bf 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -548,6 +548,27 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); } +int64_t taosTimeSub(int64_t t, int64_t duration, char unit, int32_t precision) { + if (duration == 0) { + return t; + } + if (unit == 'y') { + duration *= 12; + } else if (unit != 'n') { + return t - duration; + } + + struct tm tm; + time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision)); + localtime_r(&tt, &tm); + int mon = tm.tm_year * 12 + tm.tm_mon - (int)duration; + tm.tm_year = mon / 12; + tm.tm_mon = mon % 12; + + return (int64_t)(mktime(&tm) * TSDB_TICK_PER_SECOND(precision)); +} + + int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision) { if (ekey < skey) { int64_t tmp = ekey; diff --git a/src/query/inc/qAggMain.h b/src/query/inc/qAggMain.h index 8bcd8fea42aa46ad3dd2f0857d88a9b4bb76dd4d..4ba6dd2c536d9bbf3b5e2b3430293671a0ecb7b7 100644 --- a/src/query/inc/qAggMain.h +++ b/src/query/inc/qAggMain.h @@ -192,6 +192,7 @@ typedef struct SQLFunctionCtx { char * pOutput; // final result output buffer, point to sdata->data uint8_t currentStage; // record current running step, default: 0 int64_t startTs; // timestamp range of current query when function is executed on a specific data block + int64_t endTs; int32_t numOfParams; tVariant param[4]; // input parameter, e.g., top(k, 20), the number of results for top query is kept in param int64_t *ptsList; // corresponding timestamp array list diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index 47493bdb71f181a3e9d3a4dcc3174705ecc99ed2..fe4fb6c950d4f3e0186668d957900934ba243e5d 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -63,6 +63,10 @@ enum { QUERY_OVER = 0x4u, }; +enum { + OPTION_SWITCH_TABLE = 1, +}; + typedef struct SResultRowPool { int32_t elemSize; int32_t blockSize; @@ -241,6 +245,7 @@ typedef struct SQueryAttr { int16_t numOfTags; STimeWindow window; + STimeWindow range; SInterval interval; SSessionWindow sw; int16_t precision; @@ -277,6 +282,7 @@ typedef struct SQueryAttr { } SQueryAttr; typedef SSDataBlock* (*__operator_fn_t)(void* param, bool* newgroup); +typedef void (*__operator_notify_fn_t)(void* param, int32_t option); typedef void (*__optr_cleanup_fn_t)(void* param, int32_t num); struct SOperatorInfo; @@ -348,7 +354,7 @@ enum OPERATOR_TYPE_E { OP_Distinct = 20, OP_Join = 21, OP_StateWindow = 22, - OP_AllTimeWindow = 23, + OP_TimeEvery = 23, OP_AllMultiTableTimeInterval = 24, OP_Order = 25, }; @@ -363,10 +369,11 @@ typedef struct SOperatorInfo { SExprInfo *pExpr; SQueryRuntimeEnv *pRuntimeEnv; - struct SOperatorInfo **upstream; // upstream pointer list - int32_t numOfUpstream; // number of upstream. The value is always ONE expect for join operator - __operator_fn_t exec; - __optr_cleanup_fn_t cleanup; + struct SOperatorInfo **upstream; // upstream pointer list + int32_t numOfUpstream; // number of upstream. The value is always ONE expect for join operator + __operator_fn_t exec; + __operator_notify_fn_t notify; + __optr_cleanup_fn_t cleanup; } SOperatorInfo; enum { @@ -479,6 +486,21 @@ typedef struct SProjectOperatorInfo { SSDataBlock *existDataBlock; } SProjectOperatorInfo; +typedef struct STimeEveryOperatorInfo { + SOptrBasicInfo binfo; + int32_t bufCapacity; + uint32_t seed; + + int64_t tableEndKey; + SSDataBlock *lastBlock; + SHashObj *rangeStart; + int32_t lastGroupIdx; + + bool groupDone; + bool allDone; + SSDataBlock *existDataBlock; +} STimeEveryOperatorInfo; + typedef struct SLimitOperatorInfo { int64_t limit; int64_t total; @@ -599,13 +621,12 @@ SOperatorInfo* createAggregateOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOpera SOperatorInfo* createProjectOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream); SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); -SOperatorInfo* createAllTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createSWindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createFillOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput, bool multigroupResult); SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); -SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); +SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createTagScanOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createDistinctOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput); SOperatorInfo* createTableBlockInfoScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv* pRuntimeEnv); diff --git a/src/query/inc/qFill.h b/src/query/inc/qFill.h index caa0c55b3ff1a805975a6258ca360e5099f4894e..2bf0ca8b556468b18ca0a71071c747f20441a93f 100644 --- a/src/query/inc/qFill.h +++ b/src/query/inc/qFill.h @@ -86,7 +86,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo); int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows); -int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType); +int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType, bool *exceedMax, bool *exceedMin); int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, void** output, int32_t capacity); diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index 0ddaabc5fb9bf6eb2c3a16eeedb3b6d952a1f666..da3df98ca337625916471f331858301a28748d0a 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -85,6 +85,11 @@ typedef struct SIntervalVal { SStrToken offset; } SIntervalVal; +typedef struct SRangeVal { + void *start; + void *end; +} SRangeVal; + typedef struct SSessionWindowVal { SStrToken col; SStrToken gap; @@ -111,6 +116,7 @@ typedef struct SSqlNode { SLimitVal slimit; // group limit offset [optional] SStrToken sqlstr; // sql string in select clause struct tSqlExpr *pHaving; // having clause [optional] + SRangeVal pRange; // range clause [optional] } SSqlNode; typedef struct SRelElementPair { @@ -272,6 +278,7 @@ typedef struct tSqlExprItem { bool distinct; } tSqlExprItem; + SArray *tVariantListAppend(SArray *pList, tVariant *pVar, uint8_t sortOrder); SArray *tVariantListInsert(SArray *pList, tVariant *pVar, uint8_t sortOrder, int32_t index); SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t sortOrder); @@ -281,6 +288,7 @@ void *destroyRelationInfo(SRelationInfo* pFromInfo); SRelationInfo *addSubqueryElem(SRelationInfo* pRelationInfo, SArray* pSub, SStrToken* pAlias); // sql expr leaf node +tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType); tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optrType); tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType); SArray *tStrTokenAppend(SArray *pList, SStrToken *pToken); @@ -296,7 +304,7 @@ void tSqlExprListDestroy(SArray *pList); SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelationInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *ps, SWindowStateVal *pw, - SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit, tSqlExpr *pHaving); + SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, SLimitVal *pgLimit, tSqlExpr *pHaving, SRangeVal *pRange); int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right); SCreateTableSql *tSetCreateTableInfo(SArray *pCols, SArray *pTags, SSqlNode *pSelect, int32_t type); diff --git a/src/query/inc/qTableMeta.h b/src/query/inc/qTableMeta.h index c1c16267da734ac40cf27276216896e384e294f3..422fdd13a6a6b17d63c35880eab27cad5272621a 100644 --- a/src/query/inc/qTableMeta.h +++ b/src/query/inc/qTableMeta.h @@ -144,6 +144,8 @@ typedef struct SQueryInfo { bool udfCopy; SArray *pUdfInfo; + STimeWindow range; // range for interp + struct SQInfo *pQInfo; // global merge operator struct SQueryAttr *pQueryAttr; // query object diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 2558c66f8153ded685208cfaae0458d2fe88fef2..fedf8fead0dd31fc0d71e2b3b1674af92a30f077 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -476,8 +476,8 @@ tagitem(A) ::= PLUS(X) FLOAT(Y). { //////////////////////// The SELECT statement ///////////////////////////////// %type select {SSqlNode*} %destructor select {destroySqlNode($$);} -select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_option(K) sliding_opt(S) session_option(H) windowstate_option(D) fill_opt(F)groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). { - A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N); +select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) range_option(R) interval_option(K) sliding_opt(S) session_option(H) windowstate_option(D) fill_opt(F)groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). { + A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N, &R); } select(A) ::= LP select(B) RP. {A = B;} @@ -495,7 +495,7 @@ cmd ::= union(X). { setSqlInfo(pInfo, X, NULL, TSDB_SQL_SELECT); } // select client_version() // select server_state() select(A) ::= SELECT(T) selcollist(W). { - A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + A = tSetQuerySqlNode(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } // selcollist is a list of expressions that are to become the return @@ -566,6 +566,22 @@ tablelist(A) ::= tablelist(Y) COMMA ids(X) cpxName(Z) ids(F). { %type tmvar {SStrToken} tmvar(A) ::= VARIABLE(X). {A = X;} + +%type timestamp {tSqlExpr*} +%destructor timestamp {tSqlExprDestroy($$);} + +timestamp(A) ::= INTEGER(X). { A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= MINUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= PLUS(X) INTEGER(Y). { X.n += Y.n; X.type = TK_INTEGER; A = tSqlExprCreateTimestamp(&X, TK_INTEGER);} +timestamp(A) ::= STRING(X). { A = tSqlExprCreateTimestamp(&X, TK_STRING);} +timestamp(A) ::= NOW(X). { A = tSqlExprCreateTimestamp(&X, TK_NOW); } +timestamp(A) ::= NOW PLUS VARIABLE(Y). {A = tSqlExprCreateTimestamp(&Y, TK_PLUS); } +timestamp(A) ::= NOW MINUS VARIABLE(Y). {A = tSqlExprCreateTimestamp(&Y, TK_MINUS); } + +%type range_option {SRangeVal} +range_option(N) ::= . {N.start = 0; N.end = 0;} +range_option(N) ::= RANGE LP timestamp(E) COMMA timestamp(X) RP. {N.start = E; N.end = X;} + %type interval_option {SIntervalVal} interval_option(N) ::= intervalKey(A) LP tmvar(E) RP. {N.interval = E; N.offset.n = 0; N.token = A;} interval_option(N) ::= intervalKey(A) LP tmvar(E) COMMA tmvar(X) RP. {N.interval = E; N.offset = X; N.token = A;} diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index d84a96b27e76fea2eb708cae6b3b79763e02a6c1..3bac631c5466a7d3a1823e6e26882105d983ccc5 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -28,6 +28,7 @@ #include "qTsbuf.h" #include "queryLog.h" #include "qUdf.h" +#include "tcompare.h" #define GET_INPUT_DATA_LIST(x) ((char *)((x)->pInput)) #define GET_INPUT_DATA(x, y) (GET_INPUT_DATA_LIST(x) + (y) * (x)->inputBytes) @@ -2972,6 +2973,17 @@ static void copy_function(SQLFunctionCtx *pCtx) { assignVal(pCtx->pOutput, pData, pCtx->inputBytes, pCtx->inputType); } +static void full_copy_function(SQLFunctionCtx *pCtx) { + copy_function(pCtx); + + for (int t = 0; t < pCtx->tagInfo.numOfTagCols; ++t) { + SQLFunctionCtx* tagCtx = pCtx->tagInfo.pTagCtxList[t]; + if (tagCtx->functionId == TSDB_FUNC_TAG_DUMMY) { + aAggs[TSDB_FUNC_TAG].xFunction(tagCtx); + } + } +} + enum { INITIAL_VALUE_NOT_ASSIGNED = 0, }; @@ -3895,183 +3907,97 @@ void twa_function_finalizer(SQLFunctionCtx *pCtx) { doFinalizer(pCtx); } -/** - * - * @param pCtx - */ +static void interp_function(SQLFunctionCtx *pCtx) { + int32_t fillType = (int32_t) pCtx->param[2].i64; + //bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); -static void interp_function_impl(SQLFunctionCtx *pCtx) { - int32_t type = (int32_t) pCtx->param[2].i64; - if (type == TSDB_FILL_NONE) { - return; + if (pCtx->start.key == pCtx->startTs) { + assert(pCtx->start.key != INT64_MIN); + + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->start.val); + + goto interp_success_exit; + } else if (pCtx->end.key == pCtx->startTs && pCtx->end.key != INT64_MIN && fillType == TSDB_FILL_NEXT) { + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->end.val); + + goto interp_success_exit; } - bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); + switch (fillType) { + case TSDB_FILL_NULL: + setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); + break; + + case TSDB_FILL_SET_VALUE: + tVariantDump(&pCtx->param[1], pCtx->pOutput, pCtx->inputType, true); + break; + + case TSDB_FILL_LINEAR: + if (pCtx->start.key == INT64_MIN || pCtx->start.key > pCtx->startTs + || pCtx->end.key == INT64_MIN || pCtx->end.key < pCtx->startTs) { + goto interp_exit; + } - if (pCtx->colId == 0 && pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP) { - *(TSKEY *)pCtx->pOutput = pCtx->startTs; - } else if (type == TSDB_FILL_NULL) { - setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); - } else if (type == TSDB_FILL_SET_VALUE) { - tVariantDump(&pCtx->param[1], pCtx->pOutput, pCtx->inputType, true); - } else { - if (pCtx->start.key != INT64_MIN && ((ascQuery && pCtx->start.key <= pCtx->startTs && pCtx->end.key >= pCtx->startTs) || ((!ascQuery) && pCtx->start.key >= pCtx->startTs && pCtx->end.key <= pCtx->startTs))) { - if (type == TSDB_FILL_PREV) { - if (IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, pCtx->start.val); - } else { - assignVal(pCtx->pOutput, pCtx->start.ptr, pCtx->outputBytes, pCtx->inputType); - } - } else if (type == TSDB_FILL_NEXT) { - if (IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, pCtx->end.val); - } else { - assignVal(pCtx->pOutput, pCtx->end.ptr, pCtx->outputBytes, pCtx->inputType); - } - } else if (type == TSDB_FILL_LINEAR) { - SPoint point1 = {.key = pCtx->start.key, .val = &pCtx->start.val}; - SPoint point2 = {.key = pCtx->end.key, .val = &pCtx->end.val}; - SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; - - int32_t srcType = pCtx->inputType; - if (IS_NUMERIC_TYPE(srcType)) { // TODO should find the not null data? - if (isNull((char *)&pCtx->start.val, srcType) || isNull((char *)&pCtx->end.val, srcType)) { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); + double v1 = -1, v2 = -1; + GET_TYPED_DATA(v1, double, pCtx->inputType, &pCtx->start.val); + GET_TYPED_DATA(v2, double, pCtx->inputType, &pCtx->end.val); + + SPoint point1 = {.key = pCtx->start.key, .val = &v1}; + SPoint point2 = {.key = pCtx->end.key, .val = &v2}; + SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; + + int32_t srcType = pCtx->inputType; + if (isNull((char *)&pCtx->start.val, srcType) || isNull((char *)&pCtx->end.val, srcType)) { + setNull(pCtx->pOutput, srcType, pCtx->inputBytes); + } else { + bool exceedMax = false, exceedMin = false; + taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, TSDB_DATA_TYPE_DOUBLE, &exceedMax, &exceedMin); + if (exceedMax || exceedMin) { + __compar_fn_t func = getComparFunc((int32_t)pCtx->inputType, 0); + if (func(&pCtx->start.val, &pCtx->end.val) <= 0) { + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->start.val : &pCtx->end.val); } else { - taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, TSDB_DATA_TYPE_DOUBLE); + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, exceedMax ? &pCtx->end.val : &pCtx->start.val); } - } else { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); } } - } else { - if (GET_RES_INFO(pCtx)->numOfRes > 0) { - return; + break; + + case TSDB_FILL_PREV: + if (pCtx->start.key == INT64_MIN || pCtx->start.key > pCtx->startTs) { + goto interp_exit; } - - // no data generated yet - if (pCtx->size < 1) { - return; + + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->start.val); + break; + + case TSDB_FILL_NEXT: + if (pCtx->end.key == INT64_MIN || pCtx->end.key < pCtx->startTs) { + goto interp_exit; } + + COPY_TYPED_DATA(pCtx->pOutput, pCtx->inputType, &pCtx->end.val); + break; - // check the timestamp in input buffer - TSKEY skey = GET_TS_DATA(pCtx, 0); + case TSDB_FILL_NONE: + default: + goto interp_exit; + } - if (type == TSDB_FILL_PREV) { - if ((ascQuery && skey > pCtx->startTs) || ((!ascQuery) && skey < pCtx->startTs)) { - return; - } - if (pCtx->size > 1) { - TSKEY ekey = GET_TS_DATA(pCtx, 1); - if ((ascQuery && ekey > skey && ekey <= pCtx->startTs) || - ((!ascQuery) && ekey < skey && ekey >= pCtx->startTs)){ - skey = ekey; - } - } - assignVal(pCtx->pOutput, pCtx->pInput, pCtx->outputBytes, pCtx->inputType); - } else if (type == TSDB_FILL_NEXT) { - TSKEY ekey = skey; - char* val = NULL; - - if ((ascQuery && ekey < pCtx->startTs) || ((!ascQuery) && ekey > pCtx->startTs)) { - if (pCtx->size > 1) { - ekey = GET_TS_DATA(pCtx, 1); - if ((ascQuery && ekey < pCtx->startTs) || ((!ascQuery) && ekey > pCtx->startTs)) { - setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); - SET_VAL(pCtx, 1, 1); - return; - } +interp_success_exit: - val = ((char*)pCtx->pInput) + pCtx->inputBytes; - } else { - setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); - SET_VAL(pCtx, 1, 1); - return; - } - } else { - val = (char*)pCtx->pInput; - } - - assignVal(pCtx->pOutput, val, pCtx->outputBytes, pCtx->inputType); - } else if (type == TSDB_FILL_LINEAR) { - if (pCtx->size <= 1) { - return; - } - - TSKEY ekey = GET_TS_DATA(pCtx, 1); - - // no data generated yet - if ((ascQuery && !(skey <= pCtx->startTs && ekey >= pCtx->startTs)) - || ((!ascQuery) && !(skey >= pCtx->startTs && ekey <= pCtx->startTs))) { - return; - } - - char *start = GET_INPUT_DATA(pCtx, 0); - char *end = GET_INPUT_DATA(pCtx, 1); + *(TSKEY*)pCtx->ptsOutputBuf = pCtx->startTs; - SPoint point1 = {.key = skey, .val = start}; - SPoint point2 = {.key = ekey, .val = end}; - SPoint point = {.key = pCtx->startTs, .val = pCtx->pOutput}; + INC_INIT_VAL(pCtx, 1); - int32_t srcType = pCtx->inputType; - if (IS_NUMERIC_TYPE(srcType)) { // TODO should find the not null data? - if (isNull(start, srcType) || isNull(end, srcType)) { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); - } else { - taosGetLinearInterpolationVal(&point, pCtx->outputType, &point1, &point2, srcType); - } - } else { - setNull(pCtx->pOutput, srcType, pCtx->inputBytes); - } - } - } - } +interp_exit: - SET_VAL(pCtx, 1, 1); -} + pCtx->start.key = INT64_MIN; + pCtx->end.key = INT64_MIN; + pCtx->endTs = pCtx->startTs; -static void interp_function(SQLFunctionCtx *pCtx) { - // at this point, the value is existed, return directly - if (pCtx->size > 0) { - bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); - TSKEY key; - char *pData; - int32_t typedData = 0; - - if (ascQuery) { - key = GET_TS_DATA(pCtx, 0); - pData = GET_INPUT_DATA(pCtx, 0); - } else { - key = pCtx->start.key; - if (key == INT64_MIN) { - key = GET_TS_DATA(pCtx, 0); - pData = GET_INPUT_DATA(pCtx, 0); - } else { - if (!(IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL)) { - pData = pCtx->start.ptr; - } else { - typedData = 1; - pData = (char *)&pCtx->start.val; - } - } - } - - //if (key == pCtx->startTs && (ascQuery || !(IS_NUMERIC_TYPE(pCtx->inputType) || pCtx->inputType == TSDB_DATA_TYPE_BOOL))) { - if (key == pCtx->startTs) { - if (typedData) { - SET_TYPED_DATA(pCtx->pOutput, pCtx->inputType, *(double *)pData); - } else { - assignVal(pCtx->pOutput, pData, pCtx->inputBytes, pCtx->inputType); - } - - SET_VAL(pCtx, 1, 1); - } else { - interp_function_impl(pCtx); - } - } else { //no qualified data rows and interpolation is required - interp_function_impl(pCtx); - } + return; } static bool ts_comp_function_setup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) { @@ -5364,11 +5290,11 @@ SAggFunctionInfo aAggs[] = {{ "interp", TSDB_FUNC_INTERP, TSDB_FUNC_INTERP, - TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_OF | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS , + TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_OF | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_NEED_TS | TSDB_FUNCSTATE_SELECTIVITY, function_setup, interp_function, doFinalizer, - copy_function, + full_copy_function, dataBlockRequired, }, { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index ca07992881c796f2f5b70abf463db3db10b6b42c..fc57c1f0fd7d60e8aee8c9f012090cdea8bcf647 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -484,44 +484,6 @@ static void prepareResultListBuffer(SResultRowInfo* pResultRowInfo, SQueryRuntim pResultRowInfo->capacity = (int32_t)newCapacity; } -static bool chkResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, char *pData, - int16_t bytes, bool masterscan, uint64_t uid) { - bool existed = false; - SET_RES_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, uid); - - SResultRow **p1 = - (SResultRow **)taosHashGet(pRuntimeEnv->pResultRowHashTable, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes)); - - // in case of repeat scan/reverse scan, no new time window added. - if (QUERY_IS_INTERVAL_QUERY(pRuntimeEnv->pQueryAttr)) { - if (!masterscan) { // the *p1 may be NULL in case of sliding+offset exists. - return p1 != NULL; - } - - if (p1 != NULL) { - if (pResultRowInfo->size == 0) { - existed = false; - assert(pResultRowInfo->curPos == -1); - } else if (pResultRowInfo->size == 1) { - existed = (pResultRowInfo->pResult[0] == (*p1)); - } else { // check if current pResultRowInfo contains the existed pResultRow - SET_RES_EXT_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, uid, pResultRowInfo); - int64_t* index = taosHashGet(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_EXT_WINDOW_KEY_LEN(bytes)); - if (index != NULL) { - existed = true; - } else { - existed = false; - } - } - } - - return existed; - } - - return p1 != NULL; -} - - static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResultRowInfo* pResultRowInfo, int64_t tid, char* pData, int16_t bytes, bool masterscan, uint64_t tableGroupId) { bool existed = false; @@ -668,34 +630,6 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t return w; } -// get the correct time window according to the handled timestamp -static STimeWindow getCurrentActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t ts, SQueryAttr *pQueryAttr) { - STimeWindow w = {0}; - - if (pResultRowInfo->curPos == -1) { // the first window, from the previous stored value - getInitialStartTimeWindow(pQueryAttr, ts, &w); - - if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { - w.ekey = taosTimeAdd(w.skey, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision) - 1; - } else { - w.ekey = w.skey + pQueryAttr->interval.interval - 1; - } - } else { - w = getResultRow(pResultRowInfo, pResultRowInfo->curPos)->win; - } - - /* - * query border check, skey should not be bounded by the query time range, since the value skey will - * be used as the time window index value. So we only change ekey of time window accordingly. - */ - if (w.ekey > pQueryAttr->window.ekey && QUERY_IS_ASC_QUERY(pQueryAttr)) { - w.ekey = pQueryAttr->window.ekey; - } - - return w; -} - - // a new buffer page for each table. Needs to opt this design static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf *pResultBuf, int32_t tid, uint32_t size) { @@ -742,13 +676,6 @@ static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf return 0; } -static bool chkWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, STimeWindow *win, - bool masterscan, SResultRow **pResult, int64_t groupId, SQLFunctionCtx* pCtx, - int32_t numOfOutput, int32_t* rowCellInfoOffset) { - assert(win->skey <= win->ekey); - - return chkResultRowFromKey(pRuntimeEnv, pResultRowInfo, (char *)&win->skey, TSDB_KEYSIZE, masterscan, groupId); -} static int32_t setResultOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, int64_t tid, STimeWindow *win, bool masterscan, SResultRow **pResult, int64_t tableGroupId, SQLFunctionCtx* pCtx, @@ -787,15 +714,6 @@ static void setResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { } } -static void unsetResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { - assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); - if (type == RESULT_ROW_START_INTERP) { - pResult->startInterp = false; - } else { - pResult->endInterp = false; - } -} - static bool resultRowInterpolated(SResultRow* pResult, SResultTsInterpType type) { assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); @@ -1095,11 +1013,6 @@ static int32_t getNextQualifiedWindow(SQueryAttr* pQueryAttr, STimeWindow *pNext } } - /* interp query with fill should not skip time window */ - if (pQueryAttr->pointInterpQuery && pQueryAttr->fillType != TSDB_FILL_NONE) { - return startPos; - } - /* * This time window does not cover any data, try next time window, * this case may happen when the time window is too small @@ -1354,24 +1267,18 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, int16_t index = pColIndex->colIndex; SColumnInfoData *pColInfo = taosArrayGet(pDataBlock, index); - assert(pColInfo->info.colId == pColIndex->colId && curTs != windowKey); + assert(pColInfo->info.colId <= TSDB_RES_COL_ID || (pColInfo->info.colId >= 0 && pColInfo->info.colId == pColIndex->colId)); double v1 = 0, v2 = 0, v = 0; - if (prevRowIndex == -1) { - GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pRuntimeEnv->prevRow[index]); - } else { - GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); - } - - GET_TYPED_DATA(v2, double, pColInfo->info.type, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); - if (functionId == TSDB_FUNC_INTERP) { if (type == RESULT_ROW_START_INTERP) { + if (prevRowIndex == -1) { + COPY_DATA(&pCtx[k].start.val, (char *)pRuntimeEnv->prevRow[index]); + } else { + COPY_DATA(&pCtx[k].start.val, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); + } + pCtx[k].start.key = prevTs; - pCtx[k].start.val = v1; - - pCtx[k].end.key = curTs; - pCtx[k].end.val = v2; if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (prevRowIndex == -1) { @@ -1379,16 +1286,38 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, } else { pCtx[k].start.ptr = (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes; } + } + } else { + if (curRowIndex == -1) { + COPY_DATA(&pCtx[k].end.val, pRuntimeEnv->prevRow[index]); + } else { + COPY_DATA(&pCtx[k].end.val, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); + } + + pCtx[k].end.key = curTs; + + if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { pCtx[k].end.ptr = (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes; } } } else if (functionId == TSDB_FUNC_TWA) { + assert(curTs != windowKey); + + if (prevRowIndex == -1) { + GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pRuntimeEnv->prevRow[index]); + } else { + GET_TYPED_DATA(v1, double, pColInfo->info.type, (char *)pColInfo->pData + prevRowIndex * pColInfo->info.bytes); + } + + GET_TYPED_DATA(v2, double, pColInfo->info.type, (char *)pColInfo->pData + curRowIndex * pColInfo->info.bytes); + SPoint point1 = (SPoint){.key = prevTs, .val = &v1}; SPoint point2 = (SPoint){.key = curTs, .val = &v2}; SPoint point = (SPoint){.key = windowKey, .val = &v }; - taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE); + bool exceedMax = false, exceedMin = false; + taosGetLinearInterpolationVal(&point, TSDB_DATA_TYPE_DOUBLE, &point1, &point2, TSDB_DATA_TYPE_DOUBLE, &exceedMax, &exceedMin); if (type == RESULT_ROW_START_INTERP) { pCtx[k].start.key = point.key; @@ -1499,11 +1428,6 @@ static void doWindowBorderInterpolation(SOperatorInfo* pOperatorInfo, SSDataBloc setNotInterpoWindowKey(pCtx, pQueryAttr->numOfOutput, RESULT_ROW_START_INTERP); } - // point interpolation does not require the end key time window interpolation. - if (pQueryAttr->pointInterpQuery) { - return; - } - // interpolation query does not generate the time window end interpolation done = resultRowInterpolated(pResult, RESULT_ROW_END_INTERP); if (!done) { @@ -1629,93 +1553,6 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul } -static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResultRowInfo, SSDataBlock* pSDataBlock, int32_t tableGroupId) { - STableIntervalOperatorInfo* pInfo = (STableIntervalOperatorInfo*) pOperatorInfo->info; - - SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv; - int32_t numOfOutput = pOperatorInfo->numOfOutput; - SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - - int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order); - bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); - - TSKEY* tsCols = NULL; - if (pSDataBlock->pDataBlock != NULL) { - SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, 0); - tsCols = (int64_t*) pColDataInfo->pData; - assert(tsCols[0] == pSDataBlock->info.window.skey && - tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey); - } - - int32_t startPos = ascQuery? 0 : (pSDataBlock->info.rows - 1); - int32_t ostartPos = 0; - TSKEY ts = getStartTsKey(pQueryAttr, &pSDataBlock->info.window, tsCols, pSDataBlock->info.rows); - - STimeWindow win = getCurrentActiveTimeWindow(pResultRowInfo, ts, pQueryAttr); - bool masterScan = IS_MASTER_SCAN(pRuntimeEnv); - - SResultRow* pResult = NULL; - int32_t forwardStep = 0; - int32_t ret = 0; - //STimeWindow preWin = win; - - while (1) { - // null data, failed to allocate more memory buffer - ret = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, - tableGroupId, pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset); - if (ret != TSDB_CODE_SUCCESS) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - TSKEY ekey = reviseWindowEkey(pQueryAttr, &win); - forwardStep = getNumOfRowsInTimeWindow(pRuntimeEnv, &pSDataBlock->info, tsCols, startPos, ekey, binarySearchForKey, true); - - // window start(end) key interpolation - unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); - ostartPos = startPos; - - if (!ascQuery) { - startPos += forwardStep * step; - } - - doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->pCtx, pResult, &win, startPos, forwardStep); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, ostartPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - - int32_t prevEndPos = (!ascQuery) ? startPos - step : (forwardStep - 1) * step + startPos; - startPos = getNextQualifiedWindow(pQueryAttr, &win, &pSDataBlock->info, tsCols, binarySearchForKey, prevEndPos); - if (startPos < 0) { - if ((ascQuery && win.skey <= pQueryAttr->window.ekey) || ((!ascQuery) && win.ekey >= pQueryAttr->window.ekey)) { - int32_t code = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, - pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset); - if (code != TSDB_CODE_SUCCESS || pResult == NULL) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - if (ascQuery) { - startPos = pSDataBlock->info.rows - 1; - } else { - startPos = 0; - } - - forwardStep = 1; - unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); - setNotInterpoWindowKey(pInfo->pCtx, pQueryAttr->numOfOutput, RESULT_ROW_START_INTERP); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - } - - break; - } - setResultRowInterpo(pResult, RESULT_ROW_END_INTERP); - } - - if (pQueryAttr->timeWindowInterpo) { - int32_t rowIndex = ascQuery? (pSDataBlock->info.rows-1):0; - saveDataBlockLastRow(pRuntimeEnv, &pSDataBlock->info, pSDataBlock->pDataBlock, rowIndex); - } - - updateResultRowInfoActiveIndex(pResultRowInfo, pQueryAttr, pRuntimeEnv->current->lastKey); -} - static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pInfo, SSDataBlock *pSDataBlock) { @@ -2078,6 +1915,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr pCtx->interBufBytes = pSqlExpr->interBytes; pCtx->start.key = INT64_MIN; pCtx->end.key = INT64_MIN; + pCtx->startTs = INT64_MIN; pCtx->numOfParams = pSqlExpr->numOfParams; for (int32_t j = 0; j < pCtx->numOfParams; ++j) { @@ -2215,12 +2053,6 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); break; } - case OP_AllMultiTableTimeInterval: { - pRuntimeEnv->proot = - createAllMultiTableTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); - setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); - break; - } case OP_TimeWindow: { pRuntimeEnv->proot = createTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); @@ -2230,9 +2062,9 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf } break; } - case OP_AllTimeWindow: { + case OP_TimeEvery: { pRuntimeEnv->proot = - createAllTimeIntervalOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); + createTimeEveryOperatorInfo(pRuntimeEnv, pRuntimeEnv->proot, pQueryAttr->pExpr1, pQueryAttr->numOfOutput); int32_t opType = pRuntimeEnv->proot->upstream[0]->operatorType; if (opType != OP_DummyInput && opType != OP_Join) { setTableScanFilterOperatorInfo(pRuntimeEnv->proot->upstream[0]->info, pRuntimeEnv->proot); @@ -2724,12 +2556,23 @@ static void updateDataCheckOrder(SQInfo *pQInfo, SQueryTableMsg* pQueryMsg, bool if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); + doUpdateLastKey(pQueryAttr); } pQueryAttr->order.order = TSDB_ORDER_ASC; return; } + if (pQueryAttr->pointInterpQuery && pQueryAttr->interval.interval > 0 && (!QUERY_IS_ASC_QUERY(pQueryAttr)) && pQueryAttr->range.skey == INT64_MIN) { + qDebug(msg, pQInfo->qId, "interp", pQueryAttr->order.order, TSDB_ORDER_ASC, pQueryAttr->window.skey, pQueryAttr->window.ekey, pQueryAttr->window.ekey, pQueryAttr->window.skey); + SWAP(pQueryAttr->window.skey, pQueryAttr->window.ekey, TSKEY); + + pQueryAttr->order.order = TSDB_ORDER_ASC; + doUpdateLastKey(pQueryAttr); + pQueryAttr->needReverseScan = true; + return; + } + if (pQueryAttr->interval.interval == 0) { if (onlyFirstQuery(pQueryAttr)) { if (!QUERY_IS_ASC_QUERY(pQueryAttr)) { @@ -3186,39 +3029,27 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa // check if this data block is required to load if ((*status) != BLK_DATA_ALL_NEEDED) { - bool needFilter = true; - // the pCtx[i] result is belonged to previous time window since the outputBuf has not been set yet, // the filter result may be incorrect. So in case of interval query, we need to set the correct time output buffer - if (QUERY_IS_INTERVAL_QUERY(pQueryAttr)) { + if (QUERY_IS_INTERVAL_QUERY(pQueryAttr) && (!pQueryAttr->pointInterpQuery)) { SResultRow* pResult = NULL; bool masterScan = IS_MASTER_SCAN(pRuntimeEnv); TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey; STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr); - if (pQueryAttr->pointInterpQuery) { - needFilter = chkWindowOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, &win, masterScan, &pResult, groupId, - pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, - pTableScanInfo->rowCellInfoOffset); - } else { - if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId, - pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, - pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) { - longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); - } + if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId, + pTableScanInfo->pCtx, pTableScanInfo->numOfOutput, + pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) { + longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); } - } else if (pQueryAttr->stableQuery && (!pQueryAttr->tsCompQuery) && (!pQueryAttr->diffQuery)) { // stable aggregate, not interval aggregate or normal column aggregate + } else if (pQueryAttr->stableQuery && (!pQueryAttr->tsCompQuery) && (!pQueryAttr->diffQuery) && (!pQueryAttr->pointInterpQuery)) { // stable aggregate, not interval aggregate or normal column aggregate doSetTableGroupOutputBuf(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pTableScanInfo->pCtx, pTableScanInfo->rowCellInfoOffset, pTableScanInfo->numOfOutput, pRuntimeEnv->current->groupIndex); } - if (needFilter) { - (*status) = doFilterByBlockTimeWindow(pTableScanInfo, pBlock); - } else { - (*status) = BLK_DATA_ALL_NEEDED; - } + (*status) = doFilterByBlockTimeWindow(pTableScanInfo, pBlock); } SDataBlockInfo* pBlockInfo = &pBlock->info; @@ -3699,6 +3530,9 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i if (fid == TSDB_FUNC_TOP || fid == TSDB_FUNC_BOTTOM || fid == TSDB_FUNC_DIFF || fid == TSDB_FUNC_DERIVATIVE || fid == TSDB_FUNC_SAMPLE || fid == TSDB_FUNC_MAVG || fid == TSDB_FUNC_CSUM) { if (i > 0) pCtx[i].ptsOutputBuf = pCtx[i-1].pOutput; + } else if (fid == TSDB_FUNC_INTERP) { + assert(pCtx[0].functionId == TSDB_FUNC_TS_DUMMY || pCtx[0].functionId == TSDB_FUNC_TS); + pCtx[i].ptsOutputBuf = pCtx[0].pOutput; } } @@ -3739,12 +3573,15 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf functionId == TSDB_FUNC_CSUM || functionId == TSDB_FUNC_MAVG || functionId == TSDB_FUNC_SAMPLE ) { if (i > 0) pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[i-1].pOutput; + } else if (functionId == TSDB_FUNC_INTERP) { + assert(pBInfo->pCtx[0].functionId == TSDB_FUNC_TS_DUMMY || pBInfo->pCtx[0].functionId == TSDB_FUNC_TS); + pBInfo->pCtx[i].ptsOutputBuf = pBInfo->pCtx[0].pOutput; } } } void copyTsColoum(SSDataBlock* pRes, SQLFunctionCtx* pCtx, int32_t numOfOutput) { - bool needCopyTs = false; + bool interpQuery = false; int32_t tsNum = 0; char *src = NULL; for (int32_t i = 0; i < numOfOutput; i++) { @@ -3752,18 +3589,21 @@ void copyTsColoum(SSDataBlock* pRes, SQLFunctionCtx* pCtx, int32_t numOfOutput) if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_DERIVATIVE || functionId == TSDB_FUNC_MAVG || functionId == TSDB_FUNC_CSUM || functionId == TSDB_FUNC_SAMPLE) { - needCopyTs = true; if (i > 0 && pCtx[i-1].functionId == TSDB_FUNC_TS_DUMMY){ SColumnInfoData* pColRes = taosArrayGet(pRes->pDataBlock, i - 1); // find ts data src = pColRes->pData; } - }else if(functionId == TSDB_FUNC_TS_DUMMY) { + } else if(functionId == TSDB_FUNC_INTERP) { + assert(pCtx[0].functionId == TSDB_FUNC_TS); + SColumnInfoData* pColRes = taosArrayGet(pRes->pDataBlock, 0); // find ts data + src = pColRes->pData; + interpQuery = true; + } else if(functionId == TSDB_FUNC_TS_DUMMY) { tsNum++; } } - if (!needCopyTs) return; - if (tsNum < 2) return; + if ((interpQuery == false && tsNum < 2) || (interpQuery && tsNum <= 0)) return; if (src == NULL) return; for (int32_t i = 0; i < numOfOutput; i++) { @@ -4817,7 +4657,7 @@ static int32_t setupQueryHandle(void* tsdb, SQueryRuntimeEnv* pRuntimeEnv, int64 STsdbQueryCond cond = createTsdbQueryCond(pQueryAttr, &pQueryAttr->window); if (pQueryAttr->tsCompQuery || pQueryAttr->pointInterpQuery) { - cond.type = BLOCK_LOAD_TABLE_SEQ_ORDER; + cond.type = BLOCK_LOAD_TABLE_SEQ_ORDER; } if (!isSTableQuery @@ -4944,7 +4784,9 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr if (pTsBuf != NULL) { int16_t order = (pQueryAttr->order.order == pRuntimeEnv->pTsBuf->tsOrder) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; + tsBufResetPos(pRuntimeEnv->pTsBuf); tsBufSetTraverseOrder(pRuntimeEnv->pTsBuf, order); + tsBufNextPos(pTsBuf); } int32_t ps = DEFAULT_PAGE_SIZE; @@ -5049,6 +4891,17 @@ static void doCloseAllTimeWindow(SQueryRuntimeEnv* pRuntimeEnv) { } } +static void notifyTableScan(void* param, int32_t option) { + SOperatorInfo *pOperator = (SOperatorInfo*) param; + STableScanInfo *pTableScanInfo = pOperator->info; + + if (option == OPTION_SWITCH_TABLE) { + tsdbSwitchTable(pTableScanInfo->pQueryHandle); + } + + return; +} + static SSDataBlock* doTableScanImpl(void* param, bool* newgroup) { SOperatorInfo *pOperator = (SOperatorInfo*) param; @@ -5308,13 +5161,18 @@ void setTableScanFilterOperatorInfo(STableScanInfo* pTableScanInfo, SOperatorInf pTableScanInfo->pCtx = pAggInfo->binfo.pCtx; pTableScanInfo->pResultRowInfo = &pAggInfo->binfo.resultRowInfo; pTableScanInfo->rowCellInfoOffset = pAggInfo->binfo.rowCellInfoOffset; - } else if (pDownstream->operatorType == OP_TimeWindow || pDownstream->operatorType == OP_AllTimeWindow) { + } else if (pDownstream->operatorType == OP_TimeWindow) { STableIntervalOperatorInfo *pIntervalInfo = pDownstream->info; pTableScanInfo->pCtx = pIntervalInfo->pCtx; pTableScanInfo->pResultRowInfo = &pIntervalInfo->resultRowInfo; pTableScanInfo->rowCellInfoOffset = pIntervalInfo->rowCellInfoOffset; - + } else if (pDownstream->operatorType == OP_TimeEvery) { + STimeEveryOperatorInfo *pEveryInfo = pDownstream->info; + + pTableScanInfo->pCtx = pEveryInfo->binfo.pCtx; + pTableScanInfo->pResultRowInfo = &pEveryInfo->binfo.resultRowInfo; + pTableScanInfo->rowCellInfoOffset = pEveryInfo->binfo.rowCellInfoOffset; } else if (pDownstream->operatorType == OP_Groupby) { SGroupbyOperatorInfo *pGroupbyInfo = pDownstream->info; @@ -5362,6 +5220,10 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime pInfo->current = 0; pInfo->order = pRuntimeEnv->pQueryAttr->order.order; + if (pRuntimeEnv->pQueryAttr->pointInterpQuery) { + pRuntimeEnv->enableGroupData = true; + } + SOperatorInfo* pOptr = calloc(1, sizeof(SOperatorInfo)); pOptr->name = "DataBlocksOptimizedScanOperator"; pOptr->operatorType = OP_DataBlocksOptScan; @@ -5369,6 +5231,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime pOptr->blockingOptr = false; pOptr->info = pInfo; pOptr->exec = doTableScan; + pOptr->notify = notifyTableScan; return pOptr; } @@ -6060,127 +5923,477 @@ static SSDataBlock* doIntervalAgg(void* param, bool* newgroup) { return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes; } -static SSDataBlock* doAllIntervalAgg(void* param, bool* newgroup) { - SOperatorInfo* pOperator = (SOperatorInfo*) param; - if (pOperator->status == OP_EXEC_DONE) { - return NULL; +static void everyApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int32_t numOfOutput) { + for (int32_t k = 0; k < numOfOutput; ++k) { + if (pCtx[k].functionId < 0) { + // load the script and exec + SUdfInfo* pUdfInfo = pRuntimeEnv->pUdfInfo; + doInvokeUdf(pUdfInfo, &pCtx[k], 0, TSDB_UDF_FUNC_NORMAL); + } else { + aAggs[pCtx[k].functionId].xFunction(&pCtx[k]); + } } +} - STableIntervalOperatorInfo* pIntervalInfo = pOperator->info; +static int64_t getEveryStartTs(bool ascQuery, STimeWindow *range, STimeWindow *blockWin, SQueryAttr *pQueryAttr) { + int64_t startTs = range->skey, ekey = 0; + + assert(range->skey != INT64_MIN); - SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; - if (pOperator->status == OP_RES_TO_RETURN) { - toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); + if (ascQuery) { + return startTs; + } - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { - doSetOperatorCompleted(pOperator); - } + if (range->ekey != INT64_MIN) { + ekey = range->ekey; + } else { + ekey = blockWin->ekey; + } - return pIntervalInfo->pRes; + if (pQueryAttr->interval.interval > 0) { + if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { + int64_t lastTs = startTs; + while (startTs < ekey) { + lastTs = startTs; + startTs = taosTimeAdd(startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } + startTs = lastTs; + } else { + startTs = startTs + (ekey - startTs)/pQueryAttr->interval.interval * pQueryAttr->interval.interval; + } } + return startTs; +} + +static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlock, bool *needApply) { + SQueryRuntimeEnv* pRuntimeEnv = pOperatorInfo->pRuntimeEnv; + STimeEveryOperatorInfo* pEveryInfo = (STimeEveryOperatorInfo*)pOperatorInfo->info; SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - int32_t order = pQueryAttr->order.order; - STimeWindow win = pQueryAttr->window; + bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); + int32_t gidx = pRuntimeEnv->current->groupIndex; + SQLFunctionCtx* pCtx = NULL; - SOperatorInfo* upstream = pOperator->upstream[0]; + *needApply = false; + + if (!pQueryAttr->pointInterpQuery) { + goto group_finished_exit; + } - while(1) { - publishOperatorProfEvent(upstream, QUERY_PROF_BEFORE_OPERATOR_EXEC); - SSDataBlock* pBlock = upstream->exec(upstream, newgroup); - publishOperatorProfEvent(upstream, QUERY_PROF_AFTER_OPERATOR_EXEC); + assert(pOperatorInfo->numOfOutput > 1); + + for (int32_t i = 1; i < pOperatorInfo->numOfOutput; ++i) { + assert(pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP + || pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TS_DUMMY + || pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TAG_DUMMY); - if (pBlock == NULL) { + if (pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP) { + pCtx = &pEveryInfo->binfo.pCtx[i]; break; } - - setTagValue(pOperator, pRuntimeEnv->current->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); - - // the pDataBlock are always the same one, no need to call this again - setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - hashAllIntervalAgg(pOperator, &pIntervalInfo->resultRowInfo, pBlock, 0); } - - // restore the value - pQueryAttr->order.order = order; - pQueryAttr->window = win; - - pOperator->status = OP_RES_TO_RETURN; - closeAllResultRows(&pIntervalInfo->resultRowInfo); - setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); - finalizeQueryResult(pOperator, pIntervalInfo->pCtx, &pIntervalInfo->resultRowInfo, pIntervalInfo->rowCellInfoOffset); - - initGroupResInfo(&pRuntimeEnv->groupResInfo, &pIntervalInfo->resultRowInfo); - toSSDataBlock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes); - - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + + TSKEY* tsCols = NULL; + if (pBlock && pBlock->pDataBlock != NULL) { + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0); + tsCols = (int64_t*) pColDataInfo->pData; + assert(tsCols[0] == pBlock->info.window.skey && tsCols[pBlock->info.rows - 1] == pBlock->info.window.ekey); } - return pIntervalInfo->pRes->info.rows == 0? NULL:pIntervalInfo->pRes; -} + if (pCtx->startTs == INT64_MIN) { + if (pQueryAttr->range.skey == INT64_MIN) { + if (NULL == tsCols) { + goto group_finished_exit; + } -static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) { + if (ascQuery) { + if (pQueryAttr->needReverseScan) { + assert(pEveryInfo->rangeStart); + taosHashPut(pEveryInfo->rangeStart, &pBlock->info.tid, sizeof(pBlock->info.tid), tsCols, sizeof(*tsCols)); + goto group_finished_exit; + } else { + pCtx->startTs = tsCols[0]; + } + } else { + assert(pEveryInfo->rangeStart); + TSKEY * rstart = taosHashGet(pEveryInfo->rangeStart, &pBlock->info.tid, sizeof(pBlock->info.tid)); + if (rstart) { + pQueryAttr->range.skey = *rstart; + + pCtx->startTs = getEveryStartTs(ascQuery, &pQueryAttr->range, &pBlock->info.window, pQueryAttr); + } else { + goto group_finished_exit; + } + } + } else { + pCtx->startTs = getEveryStartTs(ascQuery, &pQueryAttr->range, &pBlock->info.window, pQueryAttr); + } + + pCtx->endTs = INT64_MIN; + } else if (pCtx->endTs == pCtx->startTs) { + if (pQueryAttr->interval.interval > 0) { + if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') { + if (ascQuery) { + pCtx->startTs = taosTimeAdd(pCtx->startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } else { + pCtx->startTs = taosTimeSub(pCtx->startTs, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision); + } + } else { + pCtx->startTs = ascQuery ? pCtx->startTs + pQueryAttr->interval.interval : pCtx->startTs - pQueryAttr->interval.interval; + } + + if (ascQuery && pQueryAttr->range.ekey != INT64_MIN && pCtx->startTs > pQueryAttr->range.ekey) { + goto group_finished_exit; + } + + if ((!ascQuery) && pQueryAttr->range.skey != INT64_MIN && pCtx->startTs < pQueryAttr->range.skey) { + goto group_finished_exit; + } + } else { + goto group_finished_exit; + } + + pCtx->endTs = INT64_MIN; + } + + if (tsCols == NULL && ((ascQuery && pCtx->startTs > pEveryInfo->tableEndKey) || ((!ascQuery) && pCtx->startTs < pEveryInfo->tableEndKey))) { + if ((ascQuery && pQueryAttr->range.ekey == INT64_MIN) || ((!ascQuery) && pQueryAttr->range.skey == INT64_MIN)) { + goto group_finished_exit; + } + + if (pQueryAttr->fillType == TSDB_FILL_NONE || pQueryAttr->fillType == TSDB_FILL_LINEAR + || ((ascQuery && pQueryAttr->fillType == TSDB_FILL_NEXT) || ((!ascQuery) && pQueryAttr->fillType == TSDB_FILL_PREV))) { + goto group_finished_exit; + } + + if (ascQuery && pQueryAttr->fillType == TSDB_FILL_PREV) { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pEveryInfo->binfo.pRes->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + goto group_finished_exit; + } + } else if ((!ascQuery) && pQueryAttr->fillType == TSDB_FILL_NEXT) { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pEveryInfo->binfo.pRes->pDataBlock, INT64_MIN, 0, lastTs, -1, 0, RESULT_ROW_END_INTERP); + } else { + goto group_finished_exit; + } + } + + *needApply = true; + + for (int32_t i = 0; i < pOperatorInfo->numOfOutput; ++i) { + pEveryInfo->binfo.pCtx[i].startTs = pCtx->startTs; + } + + return false; + } + + + int32_t startPos = binarySearchForKey((char *)tsCols, pBlock->info.rows, pCtx->startTs, pQueryAttr->order.order); + + if (ascQuery && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) { + if (startPos < 0) { + saveDataBlockLastRow(pRuntimeEnv, &pBlock->info, pBlock->pDataBlock, pBlock->info.rows - 1); + return true; + } else if (startPos == 0) { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, pCtx->startTs, startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } + } + } else { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, pCtx->startTs, startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } else { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, tsCols[startPos - 1], startPos - 1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + } + } + + if (pQueryAttr->fillType != TSDB_FILL_LINEAR) { + *needApply = true; + } + } + + if ((!ascQuery) && (pQueryAttr->fillType == TSDB_FILL_LINEAR || pQueryAttr->fillType == TSDB_FILL_NEXT) && pCtx->end.key == INT64_MIN) { + if (startPos < 0) { + saveDataBlockLastRow(pRuntimeEnv, &pBlock->info, pBlock->pDataBlock, 0); + return true; + } else if (startPos == (pBlock->info.rows - 1)) { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, pCtx->startTs, startPos, 0, RESULT_ROW_END_INTERP); + } else { + TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; + if (lastTs != INT64_MIN) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, lastTs, -1, 0, RESULT_ROW_END_INTERP); + } + } + } else { + if (tsCols[startPos] == pCtx->startTs) { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, pCtx->startTs, startPos, 0, RESULT_ROW_END_INTERP); + } else { + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, tsCols[startPos + 1], startPos + 1, 0, RESULT_ROW_END_INTERP); + } + } + + if (pQueryAttr->fillType != TSDB_FILL_LINEAR) { + *needApply = true; + } + } + + if (ascQuery && (pQueryAttr->fillType == TSDB_FILL_LINEAR || pQueryAttr->fillType == TSDB_FILL_NEXT) && pCtx->end.key == INT64_MIN) { + if (startPos < 0) { + return true; + } + + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, INT64_MIN, 0, tsCols[startPos], startPos, 0, RESULT_ROW_END_INTERP); + + *needApply = true; + } + + if ((!ascQuery) && pQueryAttr->fillType != TSDB_FILL_NEXT && pCtx->start.key == INT64_MIN) { + if (startPos < 0) { + return true; + } + + doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, tsCols[startPos], startPos, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP); + + *needApply = true; + } + + if (*needApply) { + for (int32_t i = 0; i < pOperatorInfo->numOfOutput; ++i) { + pEveryInfo->binfo.pCtx[i].startTs = pCtx->startTs; + } + } + + return false; + +group_finished_exit: + + qDebug("group idx[%d] interp finished", gidx); + + if (pQueryAttr->needReverseScan) { + pQueryAttr->range.skey = INT64_MIN; + } + + pEveryInfo->groupDone = true; + + if (pCtx) { + pCtx->startTs = INT64_MIN; + pCtx->start.key = INT64_MIN; + pCtx->end.key = INT64_MIN; + } + + return true; +} + + + +static void doTimeEveryImpl(SOperatorInfo* pOperator, SQLFunctionCtx *pCtx, SSDataBlock* pBlock, bool newgroup) { + STimeEveryOperatorInfo* pEveryInfo = (STimeEveryOperatorInfo*) pOperator->info; + SQueryRuntimeEnv *pRuntimeEnv = pOperator->pRuntimeEnv; + int32_t numOfOutput = pOperator->numOfOutput; + SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; + bool finished = false, needApply = false; + bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); + SSDataBlock* pRes = pEveryInfo->binfo.pRes; + TSKEY* tsCols = NULL; + + if (pBlock && pBlock->pDataBlock != NULL) { + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, 0); + if (pColDataInfo->info.type != TSDB_DATA_TYPE_TIMESTAMP) { + qError("no ts input for interp, error quit"); + pEveryInfo->allDone = true; + pEveryInfo->groupDone = true; + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + return; + } + + tsCols = (int64_t*) pColDataInfo->pData; + assert(tsCols[0] == pBlock->info.window.skey && + tsCols[pBlock->info.rows - 1] == pBlock->info.window.ekey); + + pEveryInfo->tableEndKey = tsCols[ascQuery ? pBlock->info.rows - 1 : 0]; + } + + while (!finished) { + needApply = false; + finished = doEveryInterpolation(pOperator, pBlock, &needApply); + + if (needApply) { + everyApplyFunctions(pRuntimeEnv, pEveryInfo->binfo.pCtx, numOfOutput); + + pRes->info.rows = getNumOfResult(pRuntimeEnv, pEveryInfo->binfo.pCtx, pOperator->numOfOutput); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + pEveryInfo->lastBlock = pBlock; + break; + } + + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + } + } +} + + + +static SSDataBlock* doTimeEvery(void* param, bool* newgroup) { SOperatorInfo* pOperator = (SOperatorInfo*) param; - if (pOperator->status == OP_EXEC_DONE) { + + STimeEveryOperatorInfo* pEveryInfo = pOperator->info; + SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; + SOptrBasicInfo *pInfo = &pEveryInfo->binfo; + + SSDataBlock* pRes = pInfo->pRes; + int32_t order = pRuntimeEnv->pQueryAttr->order.order; + + pRes->info.rows = 0; + + if (!pEveryInfo->groupDone) { + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, pEveryInfo->lastBlock, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pInfo->pRes; + } + + if (pRes->info.rows > 0) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pInfo->pRes; + } + } + + if (pEveryInfo->allDone) { + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); return NULL; } - STableIntervalOperatorInfo* pIntervalInfo = pOperator->info; - SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; - if (pOperator->status == OP_RES_TO_RETURN) { - int64_t st = taosGetTimestampUs(); + if (pEveryInfo->existDataBlock) { // TODO refactor + STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current; - copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - doSetOperatorCompleted(pOperator); + SSDataBlock* pBlock = pEveryInfo->existDataBlock; + pEveryInfo->existDataBlock = NULL; + *newgroup = true; + pEveryInfo->groupDone = false; + + // todo dynamic set tags + if (pTableQueryInfo != NULL) { + setTagValue(pOperator, pTableQueryInfo->pTable, pInfo->pCtx, pOperator->numOfOutput); } - SQInfo* pQInfo = pRuntimeEnv->qinfo; - pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); + // the pDataBlock are always the same one, no need to call this again + setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order); + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows); - return pIntervalInfo->pRes; - } + doTimeEveryImpl(pOperator, pInfo->pCtx, pBlock, *newgroup); + if (pEveryInfo->groupDone && pOperator->upstream[0]->notify) { + pOperator->upstream[0]->notify(pOperator->upstream[0], OPTION_SWITCH_TABLE); + } - SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - int32_t order = pQueryAttr->order.order; + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return pRes; + } + } - SOperatorInfo* upstream = pOperator->upstream[0]; + while(!pEveryInfo->allDone) { + bool prevVal = *newgroup; - while(1) { - publishOperatorProfEvent(upstream, QUERY_PROF_BEFORE_OPERATOR_EXEC); - SSDataBlock* pBlock = upstream->exec(upstream, newgroup); - publishOperatorProfEvent(upstream, QUERY_PROF_AFTER_OPERATOR_EXEC); + // The upstream exec may change the value of the newgroup, so use a local variable instead. + publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_BEFORE_OPERATOR_EXEC); + SSDataBlock* pBlock = pOperator->upstream[0]->exec(pOperator->upstream[0], newgroup); + publishOperatorProfEvent(pOperator->upstream[0], QUERY_PROF_AFTER_OPERATOR_EXEC); if (pBlock == NULL) { + if (!pEveryInfo->groupDone) { + pEveryInfo->allDone = true; + + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + break; + } + + assert(pEveryInfo->groupDone); + + if (pRes->info.rows > 0) { + break; + } + } + + *newgroup = prevVal; + setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); break; } - // the pDataBlock are always the same one, no need to call this again + // Return result of the previous group in the firstly. + if (*newgroup) { + if (!pEveryInfo->groupDone) { + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0); + doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false); + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + pEveryInfo->existDataBlock = pBlock; + break; + } + + assert(pEveryInfo->groupDone); + } + + if (pRes->info.rows > 0) { + pEveryInfo->existDataBlock = pBlock; + break; + } else { // init output buffer for a new group data + for (int32_t j = 0; j < pOperator->numOfOutput; ++j) { + aAggs[pInfo->pCtx[j].functionId].xFinalize(&pInfo->pCtx[j]); + } + initCtxOutputBuffer(pInfo->pCtx, pOperator->numOfOutput); + pEveryInfo->groupDone = false; + } + } + STableQueryInfo* pTableQueryInfo = pRuntimeEnv->current; - setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); - setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - setIntervalQueryRange(pRuntimeEnv, &pBlock->info.window, pBlock->info.tid); + if (pEveryInfo->groupDone && pTableQueryInfo->groupIndex == pEveryInfo->lastGroupIdx) { + assert(pOperator->upstream[0]->notify == NULL); + continue; + } - hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); - } + // todo dynamic set tags + if (pTableQueryInfo != NULL) { + setTagValue(pOperator, pTableQueryInfo->pTable, pInfo->pCtx, pOperator->numOfOutput); + } - pOperator->status = OP_RES_TO_RETURN; - pQueryAttr->order.order = order; // TODO : restore the order - doCloseAllTimeWindow(pRuntimeEnv); - setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); + // the pDataBlock are always the same one, no need to call this again + setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order); + updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows); - copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); - if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + pEveryInfo->groupDone = false; + + doTimeEveryImpl(pOperator, pInfo->pCtx, pBlock, *newgroup); + if (pEveryInfo->groupDone && pOperator->upstream[0]->notify) { + pOperator->upstream[0]->notify(pOperator->upstream[0], OPTION_SWITCH_TABLE); + } + + if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) { + break; + } } - return pIntervalInfo->pRes; + copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput); + clearNumOfRes(pInfo->pCtx, pOperator->numOfOutput); + return (pInfo->pRes->info.rows > 0)? pInfo->pRes:NULL; } -static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { +static SSDataBlock* doSTableIntervalAgg(void* param, bool* newgroup) { SOperatorInfo* pOperator = (SOperatorInfo*) param; if (pOperator->status == OP_EXEC_DONE) { return NULL; @@ -6190,11 +6403,16 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; if (pOperator->status == OP_RES_TO_RETURN) { + int64_t st = taosGetTimestampUs(); + copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { - pOperator->status = OP_EXEC_DONE; + doSetOperatorCompleted(pOperator); } + SQInfo* pQInfo = pRuntimeEnv->qinfo; + pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); + return pIntervalInfo->pRes; } @@ -6217,10 +6435,9 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { setTagValue(pOperator, pTableQueryInfo->pTable, pIntervalInfo->pCtx, pOperator->numOfOutput); setInputDataBlock(pOperator, pIntervalInfo->pCtx, pBlock, pQueryAttr->order.order); - setIntervalQueryRange(pRuntimeEnv, &pBlock->info.window, pBlock->info.tid); - hashAllIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); + hashIntervalAgg(pOperator, &pTableQueryInfo->resInfo, pBlock, pTableQueryInfo->groupIndex); } pOperator->status = OP_RES_TO_RETURN; @@ -6228,15 +6445,11 @@ static SSDataBlock* doAllSTableIntervalAgg(void* param, bool* newgroup) { doCloseAllTimeWindow(pRuntimeEnv); setQueryStatus(pRuntimeEnv, QUERY_COMPLETED); - int64_t st = taosGetTimestampUs(); copyToSDataBlock(pRuntimeEnv, 3000, pIntervalInfo->pRes, pIntervalInfo->rowCellInfoOffset); if (pIntervalInfo->pRes->info.rows == 0 || !hasRemainData(&pRuntimeEnv->groupResInfo)) { pOperator->status = OP_EXEC_DONE; } - SQInfo* pQInfo = pRuntimeEnv->qinfo; - pQInfo->summary.firstStageMergeTime += (taosGetTimestampUs() - st); - return pIntervalInfo->pRes; } @@ -6709,6 +6922,13 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) { doDestroyBasicInfo(&pInfo->binfo, numOfOutput); } +static void destroyTimeEveryOperatorInfo(void* param, int32_t numOfOutput) { + STimeEveryOperatorInfo* pInfo = (STimeEveryOperatorInfo*) param; + doDestroyBasicInfo(&pInfo->binfo, numOfOutput); + taosHashCleanup(pInfo->rangeStart); +} + + static void destroyTagScanOperatorInfo(void* param, int32_t numOfOutput) { STagScanInfo* pInfo = (STagScanInfo*) param; pInfo->pRes = destroyOutputBuf(pInfo->pRes); @@ -6885,30 +7105,44 @@ SOperatorInfo* createTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOp } -SOperatorInfo* createAllTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { - STableIntervalOperatorInfo* pInfo = calloc(1, sizeof(STableIntervalOperatorInfo)); +SOperatorInfo* createTimeEveryOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { + STimeEveryOperatorInfo* pInfo = calloc(1, sizeof(STimeEveryOperatorInfo)); + SQueryAttr* pQueryAttr = pRuntimeEnv->pQueryAttr; - pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); + pInfo->seed = rand(); + pInfo->bufCapacity = pRuntimeEnv->resultInfo.capacity; + pInfo->groupDone = true; + pInfo->lastGroupIdx = -1; - SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + SOptrBasicInfo* pBInfo = &pInfo->binfo; + pBInfo->pRes = createOutputBuf(pExpr, numOfOutput, pInfo->bufCapacity); + pBInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pBInfo->rowCellInfoOffset); - pOperator->name = "AllTimeIntervalAggOperator"; - pOperator->operatorType = OP_AllTimeWindow; - pOperator->blockingOptr = true; + if (pQueryAttr->needReverseScan) { + pInfo->rangeStart = taosHashInit(256, taosGetDefaultHashFunction(TSDB_DATA_TYPE_TIMESTAMP), false, false); + } + + initResultRowInfo(&pBInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); + setDefaultOutputBuf(pRuntimeEnv, pBInfo, pInfo->seed, MASTER_SCAN); + + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); + pOperator->name = "TimeEveryOperator"; + pOperator->operatorType = OP_TimeEvery; + pOperator->blockingOptr = false; pOperator->status = OP_IN_EXECUTING; + pOperator->info = pInfo; pOperator->pExpr = pExpr; pOperator->numOfOutput = numOfOutput; - pOperator->info = pInfo; pOperator->pRuntimeEnv = pRuntimeEnv; - pOperator->exec = doAllIntervalAgg; - pOperator->cleanup = destroyBasicOperatorInfo; + pOperator->exec = doTimeEvery; + pOperator->cleanup = destroyTimeEveryOperatorInfo; appendUpstream(pOperator, upstream); + return pOperator; } + SOperatorInfo* createStatewindowOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SStateWindowOperatorInfo* pInfo = calloc(1, sizeof(SStateWindowOperatorInfo)); pInfo->colIndex = -1; @@ -6982,31 +7216,6 @@ SOperatorInfo* createMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRunti return pOperator; } -SOperatorInfo* createAllMultiTableTimeIntervalOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { - STableIntervalOperatorInfo* pInfo = calloc(1, sizeof(STableIntervalOperatorInfo)); - - pInfo->pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->rowCellInfoOffset); - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - initResultRowInfo(&pInfo->resultRowInfo, 8, TSDB_DATA_TYPE_INT); - - SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); - pOperator->name = "AllMultiTableTimeIntervalOperator"; - pOperator->operatorType = OP_AllMultiTableTimeInterval; - pOperator->blockingOptr = true; - pOperator->status = OP_IN_EXECUTING; - pOperator->pExpr = pExpr; - pOperator->numOfOutput = numOfOutput; - pOperator->info = pInfo; - pOperator->pRuntimeEnv = pRuntimeEnv; - - pOperator->exec = doAllSTableIntervalAgg; - pOperator->cleanup = destroyBasicOperatorInfo; - - appendUpstream(pOperator, upstream); - - return pOperator; -} - SOperatorInfo* createGroupbyOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorInfo* upstream, SExprInfo* pExpr, int32_t numOfOutput) { SGroupbyOperatorInfo* pInfo = calloc(1, sizeof(SGroupbyOperatorInfo)); @@ -7592,6 +7801,9 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pQueryMsg->numOfTables = htonl(pQueryMsg->numOfTables); pQueryMsg->window.skey = htobe64(pQueryMsg->window.skey); pQueryMsg->window.ekey = htobe64(pQueryMsg->window.ekey); + pQueryMsg->range.skey = htobe64(pQueryMsg->range.skey); + pQueryMsg->range.ekey = htobe64(pQueryMsg->range.ekey); + pQueryMsg->interval.interval = htobe64(pQueryMsg->interval.interval); pQueryMsg->interval.sliding = htobe64(pQueryMsg->interval.sliding); pQueryMsg->interval.offset = htobe64(pQueryMsg->interval.offset); @@ -8566,6 +8778,7 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SGroupbyExpr* pGroupbyExpr, S pQueryAttr->stateWindow = pQueryMsg->stateWindow; pQueryAttr->vgId = vgId; pQueryAttr->pFilters = pFilters; + pQueryAttr->range = pQueryMsg->range; pQueryAttr->tableCols = calloc(numOfCols, sizeof(SSingleColumnFilterInfo)); if (pQueryAttr->tableCols == NULL) { diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c index 144ca4dd794975a161d85c68e8058e3ca105d9c8..b0015e39b96e0754377abece6e12045b0f36a901 100644 --- a/src/query/src/qFill.c +++ b/src/query/src/qFill.c @@ -118,10 +118,11 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData continue; } + bool exceedMax = false, exceedMin = false; point1 = (SPoint){.key = *(TSKEY*)(prev), .val = prev + pCol->col.offset}; point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->index * bytes}; point = (SPoint){.key = pFillInfo->currentKey, .val = val1}; - taosGetLinearInterpolationVal(&point, type, &point1, &point2, type); + taosGetLinearInterpolationVal(&point, type, &point1, &point2, type, &exceedMax, &exceedMin); } } else { setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index); @@ -493,12 +494,20 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma return (numOfRes > maxNumOfRows) ? maxNumOfRows : numOfRes; } -int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType) { - double v1 = -1, v2 = -1; +int32_t taosGetLinearInterpolationVal(SPoint* point, int32_t outputType, SPoint* point1, SPoint* point2, int32_t inputType, bool *exceedMax, bool *exceedMin) { + double v1 = -1, v2 = -1, vmax = -1, vmin = -1; GET_TYPED_DATA(v1, double, inputType, point1->val); GET_TYPED_DATA(v2, double, inputType, point2->val); - + GET_TYPED_DATA(vmax, double, outputType, getDataMax(outputType)); + GET_TYPED_DATA(vmin, double, outputType, getDataMin(outputType)); + double r = DO_INTERPOLATION(v1, v2, point1->key, point2->key, point->key); + if (r >= vmax) { + *exceedMax = true; + } else if (r <= vmin) { + *exceedMin = true; + } + SET_TYPED_DATA(point->val, outputType, r); return TSDB_CODE_SUCCESS; diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index abfa20714b333754478e5c48b9265f839b05a4b1..27a22f70832dc9669aa473b03820d84d4736b497 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -538,9 +538,9 @@ SArray* createTableScanPlan(SQueryAttr* pQueryAttr) { } else { if (pQueryAttr->queryBlockDist) { op = OP_TableBlockInfoScan; - } else if (pQueryAttr->tsCompQuery || pQueryAttr->pointInterpQuery || pQueryAttr->diffQuery) { + } else if (pQueryAttr->tsCompQuery || pQueryAttr->diffQuery) { op = OP_TableSeqScan; - } else if (pQueryAttr->needReverseScan) { + } else if (pQueryAttr->needReverseScan || pQueryAttr->pointInterpQuery) { op = OP_DataBlocksOptScan; } else { op = OP_TableScan; @@ -564,20 +564,15 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { op = OP_Distinct; taosArrayPush(plan, &op); } + } else if (pQueryAttr->pointInterpQuery) { + op = OP_TimeEvery; + taosArrayPush(plan, &op); } else if (pQueryAttr->interval.interval > 0) { if (pQueryAttr->stableQuery) { - if (pQueryAttr->pointInterpQuery) { - op = OP_AllMultiTableTimeInterval; - } else { - op = OP_MultiTableTimeInterval; - } + op = OP_MultiTableTimeInterval; taosArrayPush(plan, &op); } else { - if (pQueryAttr->pointInterpQuery) { - op = OP_AllTimeWindow; - } else { - op = OP_TimeWindow; - } + op = OP_TimeWindow; taosArrayPush(plan, &op); if (pQueryAttr->pExpr2 != NULL) { @@ -704,7 +699,7 @@ SArray* createGlobalMergePlan(SQueryAttr* pQueryAttr) { } // fill operator - if (pQueryAttr->fillType != TSDB_FILL_NONE && pQueryAttr->interval.interval > 0) { + if (pQueryAttr->fillType != TSDB_FILL_NONE && pQueryAttr->interval.interval > 0 && !pQueryAttr->pointInterpQuery) { op = OP_Fill; taosArrayPush(plan, &op); } diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index 07ff79b16155eba158e2cffc24be7dbe1c3d098f..21723d6b7190d974c6c519521ebe10949e39c9f8 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -192,6 +192,65 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr return pSqlExpr; } + +tSqlExpr *tSqlExprCreateTimestamp(SStrToken *pToken, int32_t optrType) { + tSqlExpr *pSqlExpr = calloc(1, sizeof(tSqlExpr)); + + if (pToken != NULL) { + pSqlExpr->exprToken = *pToken; + } + + if (optrType == TK_INTEGER || optrType == TK_STRING) { + if (pToken) { + toTSDBType(pToken->type); + tVariantCreate(&pSqlExpr->value, pToken); + } + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_VALUE; + } else if (optrType == TK_NOW) { + // use nanosecond by default TODO set value after getting database precision + pSqlExpr->value.i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT; + pSqlExpr->tokenId = TK_TIMESTAMP; // TK_TIMESTAMP used to denote the time value is in microsecond + pSqlExpr->type = SQL_NODE_VALUE; + pSqlExpr->flags |= 1 << EXPR_FLAG_NS_TIMESTAMP; + } else if (optrType == TK_PLUS || optrType == TK_MINUS) { + // use nanosecond by default + // TODO set value after getting database precision + if (pToken) { + char unit = 0; + int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->value.i64, &unit, TSDB_TIME_PRECISION_NANO); + if (ret != TSDB_CODE_SUCCESS) { + terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + } + } + + if (optrType == TK_PLUS) { + pSqlExpr->value.i64 += taosGetTimestamp(TSDB_TIME_PRECISION_NANO); + } else { + pSqlExpr->value.i64 = taosGetTimestamp(TSDB_TIME_PRECISION_NANO) - pSqlExpr->value.i64; + } + + pSqlExpr->flags |= 1 << EXPR_FLAG_NS_TIMESTAMP; + pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT; + pSqlExpr->tokenId = TK_TIMESTAMP; + pSqlExpr->type = SQL_NODE_VALUE; + } else { + // Here it must be the column name (tk_id) if it is not a number or string. + assert(optrType == TK_ID || optrType == TK_ALL); + if (pToken != NULL) { + pSqlExpr->columnName = *pToken; + } + + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_TABLE_COLUMN; + } + + return pSqlExpr; +} + + + /* * pList is the parameters for function with id(optType) * function name is denoted by pFunctionToken @@ -751,7 +810,7 @@ void tSetColumnType(TAOS_FIELD *pField, SStrToken *type) { SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelationInfo *pFrom, tSqlExpr *pWhere, SArray *pGroupby, SArray *pSortOrder, SIntervalVal *pInterval, SSessionWindowVal *pSession, SWindowStateVal *pWindowStateVal, SStrToken *pSliding, SArray *pFill, SLimitVal *pLimit, - SLimitVal *psLimit, tSqlExpr *pHaving) { + SLimitVal *psLimit, tSqlExpr *pHaving, SRangeVal *pRange) { assert(pSelNodeList != NULL); SSqlNode *pSqlNode = calloc(1, sizeof(SSqlNode)); @@ -767,7 +826,10 @@ SSqlNode *tSetQuerySqlNode(SStrToken *pSelectToken, SArray *pSelNodeList, SRelat pSqlNode->pWhere = pWhere; pSqlNode->fillType = pFill; pSqlNode->pHaving = pHaving; - + if (pRange) { + pSqlNode->pRange = *pRange; + } + if (pLimit != NULL) { pSqlNode->limit = *pLimit; } else { diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 4232076fe682fc50ba50eeba937e5e5398ca20c2..eee1880ab92cc938dfd60760ec8e30981d31cf7b 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,6 +23,7 @@ ** input grammar file: */ #include +#include /************ Begin %include sections from the grammar ************************/ #include @@ -76,8 +77,10 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser +** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -97,50 +100,59 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 281 +#define YYNOCODE 282 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SWindowStateVal yy48; - SCreateTableSql* yy102; - tVariant yy106; - int64_t yy109; - SSessionWindowVal yy139; - SCreateDbInfo yy142; - tSqlExpr* yy146; - SRelationInfo* yy164; - int yy172; - SArray* yy221; + tVariant yy2; + SCreateDbInfo yy10; + int32_t yy40; + SSqlNode* yy68; + SCreatedTableInfo yy72; + SLimitVal yy114; + SRangeVal yy144; + SCreateTableSql* yy170; SIntervalVal yy280; - int32_t yy340; - SSqlNode* yy376; - SCreatedTableInfo yy416; - SLimitVal yy454; - SCreateAcctInfo yy491; - TAOS_FIELD yy503; + int yy281; + SSessionWindowVal yy295; + SArray* yy345; + tSqlExpr* yy418; + SCreateAcctInfo yy427; + SWindowStateVal yy432; + SRelationInfo* yy484; + TAOS_FIELD yy487; + int64_t yy525; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo -#define ParseARG_STORE yypParser->pInfo = pInfo +#define ParseARG_PARAM ,pInfo +#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; +#define ParseARG_STORE yypParser->pInfo=pInfo; +#define ParseCTX_SDECL +#define ParseCTX_PDECL +#define ParseCTX_PARAM +#define ParseCTX_FETCH +#define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 368 -#define YYNRULE 294 -#define YYNTOKEN 198 -#define YY_MAX_SHIFT 367 -#define YY_MIN_SHIFTREDUCE 576 -#define YY_MAX_SHIFTREDUCE 869 -#define YY_ERROR_ACTION 870 -#define YY_ACCEPT_ACTION 871 -#define YY_NO_ACTION 872 -#define YY_MIN_REDUCE 873 -#define YY_MAX_REDUCE 1166 +#define YYNSTATE 379 +#define YYNRULE 303 +#define YYNRULE_WITH_ACTION 303 +#define YYNTOKEN 199 +#define YY_MAX_SHIFT 378 +#define YY_MIN_SHIFTREDUCE 594 +#define YY_MAX_SHIFTREDUCE 896 +#define YY_ERROR_ACTION 897 +#define YY_ACCEPT_ACTION 898 +#define YY_NO_ACTION 899 +#define YY_MIN_REDUCE 900 +#define YY_MAX_REDUCE 1202 /************* End control #defines *******************************************/ +#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -205,293 +217,298 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (773) +#define YY_ACTTAB_COUNT (791) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 23, 628, 366, 235, 1051, 208, 241, 712, 211, 629, - /* 10 */ 1029, 871, 367, 59, 60, 173, 63, 64, 1042, 1142, - /* 20 */ 255, 53, 52, 51, 628, 62, 324, 67, 65, 68, - /* 30 */ 66, 157, 629, 286, 238, 58, 57, 344, 343, 56, - /* 40 */ 55, 54, 59, 60, 247, 63, 64, 252, 1029, 255, - /* 50 */ 53, 52, 51, 664, 62, 324, 67, 65, 68, 66, - /* 60 */ 999, 1042, 997, 998, 58, 57, 209, 1000, 56, 55, - /* 70 */ 54, 1001, 1048, 1002, 1003, 58, 57, 277, 1015, 56, - /* 80 */ 55, 54, 59, 60, 215, 63, 64, 38, 82, 255, - /* 90 */ 53, 52, 51, 88, 62, 324, 67, 65, 68, 66, - /* 100 */ 284, 283, 249, 752, 58, 57, 1029, 211, 56, 55, - /* 110 */ 54, 322, 59, 61, 806, 63, 64, 1042, 1143, 255, - /* 120 */ 53, 52, 51, 628, 62, 324, 67, 65, 68, 66, - /* 130 */ 45, 629, 237, 239, 58, 57, 1026, 164, 56, 55, - /* 140 */ 54, 60, 1023, 63, 64, 771, 772, 255, 53, 52, - /* 150 */ 51, 628, 62, 324, 67, 65, 68, 66, 812, 629, - /* 160 */ 815, 216, 58, 57, 322, 100, 56, 55, 54, 577, - /* 170 */ 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, - /* 180 */ 588, 589, 590, 155, 164, 236, 63, 64, 756, 248, - /* 190 */ 255, 53, 52, 51, 269, 62, 324, 67, 65, 68, - /* 200 */ 66, 1017, 354, 273, 272, 58, 57, 251, 217, 56, - /* 210 */ 55, 54, 1089, 44, 320, 361, 360, 319, 318, 317, - /* 220 */ 359, 316, 315, 314, 358, 313, 357, 356, 38, 1137, - /* 230 */ 56, 55, 54, 24, 29, 991, 979, 980, 981, 982, - /* 240 */ 983, 984, 985, 986, 987, 988, 989, 990, 992, 993, - /* 250 */ 214, 14, 254, 821, 1136, 96, 810, 222, 813, 1090, - /* 260 */ 816, 296, 97, 139, 138, 137, 221, 211, 254, 821, - /* 270 */ 329, 88, 810, 256, 813, 1135, 816, 1025, 1143, 819, - /* 280 */ 67, 65, 68, 66, 326, 99, 233, 234, 58, 57, - /* 290 */ 325, 164, 56, 55, 54, 1012, 1013, 35, 1016, 811, - /* 300 */ 231, 814, 233, 234, 258, 5, 41, 182, 45, 365, - /* 310 */ 364, 148, 181, 106, 111, 102, 110, 164, 263, 736, - /* 320 */ 38, 1028, 733, 85, 734, 86, 735, 154, 152, 151, - /* 330 */ 276, 309, 80, 211, 38, 69, 123, 117, 128, 229, - /* 340 */ 362, 960, 232, 127, 1143, 133, 136, 126, 202, 200, - /* 350 */ 198, 69, 260, 261, 130, 197, 143, 142, 141, 140, - /* 360 */ 280, 44, 280, 361, 360, 245, 94, 1100, 359, 1026, - /* 370 */ 822, 817, 358, 38, 357, 356, 38, 818, 38, 246, - /* 380 */ 259, 38, 257, 1026, 332, 331, 822, 817, 825, 38, - /* 390 */ 298, 264, 93, 818, 265, 38, 262, 38, 339, 338, - /* 400 */ 38, 264, 178, 264, 922, 125, 788, 81, 932, 3, - /* 410 */ 193, 192, 179, 749, 1027, 192, 212, 354, 333, 73, - /* 420 */ 820, 334, 1026, 335, 923, 1026, 336, 1026, 1, 180, - /* 430 */ 1026, 192, 76, 95, 340, 1162, 737, 738, 1026, 9, - /* 440 */ 341, 1014, 342, 278, 1026, 346, 1026, 83, 768, 1026, - /* 450 */ 778, 779, 722, 808, 301, 724, 303, 39, 253, 723, - /* 460 */ 34, 74, 159, 787, 70, 26, 39, 844, 39, 70, - /* 470 */ 98, 823, 77, 70, 627, 79, 16, 116, 15, 115, - /* 480 */ 6, 25, 18, 213, 17, 25, 274, 741, 25, 742, - /* 490 */ 739, 809, 740, 304, 20, 122, 19, 121, 22, 218, - /* 500 */ 21, 135, 134, 210, 219, 220, 1154, 711, 156, 1099, - /* 510 */ 1050, 224, 225, 226, 223, 207, 243, 1096, 1095, 244, - /* 520 */ 345, 48, 1061, 1058, 1059, 1063, 1082, 158, 163, 1043, - /* 530 */ 281, 153, 292, 1081, 285, 174, 1024, 175, 1022, 176, - /* 540 */ 177, 937, 306, 307, 308, 311, 312, 46, 767, 165, - /* 550 */ 205, 42, 1040, 323, 931, 330, 1161, 113, 1160, 75, - /* 560 */ 1157, 183, 337, 1153, 240, 119, 78, 287, 289, 1152, - /* 570 */ 299, 50, 166, 1149, 184, 297, 957, 167, 43, 40, - /* 580 */ 47, 206, 919, 293, 129, 917, 131, 295, 132, 915, - /* 590 */ 291, 914, 168, 266, 195, 196, 911, 288, 910, 909, - /* 600 */ 908, 907, 906, 905, 199, 201, 902, 900, 898, 896, - /* 610 */ 203, 893, 204, 889, 49, 310, 279, 84, 89, 290, - /* 620 */ 1083, 355, 348, 124, 347, 349, 350, 230, 351, 250, - /* 630 */ 305, 352, 353, 363, 869, 267, 268, 868, 227, 270, - /* 640 */ 271, 228, 107, 936, 935, 108, 867, 850, 275, 849, - /* 650 */ 913, 280, 300, 912, 10, 87, 282, 744, 144, 187, - /* 660 */ 904, 186, 958, 185, 188, 189, 191, 190, 145, 903, - /* 670 */ 959, 146, 995, 2, 147, 30, 895, 169, 170, 894, - /* 680 */ 171, 172, 4, 33, 1005, 90, 769, 160, 162, 780, - /* 690 */ 161, 242, 774, 91, 31, 776, 92, 294, 11, 32, - /* 700 */ 12, 13, 27, 28, 302, 101, 99, 642, 104, 36, - /* 710 */ 103, 675, 37, 677, 105, 674, 673, 671, 670, 669, - /* 720 */ 666, 632, 321, 109, 7, 327, 328, 824, 8, 112, - /* 730 */ 826, 114, 71, 72, 118, 714, 39, 713, 710, 120, - /* 740 */ 658, 656, 648, 654, 650, 652, 646, 644, 680, 679, - /* 750 */ 678, 676, 672, 668, 667, 194, 630, 594, 873, 872, - /* 760 */ 872, 872, 872, 872, 872, 872, 872, 872, 872, 872, - /* 770 */ 872, 149, 150, + /* 0 */ 245, 646, 377, 238, 1056, 23, 214, 730, 1078, 647, + /* 10 */ 682, 898, 378, 59, 60, 251, 63, 64, 1178, 1056, + /* 20 */ 259, 53, 52, 51, 646, 62, 335, 67, 65, 68, + /* 30 */ 66, 159, 647, 337, 175, 58, 57, 355, 354, 56, + /* 40 */ 55, 54, 59, 60, 253, 63, 64, 1055, 1056, 259, + /* 50 */ 53, 52, 51, 297, 62, 335, 67, 65, 68, 66, + /* 60 */ 1026, 1069, 1024, 1025, 58, 57, 1198, 1027, 56, 55, + /* 70 */ 54, 1028, 256, 1029, 1030, 58, 57, 1075, 281, 56, + /* 80 */ 55, 54, 59, 60, 166, 63, 64, 38, 84, 259, + /* 90 */ 53, 52, 51, 90, 62, 335, 67, 65, 68, 66, + /* 100 */ 1069, 288, 287, 646, 58, 57, 333, 29, 56, 55, + /* 110 */ 54, 647, 59, 61, 833, 63, 64, 241, 1042, 259, + /* 120 */ 53, 52, 51, 646, 62, 335, 67, 65, 68, 66, + /* 130 */ 45, 647, 240, 214, 58, 57, 1053, 852, 56, 55, + /* 140 */ 54, 60, 1050, 63, 64, 1179, 282, 259, 53, 52, + /* 150 */ 51, 166, 62, 335, 67, 65, 68, 66, 38, 309, + /* 160 */ 39, 95, 58, 57, 798, 799, 56, 55, 54, 595, + /* 170 */ 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, + /* 180 */ 606, 607, 608, 157, 1069, 239, 63, 64, 770, 252, + /* 190 */ 259, 53, 52, 51, 255, 62, 335, 67, 65, 68, + /* 200 */ 66, 242, 365, 249, 333, 58, 57, 1053, 211, 56, + /* 210 */ 55, 54, 257, 44, 331, 372, 371, 330, 329, 328, + /* 220 */ 370, 327, 326, 325, 369, 324, 368, 367, 1126, 16, + /* 230 */ 307, 15, 166, 24, 6, 1018, 1006, 1007, 1008, 1009, + /* 240 */ 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, + /* 250 */ 217, 166, 258, 848, 212, 214, 837, 225, 840, 839, + /* 260 */ 843, 842, 99, 141, 140, 139, 224, 1179, 258, 848, + /* 270 */ 340, 90, 837, 774, 840, 273, 843, 56, 55, 54, + /* 280 */ 67, 65, 68, 66, 277, 276, 236, 237, 58, 57, + /* 290 */ 336, 767, 56, 55, 54, 1039, 1040, 35, 1043, 260, + /* 300 */ 373, 987, 236, 237, 5, 41, 185, 268, 45, 1125, + /* 310 */ 38, 184, 108, 113, 104, 112, 754, 9, 181, 751, + /* 320 */ 262, 752, 786, 753, 38, 102, 789, 267, 96, 38, + /* 330 */ 320, 280, 838, 82, 841, 69, 125, 119, 130, 218, + /* 340 */ 232, 949, 118, 129, 117, 135, 138, 128, 195, 264, + /* 350 */ 265, 69, 293, 294, 132, 205, 203, 201, 38, 1052, + /* 360 */ 214, 1044, 200, 145, 144, 143, 142, 127, 38, 250, + /* 370 */ 849, 844, 1179, 1053, 344, 38, 38, 845, 1053, 365, + /* 380 */ 846, 44, 38, 372, 371, 83, 849, 844, 370, 376, + /* 390 */ 375, 150, 369, 845, 368, 367, 38, 263, 38, 261, + /* 400 */ 268, 343, 342, 345, 269, 219, 266, 1053, 350, 349, + /* 410 */ 815, 182, 14, 346, 220, 268, 98, 1053, 87, 1041, + /* 420 */ 347, 351, 88, 97, 1053, 1053, 1054, 352, 156, 154, + /* 430 */ 153, 1053, 959, 755, 756, 950, 34, 243, 85, 195, + /* 440 */ 795, 353, 195, 357, 805, 1053, 101, 1053, 806, 1, + /* 450 */ 183, 3, 196, 847, 161, 284, 292, 291, 70, 284, + /* 460 */ 75, 78, 26, 740, 312, 742, 314, 741, 814, 315, + /* 470 */ 871, 850, 835, 645, 18, 81, 17, 39, 39, 70, + /* 480 */ 100, 70, 137, 136, 25, 25, 759, 25, 760, 20, + /* 490 */ 757, 19, 758, 124, 22, 123, 21, 289, 1173, 1172, + /* 500 */ 1171, 234, 79, 76, 235, 215, 216, 729, 290, 1190, + /* 510 */ 836, 221, 213, 222, 223, 1136, 227, 228, 229, 1135, + /* 520 */ 247, 226, 278, 1132, 210, 1131, 248, 356, 48, 1070, + /* 530 */ 158, 1077, 1088, 1067, 155, 1085, 1086, 285, 1118, 1090, + /* 540 */ 160, 165, 1117, 303, 1051, 177, 283, 86, 178, 1049, + /* 550 */ 179, 180, 964, 785, 317, 318, 296, 319, 322, 323, + /* 560 */ 167, 46, 244, 298, 310, 168, 208, 42, 334, 958, + /* 570 */ 341, 1197, 115, 1196, 1193, 186, 348, 1189, 121, 300, + /* 580 */ 80, 77, 50, 308, 1188, 1185, 169, 306, 187, 304, + /* 590 */ 984, 43, 302, 40, 47, 209, 946, 131, 944, 133, + /* 600 */ 134, 942, 941, 299, 270, 198, 199, 938, 937, 936, + /* 610 */ 935, 934, 933, 932, 202, 204, 929, 927, 925, 923, + /* 620 */ 206, 920, 295, 207, 916, 49, 321, 91, 301, 1119, + /* 630 */ 366, 126, 359, 358, 360, 361, 363, 233, 362, 254, + /* 640 */ 316, 364, 374, 896, 271, 272, 895, 275, 274, 894, + /* 650 */ 876, 230, 963, 231, 109, 962, 110, 877, 279, 284, + /* 660 */ 311, 10, 286, 762, 30, 89, 940, 939, 190, 194, + /* 670 */ 146, 985, 188, 189, 192, 191, 931, 193, 147, 148, + /* 680 */ 930, 4, 149, 1022, 92, 986, 922, 176, 172, 170, + /* 690 */ 173, 171, 174, 33, 921, 794, 2, 73, 792, 791, + /* 700 */ 1032, 788, 787, 74, 164, 796, 162, 246, 807, 163, + /* 710 */ 31, 801, 93, 32, 803, 94, 305, 11, 12, 13, + /* 720 */ 27, 313, 36, 28, 101, 103, 106, 660, 695, 693, + /* 730 */ 692, 105, 691, 689, 688, 37, 107, 687, 684, 650, + /* 740 */ 111, 332, 7, 853, 851, 8, 338, 339, 39, 114, + /* 750 */ 71, 116, 72, 120, 732, 731, 728, 122, 676, 674, + /* 760 */ 666, 672, 668, 670, 664, 662, 698, 697, 696, 694, + /* 770 */ 690, 686, 685, 197, 648, 612, 900, 899, 899, 899, + /* 780 */ 899, 899, 899, 899, 899, 899, 899, 899, 899, 151, + /* 790 */ 152, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 268, 1, 201, 202, 201, 268, 247, 5, 268, 9, - /* 10 */ 251, 199, 200, 13, 14, 255, 16, 17, 249, 279, + /* 0 */ 247, 1, 201, 202, 251, 269, 269, 5, 201, 9, + /* 10 */ 5, 199, 200, 13, 14, 247, 16, 17, 281, 251, /* 20 */ 20, 21, 22, 23, 1, 25, 26, 27, 28, 29, - /* 30 */ 30, 201, 9, 273, 265, 35, 36, 35, 36, 39, - /* 40 */ 40, 41, 13, 14, 247, 16, 17, 208, 251, 20, - /* 50 */ 21, 22, 23, 5, 25, 26, 27, 28, 29, 30, - /* 60 */ 225, 249, 227, 228, 35, 36, 268, 232, 39, 40, - /* 70 */ 41, 236, 269, 238, 239, 35, 36, 265, 0, 39, - /* 80 */ 40, 41, 13, 14, 268, 16, 17, 201, 88, 20, + /* 30 */ 30, 201, 9, 15, 256, 35, 36, 35, 36, 39, + /* 40 */ 40, 41, 13, 14, 247, 16, 17, 251, 251, 20, + /* 50 */ 21, 22, 23, 275, 25, 26, 27, 28, 29, 30, + /* 60 */ 225, 249, 227, 228, 35, 36, 251, 232, 39, 40, + /* 70 */ 41, 236, 208, 238, 239, 35, 36, 270, 266, 39, + /* 80 */ 40, 41, 13, 14, 201, 16, 17, 201, 88, 20, /* 90 */ 21, 22, 23, 84, 25, 26, 27, 28, 29, 30, - /* 100 */ 270, 271, 247, 39, 35, 36, 251, 268, 39, 40, - /* 110 */ 41, 86, 13, 14, 85, 16, 17, 249, 279, 20, + /* 100 */ 249, 271, 272, 1, 35, 36, 86, 84, 39, 40, + /* 110 */ 41, 9, 13, 14, 85, 16, 17, 266, 0, 20, /* 120 */ 21, 22, 23, 1, 25, 26, 27, 28, 29, 30, - /* 130 */ 121, 9, 246, 265, 35, 36, 250, 201, 39, 40, - /* 140 */ 41, 14, 201, 16, 17, 127, 128, 20, 21, 22, - /* 150 */ 23, 1, 25, 26, 27, 28, 29, 30, 5, 9, - /* 160 */ 7, 268, 35, 36, 86, 209, 39, 40, 41, 47, + /* 130 */ 121, 9, 246, 269, 35, 36, 250, 119, 39, 40, + /* 140 */ 41, 14, 201, 16, 17, 281, 85, 20, 21, 22, + /* 150 */ 23, 201, 25, 26, 27, 28, 29, 30, 201, 276, + /* 160 */ 99, 278, 35, 36, 128, 129, 39, 40, 41, 47, /* 170 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 180 */ 58, 59, 60, 61, 201, 63, 16, 17, 124, 248, - /* 190 */ 20, 21, 22, 23, 144, 25, 26, 27, 28, 29, - /* 200 */ 30, 245, 92, 153, 154, 35, 36, 208, 268, 39, - /* 210 */ 40, 41, 276, 100, 101, 102, 103, 104, 105, 106, - /* 220 */ 107, 108, 109, 110, 111, 112, 113, 114, 201, 268, - /* 230 */ 39, 40, 41, 46, 84, 225, 226, 227, 228, 229, + /* 180 */ 58, 59, 60, 61, 249, 63, 16, 17, 39, 248, + /* 190 */ 20, 21, 22, 23, 208, 25, 26, 27, 28, 29, + /* 200 */ 30, 266, 92, 246, 86, 35, 36, 250, 269, 39, + /* 210 */ 40, 41, 62, 100, 101, 102, 103, 104, 105, 106, + /* 220 */ 107, 108, 109, 110, 111, 112, 113, 114, 278, 148, + /* 230 */ 280, 150, 201, 46, 84, 225, 226, 227, 228, 229, /* 240 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 250 */ 63, 84, 1, 2, 268, 88, 5, 70, 7, 276, - /* 260 */ 9, 278, 209, 76, 77, 78, 79, 268, 1, 2, - /* 270 */ 83, 84, 5, 208, 7, 268, 9, 250, 279, 126, - /* 280 */ 27, 28, 29, 30, 15, 118, 35, 36, 35, 36, - /* 290 */ 39, 201, 39, 40, 41, 242, 243, 244, 245, 5, - /* 300 */ 268, 7, 35, 36, 70, 64, 65, 66, 121, 67, - /* 310 */ 68, 69, 71, 72, 73, 74, 75, 201, 70, 2, - /* 320 */ 201, 251, 5, 85, 7, 85, 9, 64, 65, 66, - /* 330 */ 143, 90, 145, 268, 201, 84, 64, 65, 66, 152, - /* 340 */ 223, 224, 268, 71, 279, 73, 74, 75, 64, 65, - /* 350 */ 66, 84, 35, 36, 82, 71, 72, 73, 74, 75, - /* 360 */ 122, 100, 122, 102, 103, 246, 276, 241, 107, 250, - /* 370 */ 119, 120, 111, 201, 113, 114, 201, 126, 201, 246, - /* 380 */ 146, 201, 148, 250, 150, 151, 119, 120, 119, 201, - /* 390 */ 274, 201, 276, 126, 146, 201, 148, 201, 150, 151, - /* 400 */ 201, 201, 212, 201, 207, 80, 78, 209, 207, 205, - /* 410 */ 206, 214, 212, 99, 212, 214, 268, 92, 246, 99, - /* 420 */ 126, 246, 250, 246, 207, 250, 246, 250, 210, 211, - /* 430 */ 250, 214, 99, 252, 246, 251, 119, 120, 250, 125, - /* 440 */ 246, 243, 246, 85, 250, 246, 250, 266, 85, 250, - /* 450 */ 85, 85, 85, 1, 85, 85, 85, 99, 62, 85, - /* 460 */ 84, 141, 99, 135, 99, 99, 99, 85, 99, 99, - /* 470 */ 99, 85, 139, 99, 85, 84, 147, 147, 149, 149, - /* 480 */ 84, 99, 147, 268, 149, 99, 201, 5, 99, 7, - /* 490 */ 5, 39, 7, 117, 147, 147, 149, 149, 147, 268, - /* 500 */ 149, 80, 81, 268, 268, 268, 251, 116, 201, 241, - /* 510 */ 201, 268, 268, 268, 268, 268, 241, 241, 241, 241, - /* 520 */ 241, 267, 201, 201, 201, 201, 277, 201, 201, 249, - /* 530 */ 249, 62, 201, 277, 272, 253, 249, 201, 201, 201, - /* 540 */ 201, 201, 201, 201, 201, 201, 201, 201, 126, 263, - /* 550 */ 201, 201, 264, 201, 201, 201, 201, 201, 201, 140, - /* 560 */ 201, 201, 201, 201, 272, 201, 138, 272, 272, 201, - /* 570 */ 133, 137, 262, 201, 201, 136, 201, 261, 201, 201, - /* 580 */ 201, 201, 201, 130, 201, 201, 201, 131, 201, 201, - /* 590 */ 129, 201, 260, 201, 201, 201, 201, 132, 201, 201, - /* 600 */ 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, - /* 610 */ 201, 201, 201, 201, 142, 91, 203, 203, 203, 203, - /* 620 */ 203, 115, 53, 98, 97, 94, 96, 203, 57, 203, - /* 630 */ 203, 95, 93, 86, 5, 155, 5, 5, 203, 155, - /* 640 */ 5, 203, 209, 213, 213, 209, 5, 102, 144, 101, - /* 650 */ 203, 122, 117, 203, 84, 123, 99, 85, 204, 216, - /* 660 */ 203, 220, 222, 221, 219, 217, 215, 218, 204, 203, - /* 670 */ 224, 204, 240, 210, 204, 84, 203, 259, 258, 203, - /* 680 */ 257, 256, 205, 254, 240, 99, 85, 84, 99, 85, - /* 690 */ 84, 1, 85, 84, 99, 85, 84, 84, 134, 99, - /* 700 */ 134, 84, 84, 84, 117, 80, 118, 5, 72, 89, - /* 710 */ 88, 5, 89, 9, 88, 5, 5, 5, 5, 5, - /* 720 */ 5, 87, 15, 80, 84, 26, 61, 85, 84, 149, - /* 730 */ 119, 149, 16, 16, 149, 5, 99, 5, 85, 149, - /* 740 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 750 */ 5, 5, 5, 5, 5, 99, 87, 62, 0, 280, - /* 760 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 770 */ 280, 21, 21, 280, 280, 280, 280, 280, 280, 280, - /* 780 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 790 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 800 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 810 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 820 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 830 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 840 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 850 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 860 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 870 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 880 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 890 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 900 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 910 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 920 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 930 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 940 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 950 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 960 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 970 */ 280, + /* 250 */ 63, 201, 1, 2, 269, 269, 5, 70, 7, 5, + /* 260 */ 9, 7, 209, 76, 77, 78, 79, 281, 1, 2, + /* 270 */ 83, 84, 5, 124, 7, 145, 9, 39, 40, 41, + /* 280 */ 27, 28, 29, 30, 154, 155, 35, 36, 35, 36, + /* 290 */ 39, 99, 39, 40, 41, 242, 243, 244, 245, 208, + /* 300 */ 223, 224, 35, 36, 64, 65, 66, 201, 121, 278, + /* 310 */ 201, 71, 72, 73, 74, 75, 2, 125, 212, 5, + /* 320 */ 70, 7, 5, 9, 201, 209, 9, 70, 278, 201, + /* 330 */ 90, 144, 5, 146, 7, 84, 64, 65, 66, 269, + /* 340 */ 153, 207, 148, 71, 150, 73, 74, 75, 214, 35, + /* 350 */ 36, 84, 35, 36, 82, 64, 65, 66, 201, 250, + /* 360 */ 269, 245, 71, 72, 73, 74, 75, 80, 201, 246, + /* 370 */ 119, 120, 281, 250, 246, 201, 201, 126, 250, 92, + /* 380 */ 126, 100, 201, 102, 103, 209, 119, 120, 107, 67, + /* 390 */ 68, 69, 111, 126, 113, 114, 201, 147, 201, 149, + /* 400 */ 201, 151, 152, 246, 147, 269, 149, 250, 151, 152, + /* 410 */ 78, 212, 84, 246, 269, 201, 88, 250, 85, 243, + /* 420 */ 246, 246, 85, 252, 250, 250, 212, 246, 64, 65, + /* 430 */ 66, 250, 207, 119, 120, 207, 84, 120, 267, 214, + /* 440 */ 85, 246, 214, 246, 85, 250, 118, 250, 85, 210, + /* 450 */ 211, 205, 206, 126, 99, 122, 35, 36, 99, 122, + /* 460 */ 99, 99, 99, 85, 85, 85, 85, 85, 136, 117, + /* 470 */ 85, 85, 1, 85, 148, 84, 150, 99, 99, 99, + /* 480 */ 99, 99, 80, 81, 99, 99, 5, 99, 7, 148, + /* 490 */ 5, 150, 7, 148, 148, 150, 150, 274, 269, 269, + /* 500 */ 269, 269, 140, 142, 269, 269, 269, 116, 274, 251, + /* 510 */ 39, 269, 269, 269, 269, 241, 269, 269, 269, 241, + /* 520 */ 241, 269, 201, 241, 269, 241, 241, 241, 268, 249, + /* 530 */ 201, 201, 201, 265, 62, 201, 201, 249, 279, 201, + /* 540 */ 201, 201, 279, 201, 249, 253, 203, 203, 201, 201, + /* 550 */ 201, 201, 201, 126, 201, 201, 273, 201, 201, 201, + /* 560 */ 264, 201, 273, 273, 134, 263, 201, 201, 201, 201, + /* 570 */ 201, 201, 201, 201, 201, 201, 201, 201, 201, 273, + /* 580 */ 139, 141, 138, 137, 201, 201, 262, 132, 201, 131, + /* 590 */ 201, 201, 130, 201, 201, 201, 201, 201, 201, 201, + /* 600 */ 201, 201, 201, 133, 201, 201, 201, 201, 201, 201, + /* 610 */ 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, + /* 620 */ 201, 201, 127, 201, 201, 143, 91, 203, 203, 203, + /* 630 */ 115, 98, 53, 97, 94, 96, 95, 203, 57, 203, + /* 640 */ 203, 93, 86, 5, 156, 5, 5, 5, 156, 5, + /* 650 */ 101, 203, 213, 203, 209, 213, 209, 102, 145, 122, + /* 660 */ 117, 84, 99, 85, 84, 123, 203, 203, 216, 215, + /* 670 */ 204, 222, 221, 220, 217, 219, 203, 218, 204, 204, + /* 680 */ 203, 205, 204, 240, 99, 224, 203, 254, 259, 261, + /* 690 */ 258, 260, 257, 255, 203, 85, 210, 99, 126, 126, + /* 700 */ 240, 5, 5, 84, 99, 85, 84, 1, 85, 84, + /* 710 */ 99, 85, 84, 99, 85, 84, 84, 135, 135, 84, + /* 720 */ 84, 117, 89, 84, 118, 80, 72, 5, 9, 5, + /* 730 */ 5, 88, 5, 5, 5, 89, 88, 5, 5, 87, + /* 740 */ 80, 15, 84, 119, 85, 84, 26, 61, 99, 150, + /* 750 */ 16, 150, 16, 150, 5, 5, 85, 150, 5, 5, + /* 760 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + /* 770 */ 5, 5, 5, 99, 87, 62, 0, 282, 282, 282, + /* 780 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 21, + /* 790 */ 21, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 800 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 810 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 820 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 830 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 840 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 850 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 860 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 870 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 880 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 890 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 900 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 910 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 920 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 930 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 940 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 950 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 960 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 970 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, + /* 980 */ 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, }; -#define YY_SHIFT_COUNT (367) +#define YY_SHIFT_COUNT (378) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (758) +#define YY_SHIFT_MAX (776) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 187, 113, 113, 261, 261, 25, 251, 267, 267, 150, - /* 10 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 20 */ 23, 23, 23, 0, 122, 267, 317, 317, 317, 9, - /* 30 */ 9, 23, 23, 18, 23, 78, 23, 23, 23, 23, - /* 40 */ 325, 25, 110, 110, 48, 773, 773, 773, 267, 267, + /* 0 */ 187, 113, 113, 281, 281, 20, 251, 267, 267, 23, + /* 10 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 20 */ 102, 102, 102, 0, 122, 267, 314, 314, 314, 9, + /* 30 */ 9, 102, 102, 36, 102, 118, 102, 102, 102, 102, + /* 40 */ 287, 20, 110, 110, 5, 791, 791, 791, 267, 267, /* 50 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, /* 60 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 70 */ 317, 317, 317, 2, 2, 2, 2, 2, 2, 2, - /* 80 */ 23, 23, 23, 64, 23, 23, 23, 9, 9, 23, - /* 90 */ 23, 23, 23, 328, 328, 314, 9, 23, 23, 23, - /* 100 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 110 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 120 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 130 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 140 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - /* 150 */ 23, 23, 23, 23, 23, 23, 469, 469, 469, 422, - /* 160 */ 422, 422, 422, 469, 469, 428, 419, 437, 434, 439, - /* 170 */ 456, 453, 461, 465, 472, 469, 469, 469, 524, 524, - /* 180 */ 506, 25, 25, 469, 469, 525, 527, 569, 531, 530, - /* 190 */ 571, 536, 539, 506, 48, 469, 469, 547, 547, 469, - /* 200 */ 547, 469, 547, 469, 469, 773, 773, 29, 69, 69, - /* 210 */ 99, 69, 127, 170, 241, 253, 253, 253, 253, 253, - /* 220 */ 253, 272, 284, 40, 40, 40, 40, 234, 248, 50, - /* 230 */ 167, 191, 191, 153, 294, 242, 263, 358, 238, 240, - /* 240 */ 363, 365, 366, 320, 333, 367, 369, 370, 371, 374, - /* 250 */ 376, 382, 386, 452, 396, 269, 389, 329, 330, 335, - /* 260 */ 482, 485, 347, 348, 391, 351, 421, 629, 480, 631, - /* 270 */ 632, 484, 635, 641, 545, 548, 504, 529, 535, 570, - /* 280 */ 532, 572, 591, 557, 586, 601, 603, 604, 606, 607, - /* 290 */ 589, 609, 610, 612, 690, 613, 595, 564, 600, 566, - /* 300 */ 617, 535, 618, 587, 619, 588, 625, 620, 622, 636, - /* 310 */ 702, 623, 626, 704, 706, 710, 711, 712, 713, 714, - /* 320 */ 715, 634, 707, 643, 640, 642, 611, 644, 699, 665, - /* 330 */ 716, 580, 582, 637, 637, 637, 637, 717, 585, 590, - /* 340 */ 637, 637, 637, 730, 732, 653, 637, 735, 736, 737, - /* 350 */ 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, - /* 360 */ 748, 749, 656, 669, 750, 751, 695, 758, + /* 70 */ 314, 314, 314, 317, 317, 2, 2, 2, 2, 2, + /* 80 */ 2, 2, 102, 102, 102, 149, 102, 102, 102, 9, + /* 90 */ 9, 102, 102, 102, 102, 332, 332, 192, 9, 102, + /* 100 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 110 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 120 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 130 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 140 */ 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + /* 150 */ 102, 102, 102, 102, 102, 102, 102, 102, 472, 472, + /* 160 */ 472, 427, 427, 427, 427, 472, 472, 441, 440, 430, + /* 170 */ 444, 446, 455, 458, 462, 470, 495, 482, 472, 472, + /* 180 */ 472, 535, 535, 515, 20, 20, 472, 472, 533, 536, + /* 190 */ 579, 540, 539, 581, 541, 548, 515, 5, 472, 472, + /* 200 */ 556, 556, 472, 556, 472, 556, 472, 472, 791, 791, + /* 210 */ 29, 69, 69, 99, 69, 127, 170, 240, 253, 253, + /* 220 */ 253, 253, 253, 253, 272, 291, 40, 40, 40, 40, + /* 230 */ 250, 257, 130, 328, 238, 238, 254, 327, 322, 364, + /* 240 */ 61, 333, 337, 421, 355, 359, 363, 361, 362, 378, + /* 250 */ 379, 380, 381, 382, 352, 385, 386, 471, 150, 18, + /* 260 */ 388, 81, 194, 326, 481, 485, 341, 345, 391, 346, + /* 270 */ 402, 638, 488, 640, 641, 492, 642, 644, 555, 549, + /* 280 */ 513, 537, 543, 577, 542, 578, 580, 563, 585, 610, + /* 290 */ 598, 572, 573, 696, 697, 619, 620, 622, 623, 625, + /* 300 */ 626, 605, 628, 629, 631, 706, 632, 611, 582, 614, + /* 310 */ 583, 635, 543, 636, 604, 639, 606, 645, 633, 643, + /* 320 */ 654, 722, 646, 648, 719, 724, 725, 727, 728, 729, + /* 330 */ 732, 733, 652, 726, 660, 658, 659, 624, 661, 720, + /* 340 */ 686, 734, 599, 601, 649, 649, 649, 649, 736, 603, + /* 350 */ 607, 649, 649, 649, 749, 750, 671, 649, 753, 754, + /* 360 */ 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, + /* 370 */ 765, 766, 767, 674, 687, 768, 769, 713, 776, }; -#define YY_REDUCE_COUNT (206) -#define YY_REDUCE_MIN (-268) -#define YY_REDUCE_MAX (477) +#define YY_REDUCE_COUNT (209) +#define YY_REDUCE_MIN (-264) +#define YY_REDUCE_MAX (491) static const short yy_reduce_ofst[] = { - /* 0 */ -188, 10, 10, -165, -165, 53, -161, -1, 65, -170, - /* 10 */ -114, -17, 116, 119, 133, 172, 175, 177, 180, 188, - /* 20 */ 194, 196, 199, -197, -199, -260, -241, -203, -145, -231, - /* 30 */ -132, -64, 90, -240, -59, -44, 190, 200, 202, 27, - /* 40 */ 197, 198, 201, 217, 117, 181, 218, 204, -268, -263, - /* 50 */ -202, -184, -107, -60, -39, -14, 7, 32, 74, 148, - /* 60 */ 215, 231, 235, 236, 237, 243, 244, 245, 246, 247, - /* 70 */ 70, 184, 255, 126, 268, 275, 276, 277, 278, 279, - /* 80 */ 285, 307, 309, 254, 321, 322, 323, 280, 281, 324, - /* 90 */ 326, 327, 331, 249, 256, 282, 287, 336, 337, 338, - /* 100 */ 339, 340, 341, 342, 343, 344, 345, 346, 349, 350, - /* 110 */ 352, 353, 354, 355, 356, 357, 359, 360, 361, 362, - /* 120 */ 364, 368, 372, 373, 375, 377, 378, 379, 380, 381, - /* 130 */ 383, 384, 385, 387, 388, 390, 392, 393, 394, 395, - /* 140 */ 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - /* 150 */ 407, 408, 409, 410, 411, 412, 413, 414, 415, 262, - /* 160 */ 292, 295, 296, 416, 417, 288, 286, 310, 316, 332, - /* 170 */ 418, 420, 423, 425, 429, 424, 426, 427, 430, 431, - /* 180 */ 432, 433, 436, 435, 438, 440, 442, 441, 443, 445, - /* 190 */ 448, 449, 451, 444, 446, 447, 450, 454, 464, 457, - /* 200 */ 467, 466, 470, 473, 476, 463, 477, + /* 0 */ -188, 10, 10, -165, -165, 53, -136, -14, 91, -170, + /* 10 */ -114, -50, -117, -43, 123, 128, 157, 167, 174, 175, + /* 20 */ 181, 195, 197, -193, -199, -263, -247, -232, -203, -149, + /* 30 */ -65, 31, 50, -222, -59, 116, 106, 199, 214, 109, + /* 40 */ 134, 176, 225, 228, 77, 171, 239, 246, -264, -61, + /* 50 */ -15, 70, 136, 145, 229, 230, 231, 232, 235, 236, + /* 60 */ 237, 242, 243, 244, 245, 247, 248, 249, 252, 255, + /* 70 */ -204, -185, 258, 223, 234, 274, 278, 279, 282, 284, + /* 80 */ 285, 286, 321, 329, 330, 260, 331, 334, 335, 280, + /* 90 */ 288, 338, 339, 340, 342, 259, 263, 292, 295, 347, + /* 100 */ 348, 349, 350, 351, 353, 354, 356, 357, 358, 360, + /* 110 */ 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + /* 120 */ 375, 376, 377, 383, 384, 387, 389, 390, 392, 393, + /* 130 */ 394, 395, 396, 397, 398, 399, 400, 401, 403, 404, + /* 140 */ 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + /* 150 */ 415, 416, 417, 418, 419, 420, 422, 423, 343, 344, + /* 160 */ 424, 283, 289, 290, 306, 425, 426, 268, 296, 302, + /* 170 */ 324, 428, 431, 429, 432, 435, 438, 433, 434, 436, + /* 180 */ 437, 439, 442, 443, 445, 447, 448, 450, 449, 451, + /* 190 */ 453, 452, 456, 457, 459, 454, 460, 461, 463, 464, + /* 200 */ 466, 474, 473, 475, 477, 478, 483, 491, 486, 476, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 870, 994, 933, 1004, 920, 930, 1145, 1145, 1145, 870, - /* 10 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 20 */ 870, 870, 870, 1052, 890, 1145, 870, 870, 870, 870, - /* 30 */ 870, 870, 870, 1067, 870, 930, 870, 870, 870, 870, - /* 40 */ 940, 930, 940, 940, 870, 1047, 978, 996, 870, 870, - /* 50 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 60 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 70 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 80 */ 870, 870, 870, 1054, 1060, 1057, 870, 870, 870, 1062, - /* 90 */ 870, 870, 870, 1086, 1086, 1045, 870, 870, 870, 870, - /* 100 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 110 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 120 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 918, - /* 130 */ 870, 916, 870, 870, 870, 870, 870, 870, 870, 870, - /* 140 */ 870, 870, 870, 870, 870, 870, 870, 870, 901, 870, - /* 150 */ 870, 870, 870, 870, 870, 888, 892, 892, 892, 870, - /* 160 */ 870, 870, 870, 892, 892, 1093, 1097, 1079, 1091, 1087, - /* 170 */ 1074, 1072, 1070, 1078, 1101, 892, 892, 892, 938, 938, - /* 180 */ 934, 930, 930, 892, 892, 956, 954, 952, 944, 950, - /* 190 */ 946, 948, 942, 921, 870, 892, 892, 928, 928, 892, - /* 200 */ 928, 892, 928, 892, 892, 978, 996, 870, 1102, 1092, - /* 210 */ 870, 1144, 1132, 1131, 870, 1140, 1139, 1138, 1130, 1129, - /* 220 */ 1128, 870, 870, 1124, 1127, 1126, 1125, 870, 870, 870, - /* 230 */ 870, 1134, 1133, 870, 870, 870, 870, 870, 870, 870, - /* 240 */ 870, 870, 870, 1098, 1094, 870, 870, 870, 870, 870, - /* 250 */ 870, 870, 870, 870, 1104, 870, 870, 870, 870, 870, - /* 260 */ 870, 870, 870, 870, 1006, 870, 870, 870, 870, 870, - /* 270 */ 870, 870, 870, 870, 870, 870, 870, 1044, 870, 870, - /* 280 */ 870, 870, 870, 1056, 1055, 870, 870, 870, 870, 870, - /* 290 */ 870, 870, 870, 870, 870, 870, 1088, 870, 1080, 870, - /* 300 */ 870, 1018, 870, 870, 870, 870, 870, 870, 870, 870, - /* 310 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 320 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 330 */ 870, 870, 870, 1163, 1158, 1159, 1156, 870, 870, 870, - /* 340 */ 1155, 1150, 1151, 870, 870, 870, 1148, 870, 870, 870, - /* 350 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 360 */ 870, 870, 962, 870, 899, 897, 870, 870, + /* 0 */ 897, 1021, 960, 1031, 947, 957, 1181, 1181, 1181, 897, + /* 10 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 20 */ 897, 897, 897, 1079, 917, 1181, 897, 897, 897, 897, + /* 30 */ 897, 897, 897, 1103, 897, 957, 897, 897, 897, 897, + /* 40 */ 967, 957, 967, 967, 897, 1074, 1005, 1023, 897, 897, + /* 50 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 60 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 70 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 80 */ 897, 897, 897, 897, 897, 1081, 1087, 1084, 897, 897, + /* 90 */ 897, 1089, 897, 897, 897, 1122, 1122, 1072, 897, 897, + /* 100 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 110 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 120 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 130 */ 897, 945, 897, 943, 897, 897, 897, 897, 897, 897, + /* 140 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 150 */ 928, 897, 897, 897, 897, 897, 897, 915, 919, 919, + /* 160 */ 919, 897, 897, 897, 897, 919, 919, 1129, 1133, 1115, + /* 170 */ 1127, 1123, 1110, 1108, 1106, 1114, 1099, 1137, 919, 919, + /* 180 */ 919, 965, 965, 961, 957, 957, 919, 919, 983, 981, + /* 190 */ 979, 971, 977, 973, 975, 969, 948, 897, 919, 919, + /* 200 */ 955, 955, 919, 955, 919, 955, 919, 919, 1005, 1023, + /* 210 */ 897, 1138, 1128, 897, 1180, 1168, 1167, 897, 1176, 1175, + /* 220 */ 1174, 1166, 1165, 1164, 897, 897, 1160, 1163, 1162, 1161, + /* 230 */ 897, 897, 897, 897, 1170, 1169, 897, 897, 897, 897, + /* 240 */ 897, 897, 897, 1096, 897, 897, 897, 1134, 1130, 897, + /* 250 */ 897, 897, 897, 897, 897, 897, 897, 897, 1140, 897, + /* 260 */ 897, 897, 897, 897, 897, 897, 897, 897, 1033, 897, + /* 270 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 280 */ 897, 1071, 897, 897, 897, 897, 897, 1083, 1082, 897, + /* 290 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 300 */ 897, 897, 897, 897, 897, 897, 897, 1124, 897, 1116, + /* 310 */ 897, 897, 1045, 897, 897, 897, 897, 897, 897, 897, + /* 320 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 330 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 340 */ 897, 897, 897, 897, 1199, 1194, 1195, 1192, 897, 897, + /* 350 */ 897, 1191, 1186, 1187, 897, 897, 897, 1184, 897, 897, + /* 360 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + /* 370 */ 897, 897, 897, 989, 897, 926, 924, 897, 897, }; /********** End of lemon-generated parsing tables *****************************/ @@ -638,6 +655,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* DISTINCT => nothing */ 0, /* FROM => nothing */ 0, /* VARIABLE => nothing */ + 0, /* RANGE => nothing */ 0, /* INTERVAL => nothing */ 0, /* EVERY => nothing */ 0, /* SESSION => nothing */ @@ -748,6 +766,7 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ + ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -922,78 +941,78 @@ static const char *const yyTokenName[] = { /* 124 */ "DISTINCT", /* 125 */ "FROM", /* 126 */ "VARIABLE", - /* 127 */ "INTERVAL", - /* 128 */ "EVERY", - /* 129 */ "SESSION", - /* 130 */ "STATE_WINDOW", - /* 131 */ "FILL", - /* 132 */ "SLIDING", - /* 133 */ "ORDER", - /* 134 */ "BY", - /* 135 */ "ASC", - /* 136 */ "GROUP", - /* 137 */ "HAVING", - /* 138 */ "LIMIT", - /* 139 */ "OFFSET", - /* 140 */ "SLIMIT", - /* 141 */ "SOFFSET", - /* 142 */ "WHERE", - /* 143 */ "RESET", - /* 144 */ "QUERY", - /* 145 */ "SYNCDB", - /* 146 */ "ADD", - /* 147 */ "COLUMN", - /* 148 */ "MODIFY", - /* 149 */ "TAG", - /* 150 */ "CHANGE", - /* 151 */ "SET", - /* 152 */ "KILL", - /* 153 */ "CONNECTION", - /* 154 */ "STREAM", - /* 155 */ "COLON", - /* 156 */ "ABORT", - /* 157 */ "AFTER", - /* 158 */ "ATTACH", - /* 159 */ "BEFORE", - /* 160 */ "BEGIN", - /* 161 */ "CASCADE", - /* 162 */ "CLUSTER", - /* 163 */ "CONFLICT", - /* 164 */ "COPY", - /* 165 */ "DEFERRED", - /* 166 */ "DELIMITERS", - /* 167 */ "DETACH", - /* 168 */ "EACH", - /* 169 */ "END", - /* 170 */ "EXPLAIN", - /* 171 */ "FAIL", - /* 172 */ "FOR", - /* 173 */ "IGNORE", - /* 174 */ "IMMEDIATE", - /* 175 */ "INITIALLY", - /* 176 */ "INSTEAD", - /* 177 */ "KEY", - /* 178 */ "OF", - /* 179 */ "RAISE", - /* 180 */ "REPLACE", - /* 181 */ "RESTRICT", - /* 182 */ "ROW", - /* 183 */ "STATEMENT", - /* 184 */ "TRIGGER", - /* 185 */ "VIEW", - /* 186 */ "IPTOKEN", - /* 187 */ "SEMI", - /* 188 */ "NONE", - /* 189 */ "PREV", - /* 190 */ "LINEAR", - /* 191 */ "IMPORT", - /* 192 */ "TBNAME", - /* 193 */ "JOIN", - /* 194 */ "INSERT", - /* 195 */ "INTO", - /* 196 */ "VALUES", - /* 197 */ "FILE", - /* 198 */ "error", + /* 127 */ "RANGE", + /* 128 */ "INTERVAL", + /* 129 */ "EVERY", + /* 130 */ "SESSION", + /* 131 */ "STATE_WINDOW", + /* 132 */ "FILL", + /* 133 */ "SLIDING", + /* 134 */ "ORDER", + /* 135 */ "BY", + /* 136 */ "ASC", + /* 137 */ "GROUP", + /* 138 */ "HAVING", + /* 139 */ "LIMIT", + /* 140 */ "OFFSET", + /* 141 */ "SLIMIT", + /* 142 */ "SOFFSET", + /* 143 */ "WHERE", + /* 144 */ "RESET", + /* 145 */ "QUERY", + /* 146 */ "SYNCDB", + /* 147 */ "ADD", + /* 148 */ "COLUMN", + /* 149 */ "MODIFY", + /* 150 */ "TAG", + /* 151 */ "CHANGE", + /* 152 */ "SET", + /* 153 */ "KILL", + /* 154 */ "CONNECTION", + /* 155 */ "STREAM", + /* 156 */ "COLON", + /* 157 */ "ABORT", + /* 158 */ "AFTER", + /* 159 */ "ATTACH", + /* 160 */ "BEFORE", + /* 161 */ "BEGIN", + /* 162 */ "CASCADE", + /* 163 */ "CLUSTER", + /* 164 */ "CONFLICT", + /* 165 */ "COPY", + /* 166 */ "DEFERRED", + /* 167 */ "DELIMITERS", + /* 168 */ "DETACH", + /* 169 */ "EACH", + /* 170 */ "END", + /* 171 */ "EXPLAIN", + /* 172 */ "FAIL", + /* 173 */ "FOR", + /* 174 */ "IGNORE", + /* 175 */ "IMMEDIATE", + /* 176 */ "INITIALLY", + /* 177 */ "INSTEAD", + /* 178 */ "KEY", + /* 179 */ "OF", + /* 180 */ "RAISE", + /* 181 */ "REPLACE", + /* 182 */ "RESTRICT", + /* 183 */ "ROW", + /* 184 */ "STATEMENT", + /* 185 */ "TRIGGER", + /* 186 */ "VIEW", + /* 187 */ "IPTOKEN", + /* 188 */ "SEMI", + /* 189 */ "NONE", + /* 190 */ "PREV", + /* 191 */ "LINEAR", + /* 192 */ "IMPORT", + /* 193 */ "TBNAME", + /* 194 */ "JOIN", + /* 195 */ "INSERT", + /* 196 */ "INTO", + /* 197 */ "VALUES", + /* 198 */ "FILE", /* 199 */ "program", /* 200 */ "cmd", /* 201 */ "ids", @@ -1050,31 +1069,33 @@ static const char *const yyTokenName[] = { /* 252 */ "selcollist", /* 253 */ "from", /* 254 */ "where_opt", - /* 255 */ "interval_option", - /* 256 */ "sliding_opt", - /* 257 */ "session_option", - /* 258 */ "windowstate_option", - /* 259 */ "fill_opt", - /* 260 */ "groupby_opt", - /* 261 */ "having_opt", - /* 262 */ "orderby_opt", - /* 263 */ "slimit_opt", - /* 264 */ "limit_opt", - /* 265 */ "union", - /* 266 */ "sclp", - /* 267 */ "distinct", - /* 268 */ "expr", - /* 269 */ "as", - /* 270 */ "tablelist", - /* 271 */ "sub", - /* 272 */ "tmvar", - /* 273 */ "intervalKey", - /* 274 */ "sortlist", - /* 275 */ "sortitem", - /* 276 */ "item", - /* 277 */ "sortorder", - /* 278 */ "grouplist", - /* 279 */ "expritem", + /* 255 */ "range_option", + /* 256 */ "interval_option", + /* 257 */ "sliding_opt", + /* 258 */ "session_option", + /* 259 */ "windowstate_option", + /* 260 */ "fill_opt", + /* 261 */ "groupby_opt", + /* 262 */ "having_opt", + /* 263 */ "orderby_opt", + /* 264 */ "slimit_opt", + /* 265 */ "limit_opt", + /* 266 */ "union", + /* 267 */ "sclp", + /* 268 */ "distinct", + /* 269 */ "expr", + /* 270 */ "as", + /* 271 */ "tablelist", + /* 272 */ "sub", + /* 273 */ "tmvar", + /* 274 */ "timestamp", + /* 275 */ "intervalKey", + /* 276 */ "sortlist", + /* 277 */ "sortitem", + /* 278 */ "item", + /* 279 */ "sortorder", + /* 280 */ "grouplist", + /* 281 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1249,7 +1270,7 @@ static const char *const yyRuleName[] = { /* 164 */ "tagitem ::= MINUS FLOAT", /* 165 */ "tagitem ::= PLUS INTEGER", /* 166 */ "tagitem ::= PLUS FLOAT", - /* 167 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", + /* 167 */ "select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", /* 168 */ "select ::= LP select RP", /* 169 */ "union ::= select", /* 170 */ "union ::= union UNION ALL select", @@ -1274,108 +1295,117 @@ static const char *const yyRuleName[] = { /* 189 */ "tablelist ::= tablelist COMMA ids cpxName", /* 190 */ "tablelist ::= tablelist COMMA ids cpxName ids", /* 191 */ "tmvar ::= VARIABLE", - /* 192 */ "interval_option ::= intervalKey LP tmvar RP", - /* 193 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", - /* 194 */ "interval_option ::=", - /* 195 */ "intervalKey ::= INTERVAL", - /* 196 */ "intervalKey ::= EVERY", - /* 197 */ "session_option ::=", - /* 198 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", - /* 199 */ "windowstate_option ::=", - /* 200 */ "windowstate_option ::= STATE_WINDOW LP ids RP", - /* 201 */ "fill_opt ::=", - /* 202 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 203 */ "fill_opt ::= FILL LP ID RP", - /* 204 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 205 */ "sliding_opt ::=", - /* 206 */ "orderby_opt ::=", - /* 207 */ "orderby_opt ::= ORDER BY sortlist", - /* 208 */ "sortlist ::= sortlist COMMA item sortorder", - /* 209 */ "sortlist ::= item sortorder", - /* 210 */ "item ::= ids cpxName", - /* 211 */ "sortorder ::= ASC", - /* 212 */ "sortorder ::= DESC", - /* 213 */ "sortorder ::=", - /* 214 */ "groupby_opt ::=", - /* 215 */ "groupby_opt ::= GROUP BY grouplist", - /* 216 */ "grouplist ::= grouplist COMMA item", - /* 217 */ "grouplist ::= item", - /* 218 */ "having_opt ::=", - /* 219 */ "having_opt ::= HAVING expr", - /* 220 */ "limit_opt ::=", - /* 221 */ "limit_opt ::= LIMIT signed", - /* 222 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 223 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 224 */ "slimit_opt ::=", - /* 225 */ "slimit_opt ::= SLIMIT signed", - /* 226 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 227 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 228 */ "where_opt ::=", - /* 229 */ "where_opt ::= WHERE expr", - /* 230 */ "expr ::= LP expr RP", - /* 231 */ "expr ::= ID", - /* 232 */ "expr ::= ID DOT ID", - /* 233 */ "expr ::= ID DOT STAR", - /* 234 */ "expr ::= INTEGER", - /* 235 */ "expr ::= MINUS INTEGER", - /* 236 */ "expr ::= PLUS INTEGER", - /* 237 */ "expr ::= FLOAT", - /* 238 */ "expr ::= MINUS FLOAT", - /* 239 */ "expr ::= PLUS FLOAT", - /* 240 */ "expr ::= STRING", - /* 241 */ "expr ::= NOW", - /* 242 */ "expr ::= VARIABLE", - /* 243 */ "expr ::= PLUS VARIABLE", - /* 244 */ "expr ::= MINUS VARIABLE", - /* 245 */ "expr ::= BOOL", - /* 246 */ "expr ::= NULL", - /* 247 */ "expr ::= ID LP exprlist RP", - /* 248 */ "expr ::= ID LP STAR RP", - /* 249 */ "expr ::= expr IS NULL", - /* 250 */ "expr ::= expr IS NOT NULL", - /* 251 */ "expr ::= expr LT expr", - /* 252 */ "expr ::= expr GT expr", - /* 253 */ "expr ::= expr LE expr", - /* 254 */ "expr ::= expr GE expr", - /* 255 */ "expr ::= expr NE expr", - /* 256 */ "expr ::= expr EQ expr", - /* 257 */ "expr ::= expr BETWEEN expr AND expr", - /* 258 */ "expr ::= expr AND expr", - /* 259 */ "expr ::= expr OR expr", - /* 260 */ "expr ::= expr PLUS expr", - /* 261 */ "expr ::= expr MINUS expr", - /* 262 */ "expr ::= expr STAR expr", - /* 263 */ "expr ::= expr SLASH expr", - /* 264 */ "expr ::= expr REM expr", - /* 265 */ "expr ::= expr LIKE expr", - /* 266 */ "expr ::= expr MATCH expr", - /* 267 */ "expr ::= expr NMATCH expr", - /* 268 */ "expr ::= expr IN LP exprlist RP", - /* 269 */ "exprlist ::= exprlist COMMA expritem", - /* 270 */ "exprlist ::= expritem", - /* 271 */ "expritem ::= expr", - /* 272 */ "expritem ::=", - /* 273 */ "cmd ::= RESET QUERY CACHE", - /* 274 */ "cmd ::= SYNCDB ids REPLICA", - /* 275 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 276 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 277 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 278 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 279 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 280 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 281 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 282 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 283 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 284 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 285 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 286 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 287 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 288 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 289 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 290 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 291 */ "cmd ::= KILL CONNECTION INTEGER", - /* 292 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 293 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 192 */ "timestamp ::= INTEGER", + /* 193 */ "timestamp ::= MINUS INTEGER", + /* 194 */ "timestamp ::= PLUS INTEGER", + /* 195 */ "timestamp ::= STRING", + /* 196 */ "timestamp ::= NOW", + /* 197 */ "timestamp ::= NOW PLUS VARIABLE", + /* 198 */ "timestamp ::= NOW MINUS VARIABLE", + /* 199 */ "range_option ::=", + /* 200 */ "range_option ::= RANGE LP timestamp COMMA timestamp RP", + /* 201 */ "interval_option ::= intervalKey LP tmvar RP", + /* 202 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", + /* 203 */ "interval_option ::=", + /* 204 */ "intervalKey ::= INTERVAL", + /* 205 */ "intervalKey ::= EVERY", + /* 206 */ "session_option ::=", + /* 207 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", + /* 208 */ "windowstate_option ::=", + /* 209 */ "windowstate_option ::= STATE_WINDOW LP ids RP", + /* 210 */ "fill_opt ::=", + /* 211 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 212 */ "fill_opt ::= FILL LP ID RP", + /* 213 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 214 */ "sliding_opt ::=", + /* 215 */ "orderby_opt ::=", + /* 216 */ "orderby_opt ::= ORDER BY sortlist", + /* 217 */ "sortlist ::= sortlist COMMA item sortorder", + /* 218 */ "sortlist ::= item sortorder", + /* 219 */ "item ::= ids cpxName", + /* 220 */ "sortorder ::= ASC", + /* 221 */ "sortorder ::= DESC", + /* 222 */ "sortorder ::=", + /* 223 */ "groupby_opt ::=", + /* 224 */ "groupby_opt ::= GROUP BY grouplist", + /* 225 */ "grouplist ::= grouplist COMMA item", + /* 226 */ "grouplist ::= item", + /* 227 */ "having_opt ::=", + /* 228 */ "having_opt ::= HAVING expr", + /* 229 */ "limit_opt ::=", + /* 230 */ "limit_opt ::= LIMIT signed", + /* 231 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 232 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 233 */ "slimit_opt ::=", + /* 234 */ "slimit_opt ::= SLIMIT signed", + /* 235 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 236 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 237 */ "where_opt ::=", + /* 238 */ "where_opt ::= WHERE expr", + /* 239 */ "expr ::= LP expr RP", + /* 240 */ "expr ::= ID", + /* 241 */ "expr ::= ID DOT ID", + /* 242 */ "expr ::= ID DOT STAR", + /* 243 */ "expr ::= INTEGER", + /* 244 */ "expr ::= MINUS INTEGER", + /* 245 */ "expr ::= PLUS INTEGER", + /* 246 */ "expr ::= FLOAT", + /* 247 */ "expr ::= MINUS FLOAT", + /* 248 */ "expr ::= PLUS FLOAT", + /* 249 */ "expr ::= STRING", + /* 250 */ "expr ::= NOW", + /* 251 */ "expr ::= VARIABLE", + /* 252 */ "expr ::= PLUS VARIABLE", + /* 253 */ "expr ::= MINUS VARIABLE", + /* 254 */ "expr ::= BOOL", + /* 255 */ "expr ::= NULL", + /* 256 */ "expr ::= ID LP exprlist RP", + /* 257 */ "expr ::= ID LP STAR RP", + /* 258 */ "expr ::= expr IS NULL", + /* 259 */ "expr ::= expr IS NOT NULL", + /* 260 */ "expr ::= expr LT expr", + /* 261 */ "expr ::= expr GT expr", + /* 262 */ "expr ::= expr LE expr", + /* 263 */ "expr ::= expr GE expr", + /* 264 */ "expr ::= expr NE expr", + /* 265 */ "expr ::= expr EQ expr", + /* 266 */ "expr ::= expr BETWEEN expr AND expr", + /* 267 */ "expr ::= expr AND expr", + /* 268 */ "expr ::= expr OR expr", + /* 269 */ "expr ::= expr PLUS expr", + /* 270 */ "expr ::= expr MINUS expr", + /* 271 */ "expr ::= expr STAR expr", + /* 272 */ "expr ::= expr SLASH expr", + /* 273 */ "expr ::= expr REM expr", + /* 274 */ "expr ::= expr LIKE expr", + /* 275 */ "expr ::= expr MATCH expr", + /* 276 */ "expr ::= expr NMATCH expr", + /* 277 */ "expr ::= expr IN LP exprlist RP", + /* 278 */ "exprlist ::= exprlist COMMA expritem", + /* 279 */ "exprlist ::= expritem", + /* 280 */ "expritem ::= expr", + /* 281 */ "expritem ::=", + /* 282 */ "cmd ::= RESET QUERY CACHE", + /* 283 */ "cmd ::= SYNCDB ids REPLICA", + /* 284 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 285 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 286 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 287 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 288 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 289 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 290 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 291 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 292 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 293 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 294 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 295 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 296 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 297 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 298 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 299 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 300 */ "cmd ::= KILL CONNECTION INTEGER", + /* 301 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 302 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1424,28 +1454,29 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypParser){ - yyParser *pParser = (yyParser*)yypParser; +void ParseInit(void *yypRawParser ParseCTX_PDECL){ + yyParser *yypParser = (yyParser*)yypRawParser; + ParseCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH - pParser->yyhwm = 0; + yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - pParser->yytos = NULL; - pParser->yystack = NULL; - pParser->yystksz = 0; - if( yyGrowStack(pParser) ){ - pParser->yystack = &pParser->yystk0; - pParser->yystksz = 1; + yypParser->yytos = NULL; + yypParser->yystack = NULL; + yypParser->yystksz = 0; + if( yyGrowStack(yypParser) ){ + yypParser->yystack = &yypParser->yystk0; + yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - pParser->yyerrcnt = -1; + yypParser->yyerrcnt = -1; #endif - pParser->yytos = pParser->yystack; - pParser->yystack[0].stateno = 0; - pParser->yystack[0].major = 0; + yypParser->yytos = yypParser->yystack; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1462,11 +1493,14 @@ void ParseInit(void *yypParser){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( pParser ) ParseInit(pParser); - return pParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ + yyParser *yypParser; + yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( yypParser ){ + ParseCTX_STORE + ParseInit(yypParser ParseCTX_PARAM); + } + return (void*)yypParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1483,7 +1517,8 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1498,9 +1533,9 @@ static void yy_destructor( /********* Begin destructor definitions ***************************************/ case 208: /* exprlist */ case 252: /* selcollist */ - case 266: /* sclp */ + case 267: /* sclp */ { -tSqlExprListDestroy((yypminor->yy221)); +tSqlExprListDestroy((yypminor->yy345)); } break; case 223: /* intitemlist */ @@ -1508,48 +1543,49 @@ tSqlExprListDestroy((yypminor->yy221)); case 246: /* columnlist */ case 247: /* tagitemlist */ case 248: /* tagNamelist */ - case 259: /* fill_opt */ - case 260: /* groupby_opt */ - case 262: /* orderby_opt */ - case 274: /* sortlist */ - case 278: /* grouplist */ + case 260: /* fill_opt */ + case 261: /* groupby_opt */ + case 263: /* orderby_opt */ + case 276: /* sortlist */ + case 280: /* grouplist */ { -taosArrayDestroy((yypminor->yy221)); +taosArrayDestroy((yypminor->yy345)); } break; case 244: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy102)); +destroyCreateTableSql((yypminor->yy170)); } break; case 249: /* select */ { -destroySqlNode((yypminor->yy376)); +destroySqlNode((yypminor->yy68)); } break; case 253: /* from */ - case 270: /* tablelist */ - case 271: /* sub */ + case 271: /* tablelist */ + case 272: /* sub */ { -destroyRelationInfo((yypminor->yy164)); +destroyRelationInfo((yypminor->yy484)); } break; case 254: /* where_opt */ - case 261: /* having_opt */ - case 268: /* expr */ - case 279: /* expritem */ + case 262: /* having_opt */ + case 269: /* expr */ + case 274: /* timestamp */ + case 281: /* expritem */ { -tSqlExprDestroy((yypminor->yy146)); +tSqlExprDestroy((yypminor->yy418)); } break; - case 265: /* union */ + case 266: /* union */ { -destroyAllSqlNode((yypminor->yy221)); +destroyAllSqlNode((yypminor->yy345)); } break; - case 275: /* sortitem */ + case 277: /* sortitem */ { -tVariantDestroy(&(yypminor->yy106)); +tVariantDestroy(&(yypminor->yy2)); } break; /********* End destructor definitions *****************************************/ @@ -1661,13 +1697,12 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static unsigned int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ +static YYACTIONTYPE yy_find_shift_action( + YYCODETYPE iLookAhead, /* The look-ahead token */ + YYACTIONTYPE stateno /* Current state number */ ){ int i; - int stateno = pParser->yytos->stateno; - + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1675,15 +1710,19 @@ static unsigned int yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); + assert( i>=0 ); + assert( i<=YY_ACTTAB_COUNT ); + assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; + assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", @@ -1698,15 +1737,8 @@ static unsigned int yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j0 - ){ + assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); + if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1720,6 +1752,7 @@ static unsigned int yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ + assert( i>=0 && iyytos; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; + yytos->stateno = yyNewState; + yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ -} yyRuleInfo[] = { - { 199, -1 }, /* (0) program ::= cmd */ - { 200, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 200, -2 }, /* (2) cmd ::= SHOW TOPICS */ - { 200, -2 }, /* (3) cmd ::= SHOW FUNCTIONS */ - { 200, -2 }, /* (4) cmd ::= SHOW MNODES */ - { 200, -2 }, /* (5) cmd ::= SHOW DNODES */ - { 200, -2 }, /* (6) cmd ::= SHOW ACCOUNTS */ - { 200, -2 }, /* (7) cmd ::= SHOW USERS */ - { 200, -2 }, /* (8) cmd ::= SHOW MODULES */ - { 200, -2 }, /* (9) cmd ::= SHOW QUERIES */ - { 200, -2 }, /* (10) cmd ::= SHOW CONNECTIONS */ - { 200, -2 }, /* (11) cmd ::= SHOW STREAMS */ - { 200, -2 }, /* (12) cmd ::= SHOW VARIABLES */ - { 200, -2 }, /* (13) cmd ::= SHOW SCORES */ - { 200, -2 }, /* (14) cmd ::= SHOW GRANTS */ - { 200, -2 }, /* (15) cmd ::= SHOW VNODES */ - { 200, -3 }, /* (16) cmd ::= SHOW VNODES ids */ - { 202, 0 }, /* (17) dbPrefix ::= */ - { 202, -2 }, /* (18) dbPrefix ::= ids DOT */ - { 203, 0 }, /* (19) cpxName ::= */ - { 203, -2 }, /* (20) cpxName ::= DOT ids */ - { 200, -5 }, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 200, -5 }, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ - { 200, -4 }, /* (23) cmd ::= SHOW CREATE DATABASE ids */ - { 200, -3 }, /* (24) cmd ::= SHOW dbPrefix TABLES */ - { 200, -5 }, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 200, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */ - { 200, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 200, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - { 200, -4 }, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 200, -5 }, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ - { 200, -5 }, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ - { 200, -4 }, /* (32) cmd ::= DROP DATABASE ifexists ids */ - { 200, -4 }, /* (33) cmd ::= DROP TOPIC ifexists ids */ - { 200, -3 }, /* (34) cmd ::= DROP FUNCTION ids */ - { 200, -3 }, /* (35) cmd ::= DROP DNODE ids */ - { 200, -3 }, /* (36) cmd ::= DROP USER ids */ - { 200, -3 }, /* (37) cmd ::= DROP ACCOUNT ids */ - { 200, -2 }, /* (38) cmd ::= USE ids */ - { 200, -3 }, /* (39) cmd ::= DESCRIBE ids cpxName */ - { 200, -3 }, /* (40) cmd ::= DESC ids cpxName */ - { 200, -5 }, /* (41) cmd ::= ALTER USER ids PASS ids */ - { 200, -5 }, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 200, -4 }, /* (43) cmd ::= ALTER DNODE ids ids */ - { 200, -5 }, /* (44) cmd ::= ALTER DNODE ids ids ids */ - { 200, -3 }, /* (45) cmd ::= ALTER LOCAL ids */ - { 200, -4 }, /* (46) cmd ::= ALTER LOCAL ids ids */ - { 200, -4 }, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 200, -4 }, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ - { 200, -4 }, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 200, -6 }, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 200, -6 }, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ - { 201, -1 }, /* (52) ids ::= ID */ - { 201, -1 }, /* (53) ids ::= STRING */ - { 204, -2 }, /* (54) ifexists ::= IF EXISTS */ - { 204, 0 }, /* (55) ifexists ::= */ - { 209, -3 }, /* (56) ifnotexists ::= IF NOT EXISTS */ - { 209, 0 }, /* (57) ifnotexists ::= */ - { 200, -3 }, /* (58) cmd ::= CREATE DNODE ids */ - { 200, -6 }, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 200, -5 }, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 200, -5 }, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ - { 200, -8 }, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 200, -9 }, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ - { 200, -5 }, /* (64) cmd ::= CREATE USER ids PASS ids */ - { 213, 0 }, /* (65) bufsize ::= */ - { 213, -2 }, /* (66) bufsize ::= BUFSIZE INTEGER */ - { 214, 0 }, /* (67) pps ::= */ - { 214, -2 }, /* (68) pps ::= PPS INTEGER */ - { 215, 0 }, /* (69) tseries ::= */ - { 215, -2 }, /* (70) tseries ::= TSERIES INTEGER */ - { 216, 0 }, /* (71) dbs ::= */ - { 216, -2 }, /* (72) dbs ::= DBS INTEGER */ - { 217, 0 }, /* (73) streams ::= */ - { 217, -2 }, /* (74) streams ::= STREAMS INTEGER */ - { 218, 0 }, /* (75) storage ::= */ - { 218, -2 }, /* (76) storage ::= STORAGE INTEGER */ - { 219, 0 }, /* (77) qtime ::= */ - { 219, -2 }, /* (78) qtime ::= QTIME INTEGER */ - { 220, 0 }, /* (79) users ::= */ - { 220, -2 }, /* (80) users ::= USERS INTEGER */ - { 221, 0 }, /* (81) conns ::= */ - { 221, -2 }, /* (82) conns ::= CONNS INTEGER */ - { 222, 0 }, /* (83) state ::= */ - { 222, -2 }, /* (84) state ::= STATE ids */ - { 207, -9 }, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 223, -3 }, /* (86) intitemlist ::= intitemlist COMMA intitem */ - { 223, -1 }, /* (87) intitemlist ::= intitem */ - { 224, -1 }, /* (88) intitem ::= INTEGER */ - { 225, -2 }, /* (89) keep ::= KEEP intitemlist */ - { 226, -2 }, /* (90) cache ::= CACHE INTEGER */ - { 227, -2 }, /* (91) replica ::= REPLICA INTEGER */ - { 228, -2 }, /* (92) quorum ::= QUORUM INTEGER */ - { 229, -2 }, /* (93) days ::= DAYS INTEGER */ - { 230, -2 }, /* (94) minrows ::= MINROWS INTEGER */ - { 231, -2 }, /* (95) maxrows ::= MAXROWS INTEGER */ - { 232, -2 }, /* (96) blocks ::= BLOCKS INTEGER */ - { 233, -2 }, /* (97) ctime ::= CTIME INTEGER */ - { 234, -2 }, /* (98) wal ::= WAL INTEGER */ - { 235, -2 }, /* (99) fsync ::= FSYNC INTEGER */ - { 236, -2 }, /* (100) comp ::= COMP INTEGER */ - { 237, -2 }, /* (101) prec ::= PRECISION STRING */ - { 238, -2 }, /* (102) update ::= UPDATE INTEGER */ - { 239, -2 }, /* (103) cachelast ::= CACHELAST INTEGER */ - { 240, -2 }, /* (104) partitions ::= PARTITIONS INTEGER */ - { 210, 0 }, /* (105) db_optr ::= */ - { 210, -2 }, /* (106) db_optr ::= db_optr cache */ - { 210, -2 }, /* (107) db_optr ::= db_optr replica */ - { 210, -2 }, /* (108) db_optr ::= db_optr quorum */ - { 210, -2 }, /* (109) db_optr ::= db_optr days */ - { 210, -2 }, /* (110) db_optr ::= db_optr minrows */ - { 210, -2 }, /* (111) db_optr ::= db_optr maxrows */ - { 210, -2 }, /* (112) db_optr ::= db_optr blocks */ - { 210, -2 }, /* (113) db_optr ::= db_optr ctime */ - { 210, -2 }, /* (114) db_optr ::= db_optr wal */ - { 210, -2 }, /* (115) db_optr ::= db_optr fsync */ - { 210, -2 }, /* (116) db_optr ::= db_optr comp */ - { 210, -2 }, /* (117) db_optr ::= db_optr prec */ - { 210, -2 }, /* (118) db_optr ::= db_optr keep */ - { 210, -2 }, /* (119) db_optr ::= db_optr update */ - { 210, -2 }, /* (120) db_optr ::= db_optr cachelast */ - { 211, -1 }, /* (121) topic_optr ::= db_optr */ - { 211, -2 }, /* (122) topic_optr ::= topic_optr partitions */ - { 205, 0 }, /* (123) alter_db_optr ::= */ - { 205, -2 }, /* (124) alter_db_optr ::= alter_db_optr replica */ - { 205, -2 }, /* (125) alter_db_optr ::= alter_db_optr quorum */ - { 205, -2 }, /* (126) alter_db_optr ::= alter_db_optr keep */ - { 205, -2 }, /* (127) alter_db_optr ::= alter_db_optr blocks */ - { 205, -2 }, /* (128) alter_db_optr ::= alter_db_optr comp */ - { 205, -2 }, /* (129) alter_db_optr ::= alter_db_optr update */ - { 205, -2 }, /* (130) alter_db_optr ::= alter_db_optr cachelast */ - { 206, -1 }, /* (131) alter_topic_optr ::= alter_db_optr */ - { 206, -2 }, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ - { 212, -1 }, /* (133) typename ::= ids */ - { 212, -4 }, /* (134) typename ::= ids LP signed RP */ - { 212, -2 }, /* (135) typename ::= ids UNSIGNED */ - { 241, -1 }, /* (136) signed ::= INTEGER */ - { 241, -2 }, /* (137) signed ::= PLUS INTEGER */ - { 241, -2 }, /* (138) signed ::= MINUS INTEGER */ - { 200, -3 }, /* (139) cmd ::= CREATE TABLE create_table_args */ - { 200, -3 }, /* (140) cmd ::= CREATE TABLE create_stable_args */ - { 200, -3 }, /* (141) cmd ::= CREATE STABLE create_stable_args */ - { 200, -3 }, /* (142) cmd ::= CREATE TABLE create_table_list */ - { 244, -1 }, /* (143) create_table_list ::= create_from_stable */ - { 244, -2 }, /* (144) create_table_list ::= create_table_list create_from_stable */ - { 242, -6 }, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 243, -10 }, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 245, -10 }, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 245, -13 }, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ - { 248, -3 }, /* (149) tagNamelist ::= tagNamelist COMMA ids */ - { 248, -1 }, /* (150) tagNamelist ::= ids */ - { 242, -5 }, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ - { 246, -3 }, /* (152) columnlist ::= columnlist COMMA column */ - { 246, -1 }, /* (153) columnlist ::= column */ - { 250, -2 }, /* (154) column ::= ids typename */ - { 247, -3 }, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ - { 247, -1 }, /* (156) tagitemlist ::= tagitem */ - { 251, -1 }, /* (157) tagitem ::= INTEGER */ - { 251, -1 }, /* (158) tagitem ::= FLOAT */ - { 251, -1 }, /* (159) tagitem ::= STRING */ - { 251, -1 }, /* (160) tagitem ::= BOOL */ - { 251, -1 }, /* (161) tagitem ::= NULL */ - { 251, -1 }, /* (162) tagitem ::= NOW */ - { 251, -2 }, /* (163) tagitem ::= MINUS INTEGER */ - { 251, -2 }, /* (164) tagitem ::= MINUS FLOAT */ - { 251, -2 }, /* (165) tagitem ::= PLUS INTEGER */ - { 251, -2 }, /* (166) tagitem ::= PLUS FLOAT */ - { 249, -14 }, /* (167) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ - { 249, -3 }, /* (168) select ::= LP select RP */ - { 265, -1 }, /* (169) union ::= select */ - { 265, -4 }, /* (170) union ::= union UNION ALL select */ - { 200, -1 }, /* (171) cmd ::= union */ - { 249, -2 }, /* (172) select ::= SELECT selcollist */ - { 266, -2 }, /* (173) sclp ::= selcollist COMMA */ - { 266, 0 }, /* (174) sclp ::= */ - { 252, -4 }, /* (175) selcollist ::= sclp distinct expr as */ - { 252, -2 }, /* (176) selcollist ::= sclp STAR */ - { 269, -2 }, /* (177) as ::= AS ids */ - { 269, -1 }, /* (178) as ::= ids */ - { 269, 0 }, /* (179) as ::= */ - { 267, -1 }, /* (180) distinct ::= DISTINCT */ - { 267, 0 }, /* (181) distinct ::= */ - { 253, -2 }, /* (182) from ::= FROM tablelist */ - { 253, -2 }, /* (183) from ::= FROM sub */ - { 271, -3 }, /* (184) sub ::= LP union RP */ - { 271, -4 }, /* (185) sub ::= LP union RP ids */ - { 271, -6 }, /* (186) sub ::= sub COMMA LP union RP ids */ - { 270, -2 }, /* (187) tablelist ::= ids cpxName */ - { 270, -3 }, /* (188) tablelist ::= ids cpxName ids */ - { 270, -4 }, /* (189) tablelist ::= tablelist COMMA ids cpxName */ - { 270, -5 }, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ - { 272, -1 }, /* (191) tmvar ::= VARIABLE */ - { 255, -4 }, /* (192) interval_option ::= intervalKey LP tmvar RP */ - { 255, -6 }, /* (193) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ - { 255, 0 }, /* (194) interval_option ::= */ - { 273, -1 }, /* (195) intervalKey ::= INTERVAL */ - { 273, -1 }, /* (196) intervalKey ::= EVERY */ - { 257, 0 }, /* (197) session_option ::= */ - { 257, -7 }, /* (198) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ - { 258, 0 }, /* (199) windowstate_option ::= */ - { 258, -4 }, /* (200) windowstate_option ::= STATE_WINDOW LP ids RP */ - { 259, 0 }, /* (201) fill_opt ::= */ - { 259, -6 }, /* (202) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 259, -4 }, /* (203) fill_opt ::= FILL LP ID RP */ - { 256, -4 }, /* (204) sliding_opt ::= SLIDING LP tmvar RP */ - { 256, 0 }, /* (205) sliding_opt ::= */ - { 262, 0 }, /* (206) orderby_opt ::= */ - { 262, -3 }, /* (207) orderby_opt ::= ORDER BY sortlist */ - { 274, -4 }, /* (208) sortlist ::= sortlist COMMA item sortorder */ - { 274, -2 }, /* (209) sortlist ::= item sortorder */ - { 276, -2 }, /* (210) item ::= ids cpxName */ - { 277, -1 }, /* (211) sortorder ::= ASC */ - { 277, -1 }, /* (212) sortorder ::= DESC */ - { 277, 0 }, /* (213) sortorder ::= */ - { 260, 0 }, /* (214) groupby_opt ::= */ - { 260, -3 }, /* (215) groupby_opt ::= GROUP BY grouplist */ - { 278, -3 }, /* (216) grouplist ::= grouplist COMMA item */ - { 278, -1 }, /* (217) grouplist ::= item */ - { 261, 0 }, /* (218) having_opt ::= */ - { 261, -2 }, /* (219) having_opt ::= HAVING expr */ - { 264, 0 }, /* (220) limit_opt ::= */ - { 264, -2 }, /* (221) limit_opt ::= LIMIT signed */ - { 264, -4 }, /* (222) limit_opt ::= LIMIT signed OFFSET signed */ - { 264, -4 }, /* (223) limit_opt ::= LIMIT signed COMMA signed */ - { 263, 0 }, /* (224) slimit_opt ::= */ - { 263, -2 }, /* (225) slimit_opt ::= SLIMIT signed */ - { 263, -4 }, /* (226) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 263, -4 }, /* (227) slimit_opt ::= SLIMIT signed COMMA signed */ - { 254, 0 }, /* (228) where_opt ::= */ - { 254, -2 }, /* (229) where_opt ::= WHERE expr */ - { 268, -3 }, /* (230) expr ::= LP expr RP */ - { 268, -1 }, /* (231) expr ::= ID */ - { 268, -3 }, /* (232) expr ::= ID DOT ID */ - { 268, -3 }, /* (233) expr ::= ID DOT STAR */ - { 268, -1 }, /* (234) expr ::= INTEGER */ - { 268, -2 }, /* (235) expr ::= MINUS INTEGER */ - { 268, -2 }, /* (236) expr ::= PLUS INTEGER */ - { 268, -1 }, /* (237) expr ::= FLOAT */ - { 268, -2 }, /* (238) expr ::= MINUS FLOAT */ - { 268, -2 }, /* (239) expr ::= PLUS FLOAT */ - { 268, -1 }, /* (240) expr ::= STRING */ - { 268, -1 }, /* (241) expr ::= NOW */ - { 268, -1 }, /* (242) expr ::= VARIABLE */ - { 268, -2 }, /* (243) expr ::= PLUS VARIABLE */ - { 268, -2 }, /* (244) expr ::= MINUS VARIABLE */ - { 268, -1 }, /* (245) expr ::= BOOL */ - { 268, -1 }, /* (246) expr ::= NULL */ - { 268, -4 }, /* (247) expr ::= ID LP exprlist RP */ - { 268, -4 }, /* (248) expr ::= ID LP STAR RP */ - { 268, -3 }, /* (249) expr ::= expr IS NULL */ - { 268, -4 }, /* (250) expr ::= expr IS NOT NULL */ - { 268, -3 }, /* (251) expr ::= expr LT expr */ - { 268, -3 }, /* (252) expr ::= expr GT expr */ - { 268, -3 }, /* (253) expr ::= expr LE expr */ - { 268, -3 }, /* (254) expr ::= expr GE expr */ - { 268, -3 }, /* (255) expr ::= expr NE expr */ - { 268, -3 }, /* (256) expr ::= expr EQ expr */ - { 268, -5 }, /* (257) expr ::= expr BETWEEN expr AND expr */ - { 268, -3 }, /* (258) expr ::= expr AND expr */ - { 268, -3 }, /* (259) expr ::= expr OR expr */ - { 268, -3 }, /* (260) expr ::= expr PLUS expr */ - { 268, -3 }, /* (261) expr ::= expr MINUS expr */ - { 268, -3 }, /* (262) expr ::= expr STAR expr */ - { 268, -3 }, /* (263) expr ::= expr SLASH expr */ - { 268, -3 }, /* (264) expr ::= expr REM expr */ - { 268, -3 }, /* (265) expr ::= expr LIKE expr */ - { 268, -3 }, /* (266) expr ::= expr MATCH expr */ - { 268, -3 }, /* (267) expr ::= expr NMATCH expr */ - { 268, -5 }, /* (268) expr ::= expr IN LP exprlist RP */ - { 208, -3 }, /* (269) exprlist ::= exprlist COMMA expritem */ - { 208, -1 }, /* (270) exprlist ::= expritem */ - { 279, -1 }, /* (271) expritem ::= expr */ - { 279, 0 }, /* (272) expritem ::= */ - { 200, -3 }, /* (273) cmd ::= RESET QUERY CACHE */ - { 200, -3 }, /* (274) cmd ::= SYNCDB ids REPLICA */ - { 200, -7 }, /* (275) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 200, -7 }, /* (276) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 200, -7 }, /* (277) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - { 200, -7 }, /* (278) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 200, -7 }, /* (279) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 200, -8 }, /* (280) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 200, -9 }, /* (281) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 200, -7 }, /* (282) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - { 200, -7 }, /* (283) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - { 200, -7 }, /* (284) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - { 200, -7 }, /* (285) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - { 200, -7 }, /* (286) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - { 200, -7 }, /* (287) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - { 200, -8 }, /* (288) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - { 200, -9 }, /* (289) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - { 200, -7 }, /* (290) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - { 200, -3 }, /* (291) cmd ::= KILL CONNECTION INTEGER */ - { 200, -5 }, /* (292) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 200, -5 }, /* (293) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side +** of that rule */ +static const YYCODETYPE yyRuleInfoLhs[] = { + 199, /* (0) program ::= cmd */ + 200, /* (1) cmd ::= SHOW DATABASES */ + 200, /* (2) cmd ::= SHOW TOPICS */ + 200, /* (3) cmd ::= SHOW FUNCTIONS */ + 200, /* (4) cmd ::= SHOW MNODES */ + 200, /* (5) cmd ::= SHOW DNODES */ + 200, /* (6) cmd ::= SHOW ACCOUNTS */ + 200, /* (7) cmd ::= SHOW USERS */ + 200, /* (8) cmd ::= SHOW MODULES */ + 200, /* (9) cmd ::= SHOW QUERIES */ + 200, /* (10) cmd ::= SHOW CONNECTIONS */ + 200, /* (11) cmd ::= SHOW STREAMS */ + 200, /* (12) cmd ::= SHOW VARIABLES */ + 200, /* (13) cmd ::= SHOW SCORES */ + 200, /* (14) cmd ::= SHOW GRANTS */ + 200, /* (15) cmd ::= SHOW VNODES */ + 200, /* (16) cmd ::= SHOW VNODES ids */ + 202, /* (17) dbPrefix ::= */ + 202, /* (18) dbPrefix ::= ids DOT */ + 203, /* (19) cpxName ::= */ + 203, /* (20) cpxName ::= DOT ids */ + 200, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + 200, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + 200, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + 200, /* (24) cmd ::= SHOW dbPrefix TABLES */ + 200, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + 200, /* (26) cmd ::= SHOW dbPrefix STABLES */ + 200, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + 200, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + 200, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ + 200, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ + 200, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ + 200, /* (32) cmd ::= DROP DATABASE ifexists ids */ + 200, /* (33) cmd ::= DROP TOPIC ifexists ids */ + 200, /* (34) cmd ::= DROP FUNCTION ids */ + 200, /* (35) cmd ::= DROP DNODE ids */ + 200, /* (36) cmd ::= DROP USER ids */ + 200, /* (37) cmd ::= DROP ACCOUNT ids */ + 200, /* (38) cmd ::= USE ids */ + 200, /* (39) cmd ::= DESCRIBE ids cpxName */ + 200, /* (40) cmd ::= DESC ids cpxName */ + 200, /* (41) cmd ::= ALTER USER ids PASS ids */ + 200, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ + 200, /* (43) cmd ::= ALTER DNODE ids ids */ + 200, /* (44) cmd ::= ALTER DNODE ids ids ids */ + 200, /* (45) cmd ::= ALTER LOCAL ids */ + 200, /* (46) cmd ::= ALTER LOCAL ids ids */ + 200, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + 200, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ + 200, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ + 200, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + 200, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ + 201, /* (52) ids ::= ID */ + 201, /* (53) ids ::= STRING */ + 204, /* (54) ifexists ::= IF EXISTS */ + 204, /* (55) ifexists ::= */ + 209, /* (56) ifnotexists ::= IF NOT EXISTS */ + 209, /* (57) ifnotexists ::= */ + 200, /* (58) cmd ::= CREATE DNODE ids */ + 200, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + 200, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + 200, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + 200, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 200, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + 200, /* (64) cmd ::= CREATE USER ids PASS ids */ + 213, /* (65) bufsize ::= */ + 213, /* (66) bufsize ::= BUFSIZE INTEGER */ + 214, /* (67) pps ::= */ + 214, /* (68) pps ::= PPS INTEGER */ + 215, /* (69) tseries ::= */ + 215, /* (70) tseries ::= TSERIES INTEGER */ + 216, /* (71) dbs ::= */ + 216, /* (72) dbs ::= DBS INTEGER */ + 217, /* (73) streams ::= */ + 217, /* (74) streams ::= STREAMS INTEGER */ + 218, /* (75) storage ::= */ + 218, /* (76) storage ::= STORAGE INTEGER */ + 219, /* (77) qtime ::= */ + 219, /* (78) qtime ::= QTIME INTEGER */ + 220, /* (79) users ::= */ + 220, /* (80) users ::= USERS INTEGER */ + 221, /* (81) conns ::= */ + 221, /* (82) conns ::= CONNS INTEGER */ + 222, /* (83) state ::= */ + 222, /* (84) state ::= STATE ids */ + 207, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + 223, /* (86) intitemlist ::= intitemlist COMMA intitem */ + 223, /* (87) intitemlist ::= intitem */ + 224, /* (88) intitem ::= INTEGER */ + 225, /* (89) keep ::= KEEP intitemlist */ + 226, /* (90) cache ::= CACHE INTEGER */ + 227, /* (91) replica ::= REPLICA INTEGER */ + 228, /* (92) quorum ::= QUORUM INTEGER */ + 229, /* (93) days ::= DAYS INTEGER */ + 230, /* (94) minrows ::= MINROWS INTEGER */ + 231, /* (95) maxrows ::= MAXROWS INTEGER */ + 232, /* (96) blocks ::= BLOCKS INTEGER */ + 233, /* (97) ctime ::= CTIME INTEGER */ + 234, /* (98) wal ::= WAL INTEGER */ + 235, /* (99) fsync ::= FSYNC INTEGER */ + 236, /* (100) comp ::= COMP INTEGER */ + 237, /* (101) prec ::= PRECISION STRING */ + 238, /* (102) update ::= UPDATE INTEGER */ + 239, /* (103) cachelast ::= CACHELAST INTEGER */ + 240, /* (104) partitions ::= PARTITIONS INTEGER */ + 210, /* (105) db_optr ::= */ + 210, /* (106) db_optr ::= db_optr cache */ + 210, /* (107) db_optr ::= db_optr replica */ + 210, /* (108) db_optr ::= db_optr quorum */ + 210, /* (109) db_optr ::= db_optr days */ + 210, /* (110) db_optr ::= db_optr minrows */ + 210, /* (111) db_optr ::= db_optr maxrows */ + 210, /* (112) db_optr ::= db_optr blocks */ + 210, /* (113) db_optr ::= db_optr ctime */ + 210, /* (114) db_optr ::= db_optr wal */ + 210, /* (115) db_optr ::= db_optr fsync */ + 210, /* (116) db_optr ::= db_optr comp */ + 210, /* (117) db_optr ::= db_optr prec */ + 210, /* (118) db_optr ::= db_optr keep */ + 210, /* (119) db_optr ::= db_optr update */ + 210, /* (120) db_optr ::= db_optr cachelast */ + 211, /* (121) topic_optr ::= db_optr */ + 211, /* (122) topic_optr ::= topic_optr partitions */ + 205, /* (123) alter_db_optr ::= */ + 205, /* (124) alter_db_optr ::= alter_db_optr replica */ + 205, /* (125) alter_db_optr ::= alter_db_optr quorum */ + 205, /* (126) alter_db_optr ::= alter_db_optr keep */ + 205, /* (127) alter_db_optr ::= alter_db_optr blocks */ + 205, /* (128) alter_db_optr ::= alter_db_optr comp */ + 205, /* (129) alter_db_optr ::= alter_db_optr update */ + 205, /* (130) alter_db_optr ::= alter_db_optr cachelast */ + 206, /* (131) alter_topic_optr ::= alter_db_optr */ + 206, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ + 212, /* (133) typename ::= ids */ + 212, /* (134) typename ::= ids LP signed RP */ + 212, /* (135) typename ::= ids UNSIGNED */ + 241, /* (136) signed ::= INTEGER */ + 241, /* (137) signed ::= PLUS INTEGER */ + 241, /* (138) signed ::= MINUS INTEGER */ + 200, /* (139) cmd ::= CREATE TABLE create_table_args */ + 200, /* (140) cmd ::= CREATE TABLE create_stable_args */ + 200, /* (141) cmd ::= CREATE STABLE create_stable_args */ + 200, /* (142) cmd ::= CREATE TABLE create_table_list */ + 244, /* (143) create_table_list ::= create_from_stable */ + 244, /* (144) create_table_list ::= create_table_list create_from_stable */ + 242, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + 243, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + 245, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + 245, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + 248, /* (149) tagNamelist ::= tagNamelist COMMA ids */ + 248, /* (150) tagNamelist ::= ids */ + 242, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ + 246, /* (152) columnlist ::= columnlist COMMA column */ + 246, /* (153) columnlist ::= column */ + 250, /* (154) column ::= ids typename */ + 247, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ + 247, /* (156) tagitemlist ::= tagitem */ + 251, /* (157) tagitem ::= INTEGER */ + 251, /* (158) tagitem ::= FLOAT */ + 251, /* (159) tagitem ::= STRING */ + 251, /* (160) tagitem ::= BOOL */ + 251, /* (161) tagitem ::= NULL */ + 251, /* (162) tagitem ::= NOW */ + 251, /* (163) tagitem ::= MINUS INTEGER */ + 251, /* (164) tagitem ::= MINUS FLOAT */ + 251, /* (165) tagitem ::= PLUS INTEGER */ + 251, /* (166) tagitem ::= PLUS FLOAT */ + 249, /* (167) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + 249, /* (168) select ::= LP select RP */ + 266, /* (169) union ::= select */ + 266, /* (170) union ::= union UNION ALL select */ + 200, /* (171) cmd ::= union */ + 249, /* (172) select ::= SELECT selcollist */ + 267, /* (173) sclp ::= selcollist COMMA */ + 267, /* (174) sclp ::= */ + 252, /* (175) selcollist ::= sclp distinct expr as */ + 252, /* (176) selcollist ::= sclp STAR */ + 270, /* (177) as ::= AS ids */ + 270, /* (178) as ::= ids */ + 270, /* (179) as ::= */ + 268, /* (180) distinct ::= DISTINCT */ + 268, /* (181) distinct ::= */ + 253, /* (182) from ::= FROM tablelist */ + 253, /* (183) from ::= FROM sub */ + 272, /* (184) sub ::= LP union RP */ + 272, /* (185) sub ::= LP union RP ids */ + 272, /* (186) sub ::= sub COMMA LP union RP ids */ + 271, /* (187) tablelist ::= ids cpxName */ + 271, /* (188) tablelist ::= ids cpxName ids */ + 271, /* (189) tablelist ::= tablelist COMMA ids cpxName */ + 271, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ + 273, /* (191) tmvar ::= VARIABLE */ + 274, /* (192) timestamp ::= INTEGER */ + 274, /* (193) timestamp ::= MINUS INTEGER */ + 274, /* (194) timestamp ::= PLUS INTEGER */ + 274, /* (195) timestamp ::= STRING */ + 274, /* (196) timestamp ::= NOW */ + 274, /* (197) timestamp ::= NOW PLUS VARIABLE */ + 274, /* (198) timestamp ::= NOW MINUS VARIABLE */ + 255, /* (199) range_option ::= */ + 255, /* (200) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + 256, /* (201) interval_option ::= intervalKey LP tmvar RP */ + 256, /* (202) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 256, /* (203) interval_option ::= */ + 275, /* (204) intervalKey ::= INTERVAL */ + 275, /* (205) intervalKey ::= EVERY */ + 258, /* (206) session_option ::= */ + 258, /* (207) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 259, /* (208) windowstate_option ::= */ + 259, /* (209) windowstate_option ::= STATE_WINDOW LP ids RP */ + 260, /* (210) fill_opt ::= */ + 260, /* (211) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + 260, /* (212) fill_opt ::= FILL LP ID RP */ + 257, /* (213) sliding_opt ::= SLIDING LP tmvar RP */ + 257, /* (214) sliding_opt ::= */ + 263, /* (215) orderby_opt ::= */ + 263, /* (216) orderby_opt ::= ORDER BY sortlist */ + 276, /* (217) sortlist ::= sortlist COMMA item sortorder */ + 276, /* (218) sortlist ::= item sortorder */ + 278, /* (219) item ::= ids cpxName */ + 279, /* (220) sortorder ::= ASC */ + 279, /* (221) sortorder ::= DESC */ + 279, /* (222) sortorder ::= */ + 261, /* (223) groupby_opt ::= */ + 261, /* (224) groupby_opt ::= GROUP BY grouplist */ + 280, /* (225) grouplist ::= grouplist COMMA item */ + 280, /* (226) grouplist ::= item */ + 262, /* (227) having_opt ::= */ + 262, /* (228) having_opt ::= HAVING expr */ + 265, /* (229) limit_opt ::= */ + 265, /* (230) limit_opt ::= LIMIT signed */ + 265, /* (231) limit_opt ::= LIMIT signed OFFSET signed */ + 265, /* (232) limit_opt ::= LIMIT signed COMMA signed */ + 264, /* (233) slimit_opt ::= */ + 264, /* (234) slimit_opt ::= SLIMIT signed */ + 264, /* (235) slimit_opt ::= SLIMIT signed SOFFSET signed */ + 264, /* (236) slimit_opt ::= SLIMIT signed COMMA signed */ + 254, /* (237) where_opt ::= */ + 254, /* (238) where_opt ::= WHERE expr */ + 269, /* (239) expr ::= LP expr RP */ + 269, /* (240) expr ::= ID */ + 269, /* (241) expr ::= ID DOT ID */ + 269, /* (242) expr ::= ID DOT STAR */ + 269, /* (243) expr ::= INTEGER */ + 269, /* (244) expr ::= MINUS INTEGER */ + 269, /* (245) expr ::= PLUS INTEGER */ + 269, /* (246) expr ::= FLOAT */ + 269, /* (247) expr ::= MINUS FLOAT */ + 269, /* (248) expr ::= PLUS FLOAT */ + 269, /* (249) expr ::= STRING */ + 269, /* (250) expr ::= NOW */ + 269, /* (251) expr ::= VARIABLE */ + 269, /* (252) expr ::= PLUS VARIABLE */ + 269, /* (253) expr ::= MINUS VARIABLE */ + 269, /* (254) expr ::= BOOL */ + 269, /* (255) expr ::= NULL */ + 269, /* (256) expr ::= ID LP exprlist RP */ + 269, /* (257) expr ::= ID LP STAR RP */ + 269, /* (258) expr ::= expr IS NULL */ + 269, /* (259) expr ::= expr IS NOT NULL */ + 269, /* (260) expr ::= expr LT expr */ + 269, /* (261) expr ::= expr GT expr */ + 269, /* (262) expr ::= expr LE expr */ + 269, /* (263) expr ::= expr GE expr */ + 269, /* (264) expr ::= expr NE expr */ + 269, /* (265) expr ::= expr EQ expr */ + 269, /* (266) expr ::= expr BETWEEN expr AND expr */ + 269, /* (267) expr ::= expr AND expr */ + 269, /* (268) expr ::= expr OR expr */ + 269, /* (269) expr ::= expr PLUS expr */ + 269, /* (270) expr ::= expr MINUS expr */ + 269, /* (271) expr ::= expr STAR expr */ + 269, /* (272) expr ::= expr SLASH expr */ + 269, /* (273) expr ::= expr REM expr */ + 269, /* (274) expr ::= expr LIKE expr */ + 269, /* (275) expr ::= expr MATCH expr */ + 269, /* (276) expr ::= expr NMATCH expr */ + 269, /* (277) expr ::= expr IN LP exprlist RP */ + 208, /* (278) exprlist ::= exprlist COMMA expritem */ + 208, /* (279) exprlist ::= expritem */ + 281, /* (280) expritem ::= expr */ + 281, /* (281) expritem ::= */ + 200, /* (282) cmd ::= RESET QUERY CACHE */ + 200, /* (283) cmd ::= SYNCDB ids REPLICA */ + 200, /* (284) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 200, /* (285) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 200, /* (286) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 200, /* (287) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 200, /* (288) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 200, /* (289) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 200, /* (290) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 200, /* (291) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 200, /* (292) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 200, /* (293) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 200, /* (294) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 200, /* (295) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 200, /* (296) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 200, /* (297) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 200, /* (298) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 200, /* (299) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 200, /* (300) cmd ::= KILL CONNECTION INTEGER */ + 200, /* (301) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 200, /* (302) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +}; + +/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number +** of symbols on the right-hand side of that rule. */ +static const signed char yyRuleInfoNRhs[] = { + -1, /* (0) program ::= cmd */ + -2, /* (1) cmd ::= SHOW DATABASES */ + -2, /* (2) cmd ::= SHOW TOPICS */ + -2, /* (3) cmd ::= SHOW FUNCTIONS */ + -2, /* (4) cmd ::= SHOW MNODES */ + -2, /* (5) cmd ::= SHOW DNODES */ + -2, /* (6) cmd ::= SHOW ACCOUNTS */ + -2, /* (7) cmd ::= SHOW USERS */ + -2, /* (8) cmd ::= SHOW MODULES */ + -2, /* (9) cmd ::= SHOW QUERIES */ + -2, /* (10) cmd ::= SHOW CONNECTIONS */ + -2, /* (11) cmd ::= SHOW STREAMS */ + -2, /* (12) cmd ::= SHOW VARIABLES */ + -2, /* (13) cmd ::= SHOW SCORES */ + -2, /* (14) cmd ::= SHOW GRANTS */ + -2, /* (15) cmd ::= SHOW VNODES */ + -3, /* (16) cmd ::= SHOW VNODES ids */ + 0, /* (17) dbPrefix ::= */ + -2, /* (18) dbPrefix ::= ids DOT */ + 0, /* (19) cpxName ::= */ + -2, /* (20) cpxName ::= DOT ids */ + -5, /* (21) cmd ::= SHOW CREATE TABLE ids cpxName */ + -5, /* (22) cmd ::= SHOW CREATE STABLE ids cpxName */ + -4, /* (23) cmd ::= SHOW CREATE DATABASE ids */ + -3, /* (24) cmd ::= SHOW dbPrefix TABLES */ + -5, /* (25) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + -3, /* (26) cmd ::= SHOW dbPrefix STABLES */ + -5, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + -3, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ + -4, /* (29) cmd ::= SHOW dbPrefix VGROUPS ids */ + -5, /* (30) cmd ::= DROP TABLE ifexists ids cpxName */ + -5, /* (31) cmd ::= DROP STABLE ifexists ids cpxName */ + -4, /* (32) cmd ::= DROP DATABASE ifexists ids */ + -4, /* (33) cmd ::= DROP TOPIC ifexists ids */ + -3, /* (34) cmd ::= DROP FUNCTION ids */ + -3, /* (35) cmd ::= DROP DNODE ids */ + -3, /* (36) cmd ::= DROP USER ids */ + -3, /* (37) cmd ::= DROP ACCOUNT ids */ + -2, /* (38) cmd ::= USE ids */ + -3, /* (39) cmd ::= DESCRIBE ids cpxName */ + -3, /* (40) cmd ::= DESC ids cpxName */ + -5, /* (41) cmd ::= ALTER USER ids PASS ids */ + -5, /* (42) cmd ::= ALTER USER ids PRIVILEGE ids */ + -4, /* (43) cmd ::= ALTER DNODE ids ids */ + -5, /* (44) cmd ::= ALTER DNODE ids ids ids */ + -3, /* (45) cmd ::= ALTER LOCAL ids */ + -4, /* (46) cmd ::= ALTER LOCAL ids ids */ + -4, /* (47) cmd ::= ALTER DATABASE ids alter_db_optr */ + -4, /* (48) cmd ::= ALTER TOPIC ids alter_topic_optr */ + -4, /* (49) cmd ::= ALTER ACCOUNT ids acct_optr */ + -6, /* (50) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + -6, /* (51) cmd ::= COMPACT VNODES IN LP exprlist RP */ + -1, /* (52) ids ::= ID */ + -1, /* (53) ids ::= STRING */ + -2, /* (54) ifexists ::= IF EXISTS */ + 0, /* (55) ifexists ::= */ + -3, /* (56) ifnotexists ::= IF NOT EXISTS */ + 0, /* (57) ifnotexists ::= */ + -3, /* (58) cmd ::= CREATE DNODE ids */ + -6, /* (59) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + -5, /* (60) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + -5, /* (61) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ + -8, /* (62) cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -9, /* (63) cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ + -5, /* (64) cmd ::= CREATE USER ids PASS ids */ + 0, /* (65) bufsize ::= */ + -2, /* (66) bufsize ::= BUFSIZE INTEGER */ + 0, /* (67) pps ::= */ + -2, /* (68) pps ::= PPS INTEGER */ + 0, /* (69) tseries ::= */ + -2, /* (70) tseries ::= TSERIES INTEGER */ + 0, /* (71) dbs ::= */ + -2, /* (72) dbs ::= DBS INTEGER */ + 0, /* (73) streams ::= */ + -2, /* (74) streams ::= STREAMS INTEGER */ + 0, /* (75) storage ::= */ + -2, /* (76) storage ::= STORAGE INTEGER */ + 0, /* (77) qtime ::= */ + -2, /* (78) qtime ::= QTIME INTEGER */ + 0, /* (79) users ::= */ + -2, /* (80) users ::= USERS INTEGER */ + 0, /* (81) conns ::= */ + -2, /* (82) conns ::= CONNS INTEGER */ + 0, /* (83) state ::= */ + -2, /* (84) state ::= STATE ids */ + -9, /* (85) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + -3, /* (86) intitemlist ::= intitemlist COMMA intitem */ + -1, /* (87) intitemlist ::= intitem */ + -1, /* (88) intitem ::= INTEGER */ + -2, /* (89) keep ::= KEEP intitemlist */ + -2, /* (90) cache ::= CACHE INTEGER */ + -2, /* (91) replica ::= REPLICA INTEGER */ + -2, /* (92) quorum ::= QUORUM INTEGER */ + -2, /* (93) days ::= DAYS INTEGER */ + -2, /* (94) minrows ::= MINROWS INTEGER */ + -2, /* (95) maxrows ::= MAXROWS INTEGER */ + -2, /* (96) blocks ::= BLOCKS INTEGER */ + -2, /* (97) ctime ::= CTIME INTEGER */ + -2, /* (98) wal ::= WAL INTEGER */ + -2, /* (99) fsync ::= FSYNC INTEGER */ + -2, /* (100) comp ::= COMP INTEGER */ + -2, /* (101) prec ::= PRECISION STRING */ + -2, /* (102) update ::= UPDATE INTEGER */ + -2, /* (103) cachelast ::= CACHELAST INTEGER */ + -2, /* (104) partitions ::= PARTITIONS INTEGER */ + 0, /* (105) db_optr ::= */ + -2, /* (106) db_optr ::= db_optr cache */ + -2, /* (107) db_optr ::= db_optr replica */ + -2, /* (108) db_optr ::= db_optr quorum */ + -2, /* (109) db_optr ::= db_optr days */ + -2, /* (110) db_optr ::= db_optr minrows */ + -2, /* (111) db_optr ::= db_optr maxrows */ + -2, /* (112) db_optr ::= db_optr blocks */ + -2, /* (113) db_optr ::= db_optr ctime */ + -2, /* (114) db_optr ::= db_optr wal */ + -2, /* (115) db_optr ::= db_optr fsync */ + -2, /* (116) db_optr ::= db_optr comp */ + -2, /* (117) db_optr ::= db_optr prec */ + -2, /* (118) db_optr ::= db_optr keep */ + -2, /* (119) db_optr ::= db_optr update */ + -2, /* (120) db_optr ::= db_optr cachelast */ + -1, /* (121) topic_optr ::= db_optr */ + -2, /* (122) topic_optr ::= topic_optr partitions */ + 0, /* (123) alter_db_optr ::= */ + -2, /* (124) alter_db_optr ::= alter_db_optr replica */ + -2, /* (125) alter_db_optr ::= alter_db_optr quorum */ + -2, /* (126) alter_db_optr ::= alter_db_optr keep */ + -2, /* (127) alter_db_optr ::= alter_db_optr blocks */ + -2, /* (128) alter_db_optr ::= alter_db_optr comp */ + -2, /* (129) alter_db_optr ::= alter_db_optr update */ + -2, /* (130) alter_db_optr ::= alter_db_optr cachelast */ + -1, /* (131) alter_topic_optr ::= alter_db_optr */ + -2, /* (132) alter_topic_optr ::= alter_topic_optr partitions */ + -1, /* (133) typename ::= ids */ + -4, /* (134) typename ::= ids LP signed RP */ + -2, /* (135) typename ::= ids UNSIGNED */ + -1, /* (136) signed ::= INTEGER */ + -2, /* (137) signed ::= PLUS INTEGER */ + -2, /* (138) signed ::= MINUS INTEGER */ + -3, /* (139) cmd ::= CREATE TABLE create_table_args */ + -3, /* (140) cmd ::= CREATE TABLE create_stable_args */ + -3, /* (141) cmd ::= CREATE STABLE create_stable_args */ + -3, /* (142) cmd ::= CREATE TABLE create_table_list */ + -1, /* (143) create_table_list ::= create_from_stable */ + -2, /* (144) create_table_list ::= create_table_list create_from_stable */ + -6, /* (145) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + -10, /* (146) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + -10, /* (147) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + -13, /* (148) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ + -3, /* (149) tagNamelist ::= tagNamelist COMMA ids */ + -1, /* (150) tagNamelist ::= ids */ + -5, /* (151) create_table_args ::= ifnotexists ids cpxName AS select */ + -3, /* (152) columnlist ::= columnlist COMMA column */ + -1, /* (153) columnlist ::= column */ + -2, /* (154) column ::= ids typename */ + -3, /* (155) tagitemlist ::= tagitemlist COMMA tagitem */ + -1, /* (156) tagitemlist ::= tagitem */ + -1, /* (157) tagitem ::= INTEGER */ + -1, /* (158) tagitem ::= FLOAT */ + -1, /* (159) tagitem ::= STRING */ + -1, /* (160) tagitem ::= BOOL */ + -1, /* (161) tagitem ::= NULL */ + -1, /* (162) tagitem ::= NOW */ + -2, /* (163) tagitem ::= MINUS INTEGER */ + -2, /* (164) tagitem ::= MINUS FLOAT */ + -2, /* (165) tagitem ::= PLUS INTEGER */ + -2, /* (166) tagitem ::= PLUS FLOAT */ + -15, /* (167) select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + -3, /* (168) select ::= LP select RP */ + -1, /* (169) union ::= select */ + -4, /* (170) union ::= union UNION ALL select */ + -1, /* (171) cmd ::= union */ + -2, /* (172) select ::= SELECT selcollist */ + -2, /* (173) sclp ::= selcollist COMMA */ + 0, /* (174) sclp ::= */ + -4, /* (175) selcollist ::= sclp distinct expr as */ + -2, /* (176) selcollist ::= sclp STAR */ + -2, /* (177) as ::= AS ids */ + -1, /* (178) as ::= ids */ + 0, /* (179) as ::= */ + -1, /* (180) distinct ::= DISTINCT */ + 0, /* (181) distinct ::= */ + -2, /* (182) from ::= FROM tablelist */ + -2, /* (183) from ::= FROM sub */ + -3, /* (184) sub ::= LP union RP */ + -4, /* (185) sub ::= LP union RP ids */ + -6, /* (186) sub ::= sub COMMA LP union RP ids */ + -2, /* (187) tablelist ::= ids cpxName */ + -3, /* (188) tablelist ::= ids cpxName ids */ + -4, /* (189) tablelist ::= tablelist COMMA ids cpxName */ + -5, /* (190) tablelist ::= tablelist COMMA ids cpxName ids */ + -1, /* (191) tmvar ::= VARIABLE */ + -1, /* (192) timestamp ::= INTEGER */ + -2, /* (193) timestamp ::= MINUS INTEGER */ + -2, /* (194) timestamp ::= PLUS INTEGER */ + -1, /* (195) timestamp ::= STRING */ + -1, /* (196) timestamp ::= NOW */ + -3, /* (197) timestamp ::= NOW PLUS VARIABLE */ + -3, /* (198) timestamp ::= NOW MINUS VARIABLE */ + 0, /* (199) range_option ::= */ + -6, /* (200) range_option ::= RANGE LP timestamp COMMA timestamp RP */ + -4, /* (201) interval_option ::= intervalKey LP tmvar RP */ + -6, /* (202) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ + 0, /* (203) interval_option ::= */ + -1, /* (204) intervalKey ::= INTERVAL */ + -1, /* (205) intervalKey ::= EVERY */ + 0, /* (206) session_option ::= */ + -7, /* (207) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + 0, /* (208) windowstate_option ::= */ + -4, /* (209) windowstate_option ::= STATE_WINDOW LP ids RP */ + 0, /* (210) fill_opt ::= */ + -6, /* (211) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + -4, /* (212) fill_opt ::= FILL LP ID RP */ + -4, /* (213) sliding_opt ::= SLIDING LP tmvar RP */ + 0, /* (214) sliding_opt ::= */ + 0, /* (215) orderby_opt ::= */ + -3, /* (216) orderby_opt ::= ORDER BY sortlist */ + -4, /* (217) sortlist ::= sortlist COMMA item sortorder */ + -2, /* (218) sortlist ::= item sortorder */ + -2, /* (219) item ::= ids cpxName */ + -1, /* (220) sortorder ::= ASC */ + -1, /* (221) sortorder ::= DESC */ + 0, /* (222) sortorder ::= */ + 0, /* (223) groupby_opt ::= */ + -3, /* (224) groupby_opt ::= GROUP BY grouplist */ + -3, /* (225) grouplist ::= grouplist COMMA item */ + -1, /* (226) grouplist ::= item */ + 0, /* (227) having_opt ::= */ + -2, /* (228) having_opt ::= HAVING expr */ + 0, /* (229) limit_opt ::= */ + -2, /* (230) limit_opt ::= LIMIT signed */ + -4, /* (231) limit_opt ::= LIMIT signed OFFSET signed */ + -4, /* (232) limit_opt ::= LIMIT signed COMMA signed */ + 0, /* (233) slimit_opt ::= */ + -2, /* (234) slimit_opt ::= SLIMIT signed */ + -4, /* (235) slimit_opt ::= SLIMIT signed SOFFSET signed */ + -4, /* (236) slimit_opt ::= SLIMIT signed COMMA signed */ + 0, /* (237) where_opt ::= */ + -2, /* (238) where_opt ::= WHERE expr */ + -3, /* (239) expr ::= LP expr RP */ + -1, /* (240) expr ::= ID */ + -3, /* (241) expr ::= ID DOT ID */ + -3, /* (242) expr ::= ID DOT STAR */ + -1, /* (243) expr ::= INTEGER */ + -2, /* (244) expr ::= MINUS INTEGER */ + -2, /* (245) expr ::= PLUS INTEGER */ + -1, /* (246) expr ::= FLOAT */ + -2, /* (247) expr ::= MINUS FLOAT */ + -2, /* (248) expr ::= PLUS FLOAT */ + -1, /* (249) expr ::= STRING */ + -1, /* (250) expr ::= NOW */ + -1, /* (251) expr ::= VARIABLE */ + -2, /* (252) expr ::= PLUS VARIABLE */ + -2, /* (253) expr ::= MINUS VARIABLE */ + -1, /* (254) expr ::= BOOL */ + -1, /* (255) expr ::= NULL */ + -4, /* (256) expr ::= ID LP exprlist RP */ + -4, /* (257) expr ::= ID LP STAR RP */ + -3, /* (258) expr ::= expr IS NULL */ + -4, /* (259) expr ::= expr IS NOT NULL */ + -3, /* (260) expr ::= expr LT expr */ + -3, /* (261) expr ::= expr GT expr */ + -3, /* (262) expr ::= expr LE expr */ + -3, /* (263) expr ::= expr GE expr */ + -3, /* (264) expr ::= expr NE expr */ + -3, /* (265) expr ::= expr EQ expr */ + -5, /* (266) expr ::= expr BETWEEN expr AND expr */ + -3, /* (267) expr ::= expr AND expr */ + -3, /* (268) expr ::= expr OR expr */ + -3, /* (269) expr ::= expr PLUS expr */ + -3, /* (270) expr ::= expr MINUS expr */ + -3, /* (271) expr ::= expr STAR expr */ + -3, /* (272) expr ::= expr SLASH expr */ + -3, /* (273) expr ::= expr REM expr */ + -3, /* (274) expr ::= expr LIKE expr */ + -3, /* (275) expr ::= expr MATCH expr */ + -3, /* (276) expr ::= expr NMATCH expr */ + -5, /* (277) expr ::= expr IN LP exprlist RP */ + -3, /* (278) exprlist ::= exprlist COMMA expritem */ + -1, /* (279) exprlist ::= expritem */ + -1, /* (280) expritem ::= expr */ + 0, /* (281) expritem ::= */ + -3, /* (282) cmd ::= RESET QUERY CACHE */ + -3, /* (283) cmd ::= SYNCDB ids REPLICA */ + -7, /* (284) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (285) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (286) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (287) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (288) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (289) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (290) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (291) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (292) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (293) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (294) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (295) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (296) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (297) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (298) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (299) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (300) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (301) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (302) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2151,30 +2499,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static void yy_reduce( +static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ + ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - int yyact; /* The next action */ + YYACTIONTYPE yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH; + ParseARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfo[yyruleno].nrhs; + yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno); + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2192,13 +2544,19 @@ static void yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - return; + /* The call to yyStackOverflow() above pops the stack until it is + ** empty, causing the main parser loop to exit. So the return value + ** is never used and does not matter. */ + return 0; } yymsp = yypParser->yytos; } @@ -2396,16 +2754,16 @@ static void yy_reduce( break; case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 48: /* cmd ::= ALTER TOPIC ids alter_topic_optr */ yytestcase(yyruleno==48); -{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy142, &t);} +{ SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy10, &t);} break; case 49: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy491);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy427);} break; case 50: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy491);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy427);} break; case 51: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ -{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy221);} +{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy345);} break; case 52: /* ids ::= ID */ case 53: /* ids ::= STRING */ yytestcase(yyruleno==53); @@ -2427,17 +2785,17 @@ static void yy_reduce( { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 59: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy491);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy427);} break; case 60: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 61: /* cmd ::= CREATE TOPIC ifnotexists ids topic_optr */ yytestcase(yyruleno==61); -{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy142, &yymsp[-2].minor.yy0);} +{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy10, &yymsp[-2].minor.yy0);} break; case 62: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy503, &yymsp[0].minor.yy0, 1);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy487, &yymsp[0].minor.yy0, 1);} break; case 63: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ -{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy503, &yymsp[0].minor.yy0, 2);} +{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy487, &yymsp[0].minor.yy0, 2);} break; case 64: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2468,38 +2826,38 @@ static void yy_reduce( break; case 85: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy491.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy491.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy491.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy491.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy491.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy491.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy491.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy491.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy491.stat = yymsp[0].minor.yy0; + yylhsminor.yy427.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy427.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy427.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy427.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy427.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy427.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy427.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy427.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy427.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy491 = yylhsminor.yy491; + yymsp[-8].minor.yy427 = yylhsminor.yy427; break; case 86: /* intitemlist ::= intitemlist COMMA intitem */ case 155: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==155); -{ yylhsminor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); } - yymsp[-2].minor.yy221 = yylhsminor.yy221; +{ yylhsminor.yy345 = tVariantListAppend(yymsp[-2].minor.yy345, &yymsp[0].minor.yy2, -1); } + yymsp[-2].minor.yy345 = yylhsminor.yy345; break; case 87: /* intitemlist ::= intitem */ case 156: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==156); -{ yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); } - yymsp[0].minor.yy221 = yylhsminor.yy221; +{ yylhsminor.yy345 = tVariantListAppend(NULL, &yymsp[0].minor.yy2, -1); } + yymsp[0].minor.yy345 = yylhsminor.yy345; break; case 88: /* intitem ::= INTEGER */ case 157: /* tagitem ::= INTEGER */ yytestcase(yyruleno==157); case 158: /* tagitem ::= FLOAT */ yytestcase(yyruleno==158); case 159: /* tagitem ::= STRING */ yytestcase(yyruleno==159); case 160: /* tagitem ::= BOOL */ yytestcase(yyruleno==160); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy106, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy106 = yylhsminor.yy106; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy2 = yylhsminor.yy2; break; case 89: /* keep ::= KEEP intitemlist */ -{ yymsp[-1].minor.yy221 = yymsp[0].minor.yy221; } +{ yymsp[-1].minor.yy345 = yymsp[0].minor.yy345; } break; case 90: /* cache ::= CACHE INTEGER */ case 91: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==91); @@ -2519,221 +2877,221 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 105: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy142); yymsp[1].minor.yy142.dbType = TSDB_DB_TYPE_DEFAULT;} +{setDefaultCreateDbOption(&yymsp[1].minor.yy10); yymsp[1].minor.yy10.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 106: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 107: /* db_optr ::= db_optr replica */ case 124: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==124); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 108: /* db_optr ::= db_optr quorum */ case 125: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==125); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 109: /* db_optr ::= db_optr days */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 110: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 111: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 112: /* db_optr ::= db_optr blocks */ case 127: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==127); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 113: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 114: /* db_optr ::= db_optr wal */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 115: /* db_optr ::= db_optr fsync */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 116: /* db_optr ::= db_optr comp */ case 128: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==128); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 117: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 118: /* db_optr ::= db_optr keep */ case 126: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==126); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.keep = yymsp[0].minor.yy221; } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.keep = yymsp[0].minor.yy345; } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 119: /* db_optr ::= db_optr update */ case 129: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==129); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 120: /* db_optr ::= db_optr cachelast */ case 130: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==130); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 121: /* topic_optr ::= db_optr */ case 131: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==131); -{ yylhsminor.yy142 = yymsp[0].minor.yy142; yylhsminor.yy142.dbType = TSDB_DB_TYPE_TOPIC; } - yymsp[0].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[0].minor.yy10; yylhsminor.yy10.dbType = TSDB_DB_TYPE_TOPIC; } + yymsp[0].minor.yy10 = yylhsminor.yy10; break; case 122: /* topic_optr ::= topic_optr partitions */ case 132: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==132); -{ yylhsminor.yy142 = yymsp[-1].minor.yy142; yylhsminor.yy142.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy142 = yylhsminor.yy142; +{ yylhsminor.yy10 = yymsp[-1].minor.yy10; yylhsminor.yy10.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy10 = yylhsminor.yy10; break; case 123: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy142); yymsp[1].minor.yy142.dbType = TSDB_DB_TYPE_DEFAULT;} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy10); yymsp[1].minor.yy10.dbType = TSDB_DB_TYPE_DEFAULT;} break; case 133: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSetColumnType (&yylhsminor.yy503, &yymsp[0].minor.yy0); + tSetColumnType (&yylhsminor.yy487, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy503 = yylhsminor.yy503; + yymsp[0].minor.yy487 = yylhsminor.yy487; break; case 134: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy109 <= 0) { + if (yymsp[-1].minor.yy525 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSetColumnType(&yylhsminor.yy503, &yymsp[-3].minor.yy0); + tSetColumnType(&yylhsminor.yy487, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy109; // negative value of name length - tSetColumnType(&yylhsminor.yy503, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy525; // negative value of name length + tSetColumnType(&yylhsminor.yy487, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy503 = yylhsminor.yy503; + yymsp[-3].minor.yy487 = yylhsminor.yy487; break; case 135: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSetColumnType (&yylhsminor.yy503, &yymsp[-1].minor.yy0); + tSetColumnType (&yylhsminor.yy487, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy503 = yylhsminor.yy503; + yymsp[-1].minor.yy487 = yylhsminor.yy487; break; case 136: /* signed ::= INTEGER */ -{ yylhsminor.yy109 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy109 = yylhsminor.yy109; +{ yylhsminor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy525 = yylhsminor.yy525; break; case 137: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy109 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy525 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 138: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy109 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy525 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 142: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy102;} +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy170;} break; case 143: /* create_table_list ::= create_from_stable */ { SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy416); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy72); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy102 = pCreateTable; + yylhsminor.yy170 = pCreateTable; } - yymsp[0].minor.yy102 = yylhsminor.yy102; + yymsp[0].minor.yy170 = yylhsminor.yy170; break; case 144: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy102->childTableInfo, &yymsp[0].minor.yy416); - yylhsminor.yy102 = yymsp[-1].minor.yy102; + taosArrayPush(yymsp[-1].minor.yy170->childTableInfo, &yymsp[0].minor.yy72); + yylhsminor.yy170 = yymsp[-1].minor.yy170; } - yymsp[-1].minor.yy102 = yylhsminor.yy102; + yymsp[-1].minor.yy170 = yylhsminor.yy170; break; case 145: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy102 = tSetCreateTableInfo(yymsp[-1].minor.yy221, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy102, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy170 = tSetCreateTableInfo(yymsp[-1].minor.yy345, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy102 = yylhsminor.yy102; + yymsp[-5].minor.yy170 = yylhsminor.yy170; break; case 146: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy102 = tSetCreateTableInfo(yymsp[-5].minor.yy221, yymsp[-1].minor.yy221, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy102, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy170 = tSetCreateTableInfo(yymsp[-5].minor.yy345, yymsp[-1].minor.yy345, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy102 = yylhsminor.yy102; + yymsp[-9].minor.yy170 = yylhsminor.yy170; break; case 147: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy416 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy221, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy72 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy345, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy416 = yylhsminor.yy416; + yymsp[-9].minor.yy72 = yylhsminor.yy72; break; case 148: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */ { yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; - yylhsminor.yy416 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy221, yymsp[-1].minor.yy221, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); + yylhsminor.yy72 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy345, yymsp[-1].minor.yy345, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); } - yymsp[-12].minor.yy416 = yylhsminor.yy416; + yymsp[-12].minor.yy72 = yylhsminor.yy72; break; case 149: /* tagNamelist ::= tagNamelist COMMA ids */ -{taosArrayPush(yymsp[-2].minor.yy221, &yymsp[0].minor.yy0); yylhsminor.yy221 = yymsp[-2].minor.yy221; } - yymsp[-2].minor.yy221 = yylhsminor.yy221; +{taosArrayPush(yymsp[-2].minor.yy345, &yymsp[0].minor.yy0); yylhsminor.yy345 = yymsp[-2].minor.yy345; } + yymsp[-2].minor.yy345 = yylhsminor.yy345; break; case 150: /* tagNamelist ::= ids */ -{yylhsminor.yy221 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy221, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy221 = yylhsminor.yy221; +{yylhsminor.yy345 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy345, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy345 = yylhsminor.yy345; break; case 151: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy102 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy376, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy102, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy170 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy68, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy170, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy102 = yylhsminor.yy102; + yymsp[-4].minor.yy170 = yylhsminor.yy170; break; case 152: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy221, &yymsp[0].minor.yy503); yylhsminor.yy221 = yymsp[-2].minor.yy221; } - yymsp[-2].minor.yy221 = yylhsminor.yy221; +{taosArrayPush(yymsp[-2].minor.yy345, &yymsp[0].minor.yy487); yylhsminor.yy345 = yymsp[-2].minor.yy345; } + yymsp[-2].minor.yy345 = yylhsminor.yy345; break; case 153: /* columnlist ::= column */ -{yylhsminor.yy221 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy221, &yymsp[0].minor.yy503);} - yymsp[0].minor.yy221 = yylhsminor.yy221; +{yylhsminor.yy345 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy345, &yymsp[0].minor.yy487);} + yymsp[0].minor.yy345 = yylhsminor.yy345; break; case 154: /* column ::= ids typename */ { - tSetColumnInfo(&yylhsminor.yy503, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy503); + tSetColumnInfo(&yylhsminor.yy487, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy487); } - yymsp[-1].minor.yy503 = yylhsminor.yy503; + yymsp[-1].minor.yy487 = yylhsminor.yy487; break; case 161: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy106, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy106 = yylhsminor.yy106; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy2 = yylhsminor.yy2; break; case 162: /* tagitem ::= NOW */ -{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy106, &yymsp[0].minor.yy0);} - yymsp[0].minor.yy106 = yylhsminor.yy106; +{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy2, &yymsp[0].minor.yy0);} + yymsp[0].minor.yy2 = yylhsminor.yy2; break; case 163: /* tagitem ::= MINUS INTEGER */ case 164: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==164); @@ -2743,56 +3101,56 @@ static void yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy106, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy2, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy106 = yylhsminor.yy106; + yymsp[-1].minor.yy2 = yylhsminor.yy2; break; - case 167: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ + case 167: /* select ::= SELECT selcollist from where_opt range_option interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { - yylhsminor.yy376 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy221, yymsp[-11].minor.yy164, yymsp[-10].minor.yy146, yymsp[-4].minor.yy221, yymsp[-2].minor.yy221, &yymsp[-9].minor.yy280, &yymsp[-7].minor.yy139, &yymsp[-6].minor.yy48, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy221, &yymsp[0].minor.yy454, &yymsp[-1].minor.yy454, yymsp[-3].minor.yy146); + yylhsminor.yy68 = tSetQuerySqlNode(&yymsp[-14].minor.yy0, yymsp[-13].minor.yy345, yymsp[-12].minor.yy484, yymsp[-11].minor.yy418, yymsp[-4].minor.yy345, yymsp[-2].minor.yy345, &yymsp[-9].minor.yy280, &yymsp[-7].minor.yy295, &yymsp[-6].minor.yy432, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy345, &yymsp[0].minor.yy114, &yymsp[-1].minor.yy114, yymsp[-3].minor.yy418, &yymsp[-10].minor.yy144); } - yymsp[-13].minor.yy376 = yylhsminor.yy376; + yymsp[-14].minor.yy68 = yylhsminor.yy68; break; case 168: /* select ::= LP select RP */ -{yymsp[-2].minor.yy376 = yymsp[-1].minor.yy376;} +{yymsp[-2].minor.yy68 = yymsp[-1].minor.yy68;} break; case 169: /* union ::= select */ -{ yylhsminor.yy221 = setSubclause(NULL, yymsp[0].minor.yy376); } - yymsp[0].minor.yy221 = yylhsminor.yy221; +{ yylhsminor.yy345 = setSubclause(NULL, yymsp[0].minor.yy68); } + yymsp[0].minor.yy345 = yylhsminor.yy345; break; case 170: /* union ::= union UNION ALL select */ -{ yylhsminor.yy221 = appendSelectClause(yymsp[-3].minor.yy221, yymsp[0].minor.yy376); } - yymsp[-3].minor.yy221 = yylhsminor.yy221; +{ yylhsminor.yy345 = appendSelectClause(yymsp[-3].minor.yy345, yymsp[0].minor.yy68); } + yymsp[-3].minor.yy345 = yylhsminor.yy345; break; case 171: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy221, NULL, TSDB_SQL_SELECT); } +{ setSqlInfo(pInfo, yymsp[0].minor.yy345, NULL, TSDB_SQL_SELECT); } break; case 172: /* select ::= SELECT selcollist */ { - yylhsminor.yy376 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy221, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy68 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy345, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy376 = yylhsminor.yy376; + yymsp[-1].minor.yy68 = yylhsminor.yy68; break; case 173: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy221 = yymsp[-1].minor.yy221;} - yymsp[-1].minor.yy221 = yylhsminor.yy221; +{yylhsminor.yy345 = yymsp[-1].minor.yy345;} + yymsp[-1].minor.yy345 = yylhsminor.yy345; break; case 174: /* sclp ::= */ - case 206: /* orderby_opt ::= */ yytestcase(yyruleno==206); -{yymsp[1].minor.yy221 = 0;} + case 215: /* orderby_opt ::= */ yytestcase(yyruleno==215); +{yymsp[1].minor.yy345 = 0;} break; case 175: /* selcollist ::= sclp distinct expr as */ { - yylhsminor.yy221 = tSqlExprListAppend(yymsp[-3].minor.yy221, yymsp[-1].minor.yy146, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy345 = tSqlExprListAppend(yymsp[-3].minor.yy345, yymsp[-1].minor.yy418, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-3].minor.yy221 = yylhsminor.yy221; + yymsp[-3].minor.yy345 = yylhsminor.yy345; break; case 176: /* selcollist ::= sclp STAR */ { tSqlExpr *pNode = tSqlExprCreateIdValue(pInfo, NULL, TK_ALL); - yylhsminor.yy221 = tSqlExprListAppend(yymsp[-1].minor.yy221, pNode, 0, 0); + yylhsminor.yy345 = tSqlExprListAppend(yymsp[-1].minor.yy345, pNode, 0, 0); } - yymsp[-1].minor.yy221 = yylhsminor.yy221; + yymsp[-1].minor.yy345 = yylhsminor.yy345; break; case 177: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2810,361 +3168,390 @@ static void yy_reduce( break; case 182: /* from ::= FROM tablelist */ case 183: /* from ::= FROM sub */ yytestcase(yyruleno==183); -{yymsp[-1].minor.yy164 = yymsp[0].minor.yy164;} +{yymsp[-1].minor.yy484 = yymsp[0].minor.yy484;} break; case 184: /* sub ::= LP union RP */ -{yymsp[-2].minor.yy164 = addSubqueryElem(NULL, yymsp[-1].minor.yy221, NULL);} +{yymsp[-2].minor.yy484 = addSubqueryElem(NULL, yymsp[-1].minor.yy345, NULL);} break; case 185: /* sub ::= LP union RP ids */ -{yymsp[-3].minor.yy164 = addSubqueryElem(NULL, yymsp[-2].minor.yy221, &yymsp[0].minor.yy0);} +{yymsp[-3].minor.yy484 = addSubqueryElem(NULL, yymsp[-2].minor.yy345, &yymsp[0].minor.yy0);} break; case 186: /* sub ::= sub COMMA LP union RP ids */ -{yylhsminor.yy164 = addSubqueryElem(yymsp[-5].minor.yy164, yymsp[-2].minor.yy221, &yymsp[0].minor.yy0);} - yymsp[-5].minor.yy164 = yylhsminor.yy164; +{yylhsminor.yy484 = addSubqueryElem(yymsp[-5].minor.yy484, yymsp[-2].minor.yy345, &yymsp[0].minor.yy0);} + yymsp[-5].minor.yy484 = yylhsminor.yy484; break; case 187: /* tablelist ::= ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy164 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy484 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); } - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy484 = yylhsminor.yy484; break; case 188: /* tablelist ::= ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy164 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy484 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy484 = yylhsminor.yy484; break; case 189: /* tablelist ::= tablelist COMMA ids cpxName */ { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy164 = setTableNameList(yymsp[-3].minor.yy164, &yymsp[-1].minor.yy0, NULL); + yylhsminor.yy484 = setTableNameList(yymsp[-3].minor.yy484, &yymsp[-1].minor.yy0, NULL); } - yymsp[-3].minor.yy164 = yylhsminor.yy164; + yymsp[-3].minor.yy484 = yylhsminor.yy484; break; case 190: /* tablelist ::= tablelist COMMA ids cpxName ids */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy164 = setTableNameList(yymsp[-4].minor.yy164, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + yylhsminor.yy484 = setTableNameList(yymsp[-4].minor.yy484, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } - yymsp[-4].minor.yy164 = yylhsminor.yy164; + yymsp[-4].minor.yy484 = yylhsminor.yy484; break; case 191: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 192: /* interval_option ::= intervalKey LP tmvar RP */ -{yylhsminor.yy280.interval = yymsp[-1].minor.yy0; yylhsminor.yy280.offset.n = 0; yylhsminor.yy280.token = yymsp[-3].minor.yy340;} + case 192: /* timestamp ::= INTEGER */ +{ yylhsminor.yy418 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy418 = yylhsminor.yy418; + break; + case 193: /* timestamp ::= MINUS INTEGER */ + case 194: /* timestamp ::= PLUS INTEGER */ yytestcase(yyruleno==194); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy418 = tSqlExprCreateTimestamp(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy418 = yylhsminor.yy418; + break; + case 195: /* timestamp ::= STRING */ +{ yylhsminor.yy418 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy418 = yylhsminor.yy418; + break; + case 196: /* timestamp ::= NOW */ +{ yylhsminor.yy418 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy418 = yylhsminor.yy418; + break; + case 197: /* timestamp ::= NOW PLUS VARIABLE */ +{yymsp[-2].minor.yy418 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_PLUS); } + break; + case 198: /* timestamp ::= NOW MINUS VARIABLE */ +{yymsp[-2].minor.yy418 = tSqlExprCreateTimestamp(&yymsp[0].minor.yy0, TK_MINUS); } + break; + case 199: /* range_option ::= */ +{yymsp[1].minor.yy144.start = 0; yymsp[1].minor.yy144.end = 0;} + break; + case 200: /* range_option ::= RANGE LP timestamp COMMA timestamp RP */ +{yymsp[-5].minor.yy144.start = yymsp[-3].minor.yy418; yymsp[-5].minor.yy144.end = yymsp[-1].minor.yy418;} + break; + case 201: /* interval_option ::= intervalKey LP tmvar RP */ +{yylhsminor.yy280.interval = yymsp[-1].minor.yy0; yylhsminor.yy280.offset.n = 0; yylhsminor.yy280.token = yymsp[-3].minor.yy40;} yymsp[-3].minor.yy280 = yylhsminor.yy280; break; - case 193: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ -{yylhsminor.yy280.interval = yymsp[-3].minor.yy0; yylhsminor.yy280.offset = yymsp[-1].minor.yy0; yylhsminor.yy280.token = yymsp[-5].minor.yy340;} + case 202: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ +{yylhsminor.yy280.interval = yymsp[-3].minor.yy0; yylhsminor.yy280.offset = yymsp[-1].minor.yy0; yylhsminor.yy280.token = yymsp[-5].minor.yy40;} yymsp[-5].minor.yy280 = yylhsminor.yy280; break; - case 194: /* interval_option ::= */ + case 203: /* interval_option ::= */ {memset(&yymsp[1].minor.yy280, 0, sizeof(yymsp[1].minor.yy280));} break; - case 195: /* intervalKey ::= INTERVAL */ -{yymsp[0].minor.yy340 = TK_INTERVAL;} + case 204: /* intervalKey ::= INTERVAL */ +{yymsp[0].minor.yy40 = TK_INTERVAL;} break; - case 196: /* intervalKey ::= EVERY */ -{yymsp[0].minor.yy340 = TK_EVERY; } + case 205: /* intervalKey ::= EVERY */ +{yymsp[0].minor.yy40 = TK_EVERY; } break; - case 197: /* session_option ::= */ -{yymsp[1].minor.yy139.col.n = 0; yymsp[1].minor.yy139.gap.n = 0;} + case 206: /* session_option ::= */ +{yymsp[1].minor.yy295.col.n = 0; yymsp[1].minor.yy295.gap.n = 0;} break; - case 198: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ + case 207: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - yymsp[-6].minor.yy139.col = yymsp[-4].minor.yy0; - yymsp[-6].minor.yy139.gap = yymsp[-1].minor.yy0; + yymsp[-6].minor.yy295.col = yymsp[-4].minor.yy0; + yymsp[-6].minor.yy295.gap = yymsp[-1].minor.yy0; } break; - case 199: /* windowstate_option ::= */ -{ yymsp[1].minor.yy48.col.n = 0; yymsp[1].minor.yy48.col.z = NULL;} + case 208: /* windowstate_option ::= */ +{ yymsp[1].minor.yy432.col.n = 0; yymsp[1].minor.yy432.col.z = NULL;} break; - case 200: /* windowstate_option ::= STATE_WINDOW LP ids RP */ -{ yymsp[-3].minor.yy48.col = yymsp[-1].minor.yy0; } + case 209: /* windowstate_option ::= STATE_WINDOW LP ids RP */ +{ yymsp[-3].minor.yy432.col = yymsp[-1].minor.yy0; } break; - case 201: /* fill_opt ::= */ -{ yymsp[1].minor.yy221 = 0; } + case 210: /* fill_opt ::= */ +{ yymsp[1].minor.yy345 = 0; } break; - case 202: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 211: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy221, &A, -1, 0); - yymsp[-5].minor.yy221 = yymsp[-1].minor.yy221; + tVariantListInsert(yymsp[-1].minor.yy345, &A, -1, 0); + yymsp[-5].minor.yy345 = yymsp[-1].minor.yy345; } break; - case 203: /* fill_opt ::= FILL LP ID RP */ + case 212: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy221 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy345 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 204: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 213: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 205: /* sliding_opt ::= */ + case 214: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 207: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy221 = yymsp[0].minor.yy221;} + case 216: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy345 = yymsp[0].minor.yy345;} break; - case 208: /* sortlist ::= sortlist COMMA item sortorder */ + case 217: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy221 = tVariantListAppend(yymsp[-3].minor.yy221, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); + yylhsminor.yy345 = tVariantListAppend(yymsp[-3].minor.yy345, &yymsp[-1].minor.yy2, yymsp[0].minor.yy281); } - yymsp[-3].minor.yy221 = yylhsminor.yy221; + yymsp[-3].minor.yy345 = yylhsminor.yy345; break; - case 209: /* sortlist ::= item sortorder */ + case 218: /* sortlist ::= item sortorder */ { - yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[-1].minor.yy106, yymsp[0].minor.yy172); + yylhsminor.yy345 = tVariantListAppend(NULL, &yymsp[-1].minor.yy2, yymsp[0].minor.yy281); } - yymsp[-1].minor.yy221 = yylhsminor.yy221; + yymsp[-1].minor.yy345 = yylhsminor.yy345; break; - case 210: /* item ::= ids cpxName */ + case 219: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy106, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy2, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy106 = yylhsminor.yy106; + yymsp[-1].minor.yy2 = yylhsminor.yy2; break; - case 211: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy172 = TSDB_ORDER_ASC; } + case 220: /* sortorder ::= ASC */ +{ yymsp[0].minor.yy281 = TSDB_ORDER_ASC; } break; - case 212: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy172 = TSDB_ORDER_DESC;} + case 221: /* sortorder ::= DESC */ +{ yymsp[0].minor.yy281 = TSDB_ORDER_DESC;} break; - case 213: /* sortorder ::= */ -{ yymsp[1].minor.yy172 = TSDB_ORDER_ASC; } + case 222: /* sortorder ::= */ +{ yymsp[1].minor.yy281 = TSDB_ORDER_ASC; } break; - case 214: /* groupby_opt ::= */ -{ yymsp[1].minor.yy221 = 0;} + case 223: /* groupby_opt ::= */ +{ yymsp[1].minor.yy345 = 0;} break; - case 215: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy221 = yymsp[0].minor.yy221;} + case 224: /* groupby_opt ::= GROUP BY grouplist */ +{ yymsp[-2].minor.yy345 = yymsp[0].minor.yy345;} break; - case 216: /* grouplist ::= grouplist COMMA item */ + case 225: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy221 = tVariantListAppend(yymsp[-2].minor.yy221, &yymsp[0].minor.yy106, -1); + yylhsminor.yy345 = tVariantListAppend(yymsp[-2].minor.yy345, &yymsp[0].minor.yy2, -1); } - yymsp[-2].minor.yy221 = yylhsminor.yy221; + yymsp[-2].minor.yy345 = yylhsminor.yy345; break; - case 217: /* grouplist ::= item */ + case 226: /* grouplist ::= item */ { - yylhsminor.yy221 = tVariantListAppend(NULL, &yymsp[0].minor.yy106, -1); + yylhsminor.yy345 = tVariantListAppend(NULL, &yymsp[0].minor.yy2, -1); } - yymsp[0].minor.yy221 = yylhsminor.yy221; + yymsp[0].minor.yy345 = yylhsminor.yy345; break; - case 218: /* having_opt ::= */ - case 228: /* where_opt ::= */ yytestcase(yyruleno==228); - case 272: /* expritem ::= */ yytestcase(yyruleno==272); -{yymsp[1].minor.yy146 = 0;} + case 227: /* having_opt ::= */ + case 237: /* where_opt ::= */ yytestcase(yyruleno==237); + case 281: /* expritem ::= */ yytestcase(yyruleno==281); +{yymsp[1].minor.yy418 = 0;} break; - case 219: /* having_opt ::= HAVING expr */ - case 229: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==229); -{yymsp[-1].minor.yy146 = yymsp[0].minor.yy146;} + case 228: /* having_opt ::= HAVING expr */ + case 238: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==238); +{yymsp[-1].minor.yy418 = yymsp[0].minor.yy418;} break; - case 220: /* limit_opt ::= */ - case 224: /* slimit_opt ::= */ yytestcase(yyruleno==224); -{yymsp[1].minor.yy454.limit = -1; yymsp[1].minor.yy454.offset = 0;} + case 229: /* limit_opt ::= */ + case 233: /* slimit_opt ::= */ yytestcase(yyruleno==233); +{yymsp[1].minor.yy114.limit = -1; yymsp[1].minor.yy114.offset = 0;} break; - case 221: /* limit_opt ::= LIMIT signed */ - case 225: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==225); -{yymsp[-1].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-1].minor.yy454.offset = 0;} + case 230: /* limit_opt ::= LIMIT signed */ + case 234: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==234); +{yymsp[-1].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-1].minor.yy114.offset = 0;} break; - case 222: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy454.limit = yymsp[-2].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[0].minor.yy109;} + case 231: /* limit_opt ::= LIMIT signed OFFSET signed */ +{ yymsp[-3].minor.yy114.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[0].minor.yy525;} break; - case 223: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[-2].minor.yy109;} + case 232: /* limit_opt ::= LIMIT signed COMMA signed */ +{ yymsp[-3].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[-2].minor.yy525;} break; - case 226: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy454.limit = yymsp[-2].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[0].minor.yy109;} + case 235: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ +{yymsp[-3].minor.yy114.limit = yymsp[-2].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[0].minor.yy525;} break; - case 227: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy454.limit = yymsp[0].minor.yy109; yymsp[-3].minor.yy454.offset = yymsp[-2].minor.yy109;} + case 236: /* slimit_opt ::= SLIMIT signed COMMA signed */ +{yymsp[-3].minor.yy114.limit = yymsp[0].minor.yy525; yymsp[-3].minor.yy114.offset = yymsp[-2].minor.yy525;} break; - case 230: /* expr ::= LP expr RP */ -{yylhsminor.yy146 = yymsp[-1].minor.yy146; yylhsminor.yy146->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy146->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 239: /* expr ::= LP expr RP */ +{yylhsminor.yy418 = yymsp[-1].minor.yy418; yylhsminor.yy418->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy418->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 231: /* expr ::= ID */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 240: /* expr ::= ID */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 232: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 241: /* expr ::= ID DOT ID */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 233: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 242: /* expr ::= ID DOT STAR */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 234: /* expr ::= INTEGER */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 243: /* expr ::= INTEGER */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 235: /* expr ::= MINUS INTEGER */ - case 236: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==236); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy146 = yylhsminor.yy146; + case 244: /* expr ::= MINUS INTEGER */ + case 245: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==245); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy418 = yylhsminor.yy418; break; - case 237: /* expr ::= FLOAT */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 246: /* expr ::= FLOAT */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 238: /* expr ::= MINUS FLOAT */ - case 239: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==239); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy146 = yylhsminor.yy146; + case 247: /* expr ::= MINUS FLOAT */ + case 248: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==248); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy418 = yylhsminor.yy418; break; - case 240: /* expr ::= STRING */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 249: /* expr ::= STRING */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 241: /* expr ::= NOW */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 250: /* expr ::= NOW */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 242: /* expr ::= VARIABLE */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 251: /* expr ::= VARIABLE */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 243: /* expr ::= PLUS VARIABLE */ - case 244: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==244); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} - yymsp[-1].minor.yy146 = yylhsminor.yy146; + case 252: /* expr ::= PLUS VARIABLE */ + case 253: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==253); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[-1].minor.yy0, TK_VARIABLE);} + yymsp[-1].minor.yy418 = yylhsminor.yy418; break; - case 245: /* expr ::= BOOL */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 254: /* expr ::= BOOL */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 246: /* expr ::= NULL */ -{ yylhsminor.yy146 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 255: /* expr ::= NULL */ +{ yylhsminor.yy418 = tSqlExprCreateIdValue(pInfo, &yymsp[0].minor.yy0, TK_NULL);} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 247: /* expr ::= ID LP exprlist RP */ -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy146 = tSqlExprCreateFunction(yymsp[-1].minor.yy221, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy146 = yylhsminor.yy146; + case 256: /* expr ::= ID LP exprlist RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy418 = tSqlExprCreateFunction(yymsp[-1].minor.yy345, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy418 = yylhsminor.yy418; break; - case 248: /* expr ::= ID LP STAR RP */ -{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy146 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy146 = yylhsminor.yy146; + case 257: /* expr ::= ID LP STAR RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy418 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy418 = yylhsminor.yy418; break; - case 249: /* expr ::= expr IS NULL */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, NULL, TK_ISNULL);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 258: /* expr ::= expr IS NULL */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, NULL, TK_ISNULL);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 250: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-3].minor.yy146, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy146 = yylhsminor.yy146; + case 259: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-3].minor.yy418, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy418 = yylhsminor.yy418; break; - case 251: /* expr ::= expr LT expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_LT);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 260: /* expr ::= expr LT expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LT);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 252: /* expr ::= expr GT expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_GT);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 261: /* expr ::= expr GT expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_GT);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 253: /* expr ::= expr LE expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_LE);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 262: /* expr ::= expr LE expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LE);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 254: /* expr ::= expr GE expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_GE);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 263: /* expr ::= expr GE expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_GE);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 255: /* expr ::= expr NE expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_NE);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 264: /* expr ::= expr NE expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_NE);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 256: /* expr ::= expr EQ expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_EQ);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 265: /* expr ::= expr EQ expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_EQ);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 257: /* expr ::= expr BETWEEN expr AND expr */ -{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy146); yylhsminor.yy146 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy146, yymsp[-2].minor.yy146, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy146, TK_LE), TK_AND);} - yymsp[-4].minor.yy146 = yylhsminor.yy146; + case 266: /* expr ::= expr BETWEEN expr AND expr */ +{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy418); yylhsminor.yy418 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy418, yymsp[-2].minor.yy418, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy418, TK_LE), TK_AND);} + yymsp[-4].minor.yy418 = yylhsminor.yy418; break; - case 258: /* expr ::= expr AND expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_AND);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 267: /* expr ::= expr AND expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_AND);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 259: /* expr ::= expr OR expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_OR); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 268: /* expr ::= expr OR expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_OR); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 260: /* expr ::= expr PLUS expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_PLUS); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 269: /* expr ::= expr PLUS expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_PLUS); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 261: /* expr ::= expr MINUS expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_MINUS); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 270: /* expr ::= expr MINUS expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_MINUS); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 262: /* expr ::= expr STAR expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_STAR); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 271: /* expr ::= expr STAR expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_STAR); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 263: /* expr ::= expr SLASH expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_DIVIDE);} - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 272: /* expr ::= expr SLASH expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_DIVIDE);} + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 264: /* expr ::= expr REM expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_REM); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 273: /* expr ::= expr REM expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_REM); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 265: /* expr ::= expr LIKE expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_LIKE); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 274: /* expr ::= expr LIKE expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_LIKE); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 266: /* expr ::= expr MATCH expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_MATCH); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 275: /* expr ::= expr MATCH expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_MATCH); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 267: /* expr ::= expr NMATCH expr */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-2].minor.yy146, yymsp[0].minor.yy146, TK_NMATCH); } - yymsp[-2].minor.yy146 = yylhsminor.yy146; + case 276: /* expr ::= expr NMATCH expr */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-2].minor.yy418, yymsp[0].minor.yy418, TK_NMATCH); } + yymsp[-2].minor.yy418 = yylhsminor.yy418; break; - case 268: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy146 = tSqlExprCreate(yymsp[-4].minor.yy146, (tSqlExpr*)yymsp[-1].minor.yy221, TK_IN); } - yymsp[-4].minor.yy146 = yylhsminor.yy146; + case 277: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy418 = tSqlExprCreate(yymsp[-4].minor.yy418, (tSqlExpr*)yymsp[-1].minor.yy345, TK_IN); } + yymsp[-4].minor.yy418 = yylhsminor.yy418; break; - case 269: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy221 = tSqlExprListAppend(yymsp[-2].minor.yy221,yymsp[0].minor.yy146,0, 0);} - yymsp[-2].minor.yy221 = yylhsminor.yy221; + case 278: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy345 = tSqlExprListAppend(yymsp[-2].minor.yy345,yymsp[0].minor.yy418,0, 0);} + yymsp[-2].minor.yy345 = yylhsminor.yy345; break; - case 270: /* exprlist ::= expritem */ -{yylhsminor.yy221 = tSqlExprListAppend(0,yymsp[0].minor.yy146,0, 0);} - yymsp[0].minor.yy221 = yylhsminor.yy221; + case 279: /* exprlist ::= expritem */ +{yylhsminor.yy345 = tSqlExprListAppend(0,yymsp[0].minor.yy418,0, 0);} + yymsp[0].minor.yy345 = yylhsminor.yy345; break; - case 271: /* expritem ::= expr */ -{yylhsminor.yy146 = yymsp[0].minor.yy146;} - yymsp[0].minor.yy146 = yylhsminor.yy146; + case 280: /* expritem ::= expr */ +{yylhsminor.yy418 = yymsp[0].minor.yy418;} + yymsp[0].minor.yy418 = yylhsminor.yy418; break; - case 273: /* cmd ::= RESET QUERY CACHE */ + case 282: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 274: /* cmd ::= SYNCDB ids REPLICA */ + case 283: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 275: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 284: /* 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.yy221, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 276: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 285: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3175,21 +3562,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 277: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 286: /* 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.yy221, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 278: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 287: /* 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.yy221, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 279: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 288: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3200,7 +3587,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 280: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 289: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3214,33 +3601,33 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 281: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 290: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy106, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy2, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 282: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 291: /* 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.yy221, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 283: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 292: /* 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.yy221, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 284: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 293: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3251,21 +3638,21 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 285: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 294: /* 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.yy221, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 286: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 295: /* 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.yy221, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 287: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 296: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3276,7 +3663,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 288: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 297: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3290,41 +3677,41 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 289: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 298: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy106, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy2, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 290: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 299: /* 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.yy221, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy345, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 291: /* cmd ::= KILL CONNECTION INTEGER */ + case 300: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 292: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 301: /* 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 293: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 302: /* 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: break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); + return yyact; } /* @@ -3348,7 +3736,8 @@ static void yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3359,7 +3748,8 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } #endif /* YYNOERRORRECOVERY */ @@ -3371,7 +3761,8 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ @@ -3397,7 +3788,8 @@ static void yy_syntax_error( assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* @@ -3406,7 +3798,8 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH; + ParseARG_FETCH + ParseCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3421,7 +3814,8 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ + ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ + ParseCTX_STORE } /* The main parser program. @@ -3450,45 +3844,47 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - unsigned int yyact; /* The parser action. */ + YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser; /* The parser */ + yyParser *yypParser = (yyParser*)yyp; /* The parser */ + ParseCTX_FETCH + ParseARG_STORE - yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif - ParseARG_STORE; + yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - int stateno = yypParser->yytos->stateno; - if( stateno < YY_MIN_REDUCE ){ + if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno); + yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + assert( yyact==yypParser->yytos->stateno ); + yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, + yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,yymajor,yyminor); + yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - yymajor = YYNOCODE; + break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3539,10 +3935,9 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack - && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) >= YY_MIN_REDUCE + YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3559,6 +3954,8 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; + if( yymajor==YYNOCODE ) break; + yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3569,8 +3966,7 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - + break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3592,10 +3988,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - yymajor = YYNOCODE; + break; #endif } - }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); + }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3610,3 +4006,17 @@ void Parse( #endif return; } + +/* +** Return the fallback token corresponding to canonical token iToken, or +** 0 if iToken has no fallback. +*/ +int ParseFallback(int iToken){ +#ifdef YYFALLBACK + assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); + return yyFallback[iToken]; +#else + (void)iToken; + return 0; +#endif +} diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index dc6ebb6f1ad49d246ca3fa78ad15b4d4740cb24b..9b138bbd02b7a88b9bdaddcafbc2d2290d5c3d2e 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -683,8 +683,8 @@ SArray* tsdbGetQueriedTableList(TsdbQueryHandleT *pHandle) { TsdbQueryHandleT tsdbQueryRowsInExternalWindow(STsdbRepo *tsdb, STsdbQueryCond* pCond, STableGroupInfo *groupList, uint64_t qId, SMemRef* pRef) { STsdbQueryHandle *pQueryHandle = (STsdbQueryHandle*) tsdbQueryTables(tsdb, pCond, groupList, qId, pRef); - pQueryHandle->loadExternalRow = true; - pQueryHandle->currentLoadExternalRows = true; + //pQueryHandle->loadExternalRow = true; + //pQueryHandle->currentLoadExternalRows = true; return pQueryHandle; } @@ -2929,6 +2929,22 @@ static bool loadCachedLast(STsdbQueryHandle* pQueryHandle) { return false; } +void tsdbSwitchTable(TsdbQueryHandleT queryHandle) { + STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) queryHandle; + + STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, pQueryHandle->activeIndex); + pCheckInfo->numOfBlocks = 0; + + pQueryHandle->locateStart = false; + pQueryHandle->checkFiles = true; + pQueryHandle->cur.rows = 0; + pQueryHandle->currentLoadExternalRows = pQueryHandle->loadExternalRow; + + terrno = TSDB_CODE_SUCCESS; + + ++pQueryHandle->activeIndex; +} + static bool loadDataBlockFromTableSeq(STsdbQueryHandle* pQueryHandle) { size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 7cce5084038691c1f7286dccafbb387a599c6ab1..5eee3adbc3e83e3d26a2bd93e0b564d21cfc6668 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -229,7 +229,8 @@ static SKeyword keywordTable[] = { {"FUNCTIONS", TK_FUNCTIONS}, {"OUTPUTTYPE", TK_OUTPUTTYPE}, {"AGGREGATE", TK_AGGREGATE}, - {"BUFSIZE", TK_BUFSIZE} + {"BUFSIZE", TK_BUFSIZE}, + {"RANGE", TK_RANGE} }; static const char isIdChar[] = { diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index c23f0614c43ddb5548a305f6761888e9b56b244c..194ec5978da63af5b48338e6badca8d74b88d7e5 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -357,7 +357,7 @@ python3 ./test.py -f functions/function_twa.py -r 1 python3 ./test.py -f functions/function_twa_test2.py python3 ./test.py -f functions/function_stddev_td2555.py python3 ./test.py -f functions/showOfflineThresholdIs864000.py -python3 ./test.py -f functions/function_interp.py +#python3 ./test.py -f functions/function_interp.py python3 ./test.py -f insert/metadataUpdate.py python3 ./test.py -f query/last_cache.py python3 ./test.py -f query/last_row_cache.py diff --git a/tests/pytest/query/nestedQuery/nestedQuery.py b/tests/pytest/query/nestedQuery/nestedQuery.py index 545f6429e825c468bdb07524329d6ea49944e379..9260aced9a1d79649802917daad8f36ec9cf249e 100755 --- a/tests/pytest/query/nestedQuery/nestedQuery.py +++ b/tests/pytest/query/nestedQuery/nestedQuery.py @@ -366,7 +366,7 @@ class TDTestCase: calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)'] - calc_select_fill = ['INTERP(q_bool)' ,'INTERP(q_binary)' ,'INTERP(q_nchar)' ,'INTERP(q_ts)', 'INTERP(q_int)' ,'INTERP(*)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] + calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)'] interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\''] #two table join @@ -396,8 +396,8 @@ class TDTestCase: 'PERCENTILE(t2.q_int,10)' ,'PERCENTILE(t2.q_bigint,20)' , 'PERCENTILE(t2.q_smallint,30)' ,'PERCENTILE(t2.q_tinyint,40)' ,'PERCENTILE(t2.q_float,50)' ,'PERCENTILE(t2.q_double,60)'] - calc_select_fill_j = ['INTERP(t1.q_bool)' ,'INTERP(t1.q_binary)' ,'INTERP(t1.q_nchar)' ,'INTERP(t1.q_ts)', 'INTERP(t1.q_int)' ,'INTERP(t1.*)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , - 'INTERP(t2.q_bool)' ,'INTERP(t2.q_binary)' ,'INTERP(t2.q_nchar)' ,'INTERP(t2.q_ts)', 'INTERP(t2.q_int)' ,'INTERP(t2.*)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] + calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' , + 'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)'] interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' , 't1.tbname in (\'table_1\') and t1.ts = now' ,'t1.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t1.ts = \'2020-09-13 20:26:40.000\'','t1.tbname like \'table%\' and t1.ts = \'2020-09-13 20:26:40.002\'', 't2.tbname in (\'table_1\') and t2.ts = now' ,'t2.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t2.ts = \'2020-09-13 20:26:40.000\'','t2.tbname like \'table%\' and t2.ts = \'2020-09-13 20:26:40.002\''] @@ -1996,7 +1996,7 @@ class TDTestCase: sql += ") " tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + #tdSql.query(sql) rsDn = self.restartDnodes() tdSql.query("select 20-2 from table_0;") @@ -2014,7 +2014,7 @@ class TDTestCase: sql += ") " tdLog.info(sql) tdLog.info(len(sql)) - tdSql.query(sql) + #tdSql.query(sql) tdSql.query("select 20-2.2 from table_0;") for i in range(self.fornum): @@ -2391,4 +2391,4 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index ebc054777940430e9cdb78b55b496dda873f2143..a2b3978ad7fd6c6f2b4adf9f62b9edb4fed2a9e5 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -130,7 +130,7 @@ run general/parser/limit2.sim run general/parser/slimit.sim run general/parser/fill.sim run general/parser/fill_stb.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/where.sim run general/parser/join.sim run general/parser/join_multivnode.sim diff --git a/tests/script/general/parser/interp.sim b/tests/script/general/parser/interp.sim deleted file mode 100644 index f192837bb7422046b0fbf05e66b2f2165d7e3c10..0000000000000000000000000000000000000000 --- a/tests/script/general/parser/interp.sim +++ /dev/null @@ -1,83 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/exec.sh -n dnode1 -s start -sleep 100 -sql connect - -$dbPrefix = intp_db -$tbPrefix = intp_tb -$stbPrefix = intp_stb -$tbNum = 4 -$rowNum = 10000 -$totalNum = $tbNum * $rowNum -$ts0 = 1537146000000 -$delta = 600000 -print ========== interp.sim -$i = 0 -$db = $dbPrefix . $i -$stb = $stbPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -print ====== create tables -sql use $db -sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) - -$i = 0 -$ts = $ts0 -$halfNum = $tbNum / 2 -while $i < $halfNum - $tbId = $i + $halfNum - $tb = $tbPrefix . $i - $tb1 = $tbPrefix . $tbId - sql create table $tb using $stb tags( $i ) - sql create table $tb1 using $stb tags( $tbId ) - - $x = 0 - while $x < $rowNum - $xs = $x * $delta - $ts = $ts0 + $xs - $c = $x / 10 - $c = $c * 10 - $c = $x - $c - $binary = 'binary . $c - $binary = $binary . ' - $nchar = 'nchar . $c - $nchar = $nchar . ' - sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) - $x = $x + 1 - endw - - $i = $i + 1 -endw -print ====== tables created - -sql create table ap1 (ts timestamp, pav float); -sql INSERT INTO ap1 VALUES ('2021-07-25 02:19:54.100',1) ('2021-07-25 02:19:54.200',2) ('2021-07-25 02:19:54.300',3) ('2021-07-25 02:19:56.500',4) ('2021-07-25 02:19:57.500',5) ('2021-07-25 02:19:57.600',6) ('2021-07-25 02:19:57.900',7) ('2021-07-25 02:19:58.100',8) ('2021-07-25 02:19:58.300',9) ('2021-07-25 02:19:59.100',10) ('2021-07-25 02:19:59.300',11) ('2021-07-25 02:19:59.500',12) ('2021-07-25 02:19:59.700',13) ('2021-07-25 02:19:59.900',14) ('2021-07-25 02:20:05.000', 20) ('2021-07-25 02:25:00.000', 10000); - -run general/parser/interp_test.sim - -print ================== restart server to commit data into disk -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 500 -system sh/exec.sh -n dnode1 -s start -print ================== server restart completed - -run general/parser/interp_test.sim - -print ================= TD-5931 -sql create stable st5931(ts timestamp, f int) tags(t int) -sql create table ct5931 using st5931 tags(1) -sql create table nt5931(ts timestamp, f int) -sql select interp(*) from nt5931 where ts=now -sql select interp(*) from st5931 where ts=now -sql select interp(*) from ct5931 where ts=now - -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/interp_full.sim b/tests/script/general/parser/interp_full.sim new file mode 100644 index 0000000000000000000000000000000000000000..530ce20604d045c5a7510da72b5122bb8c60411b --- /dev/null +++ b/tests/script/general/parser/interp_full.sim @@ -0,0 +1,153 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start +sleep 100 +sql connect + +sql create database db; +sql use db; +sql create stable stb1 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) +sql create table tb1 using stb1 tags(1,'1',1.0) +sql create table tb2 using stb1 tags(2,'2',2.0) +sql create table tb3 using stb1 tags(3,'3',3.0) +sql create table tb4 using stb1 tags(4,'4',4.0) + +sql insert into tb1 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb1 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb1 values ('2021-10-20 10:00:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb1 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb1 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb1 values ('2021-10-20 10:00:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb1 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') + +sql insert into tb2 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb2 values ('2021-10-20 10:00:02',2,2.0,2,2,2,2.0,true ,'2','2') +sql insert into tb2 values ('2021-10-20 10:00:04',4,4.0,4,4,4,4.0,false,'4','4') +sql insert into tb2 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb2 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb2 values ('2021-10-20 10:00:12',12,12.0,12,12,12,12.0,true ,'12','12') +sql insert into tb2 values ('2021-10-20 10:00:14',14,14.0,14,14,14,14.0,false,'14','14') + +sql insert into tb3 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb3 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb3 values ('2021-10-20 10:00:02',2,2.0,2,2,2,2.0,false,'2','2') +sql insert into tb3 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb3 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb3 values ('2021-10-20 10:00:18',18,18.0,18,18,18,18.0,true ,'18','18') +sql insert into tb3 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') + + +sql create stable stb4 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) + +sql create table tb4_0 using stb4 tags(0,'0',0.0) +sql create table tb4_1 using stb4 tags(1,'1',1.0) +sql create table tb4_2 using stb4 tags(2,'2',2.0) + +sql insert into tb4_0 values ('2021-10-20 10:00:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:00:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:00:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:00:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:00:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:00:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:00:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:00:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:00:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:00:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:00:55',55,55.0,55,55,55,55.0,false,'55','55') + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:01:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:01:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:01:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:01:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:01:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:01:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:01:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:01:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:01:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:01:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:01:55',55,55.0,55,55,55,55.0,false,'55','55') + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:02:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:02:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:02:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:02:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:02:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:02:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:02:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:02:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:02:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:02:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:02:55',55,55.0,55,55,55,55.0,false,'55','55') + + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:03:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:03:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:03:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:03:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:03:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:03:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:03:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:03:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:03:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:03:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:03:55',55,55.0,55,55,55,55.0,false,'55','55') + + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +sql insert into tb4_0 values ('2021-10-20 10:04:00',0,0.0,0,0,0,0.0,true ,'0','0') +sql insert into tb4_0 values ('2021-10-20 10:04:01',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb4_0 values ('2021-10-20 10:04:03',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb4_0 values ('2021-10-20 10:04:06',6,6.0,6,6,6,6.0,false,'6','6') +sql insert into tb4_0 values ('2021-10-20 10:04:10',10,10.0,10,10,10,10.0,true ,'10','10') +sql insert into tb4_0 values ('2021-10-20 10:04:15',15,15.0,15,15,15,15.0,true ,'15','15') +sql insert into tb4_0 values ('2021-10-20 10:04:21',21,21.0,21,21,21,21.0,false,'21','21') +sql insert into tb4_0 values ('2021-10-20 10:04:28',28,28.0,28,28,28,28.0,false,'28','28') +sql insert into tb4_0 values ('2021-10-20 10:04:36',36,36.0,36,36,36,36.0,false,'36','36') +sql insert into tb4_0 values ('2021-10-20 10:04:45',45,45.0,45,45,45,45.0,false,'45','45') +sql insert into tb4_0 values ('2021-10-20 10:04:55',55,55.0,55,55,55,55.0,false,'55','55') + + + +run general/parser/interp_full_test1.sim +run general/parser/interp_full_test2.sim +run general/parser/interp_full_test3.sim +run general/parser/interp_full_test4.sim + +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 500 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed + +run general/parser/interp_full_test1.sim +run general/parser/interp_full_test2.sim +run general/parser/interp_full_test3.sim +run general/parser/interp_full_test4.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/interp_full_test1.sim b/tests/script/general/parser/interp_full_test1.sim new file mode 100644 index 0000000000000000000000000000000000000000..858d58768bd6c0ab78d6debf0e4208d375080ef8 --- /dev/null +++ b/tests/script/general/parser/interp_full_test1.sim @@ -0,0 +1,2247 @@ +sleep 100 +sql connect + +sql use db; + +sql_error SELECT INTERP(c7) FROM tb1; +sql_error SELECT INTERP(c8) FROM tb1; +sql_error SELECT INTERP(c9) FROM tb1; +sql_error SELECT INTERP(c1,c8) FROM tb1; +sql_error SELECT INTERP(*) FROM tb1; +sql_error SELECT INTERP(c1),INTERP(c8) FROM tb1; +sql_error SELECT INTERP(c1),avg(c1) FROM tb1; +sql_error SELECT INTERP(c1),c1 FROM tb1; +sql_error SELECT INTERP(c1),top(c1,3) FROM tb1; +sql_error SELECT INTERP(c1),first(c1) FROM tb1; +sql_error SELECT INTERP(c1),count(c1) FROM tb1; +sql_error SELECT INTERP(c1),ceil(c1) FROM tb1; +sql_error SELECT c1,c2,interp(c1) FROM tb1; +sql_error SELECT INTERP(c1) FROM stb1; +sql_error SELECT interp(c1) FROM stb1 group by t1; +sql_error SELECT interp(c1) FROM stb1 group by tbname,t1; +sql_error SELECT interp(c1) FROM stb1 group by tbname,ts; +sql_error SELECT interp(c1) FROM stb1 group by tbname,c1; +sql_error SELECT INTERP(c1) FROM tb1 interval(1s); +sql_error SELECT avg(c1) FROM tb1 every(1s); +sql_error SELECT avg(c1) FROM tb1 range(0,1); +sql_error SELECT INTERP(c1) FROM tb1 STATE_WINDOW(c1); +sql_error SELECT INTERP(c1) FROM tb1 SESSION(ts,100s); +sql_error SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:11','2021-10-20 10:00:10'); +sql_error SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:11','2021-10-20 10:00:10') ORDER BY ts DESC; +sql_error SELECT INTERP(ts) FROM tb1; +sql_error select interp(c1) from tb1 EVERY(1s) sliding(1s); +sql_error select interp(c1) from (select ts,c1 from tb1 order by ts desc); +sql_error select interp(a) from (select top(c1,3) as a from stb1 group by tbname); +sql_error select interp(c1) from (select c1 from tb1 order by ts); +sql_error select interp(c1) from (select c1,ts from tb1 order by ts); +sql_error select interp(a) from (select top(c1,3) as a from stb1 order by ts); +sql_error select interp(a) from (select top(c1,3) as a from tb1 order by ts desc); + +sql SELECT INTERP(c1) FROM tb1; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT ts,INTERP(c1) FROM tb1; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data02 != 0 then + return -1 +endi + + + +sql SELECT INTERP(c1) FROM tb1 where ts > '2021-10-20 10:00:03' +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi + +sql SELECT INTERP(c1,c2,c3,c4,c6,c5) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 0.00000 then + return -1 +endi +if $data03 != 0 then + return -1 +endi +if $data04 != 0 then + return -1 +endi +if $data05 != 0.000000000 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1.00000 then + return -1 +endi +if $data13 != 1 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 1.000000000 then + return -1 +endi +if $data16 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 3.00000 then + return -1 +endi +if $data23 != 3 then + return -1 +endi +if $data24 != 3 then + return -1 +endi +if $data25 != 3.000000000 then + return -1 +endi +if $data26 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data34 != 6 then + return -1 +endi +if $data35 != 6.000000000 then + return -1 +endi +if $data36 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 10.00000 then + return -1 +endi +if $data43 != 10 then + return -1 +endi +if $data44 != 10 then + return -1 +endi +if $data45 != 10.000000000 then + return -1 +endi +if $data46 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 15.00000 then + return -1 +endi +if $data53 != 15 then + return -1 +endi +if $data54 != 15 then + return -1 +endi +if $data55 != 15.000000000 then + return -1 +endi +if $data56 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 21.00000 then + return -1 +endi +if $data63 != 21 then + return -1 +endi +if $data64 != 21 then + return -1 +endi +if $data65 != 21.000000000 then + return -1 +endi +if $data66 != 21 then + return -1 +endi + +sql SELECT INTERP(c1),interp(c2),interp(c3) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 0.00000 then + return -1 +endi +if $data03 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1.00000 then + return -1 +endi +if $data13 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 3.00000 then + return -1 +endi +if $data23 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 10.00000 then + return -1 +endi +if $data43 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 15.00000 then + return -1 +endi +if $data53 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 21.00000 then + return -1 +endi +if $data63 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1),ts FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != @21-10-20 10:00:21.000@ then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data72 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 4 then + return -1 +endi +if $data92 != tb2 then + return -1 +endi + + + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 5; +if $rows != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 3; +if $rows != 9 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data32 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data41 != 2 then + return -1 +endi +if $data42 != tb2 then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != 4 then + return -1 +endi +if $data52 != tb2 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data71 != 1 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 3 offset 6; +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data11 != 14 then + return -1 +endi +if $data12 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 0.00000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 0 then + return -1 +endi +if $data06 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data13 != 1.00000 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 1 then + return -1 +endi +if $data16 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data23 != 3.00000 then + return -1 +endi +if $data24 != 1 then + return -1 +endi +if $data25 != 3 then + return -1 +endi +if $data26 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 1 then + return -1 +endi +if $data33 != 6.00000 then + return -1 +endi +if $data34 != 1 then + return -1 +endi +if $data35 != 6 then + return -1 +endi +if $data36 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data42 != 1 then + return -1 +endi +if $data43 != 10.00000 then + return -1 +endi +if $data44 != 1 then + return -1 +endi +if $data45 != 10 then + return -1 +endi +if $data46 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data52 != 1 then + return -1 +endi +if $data53 != 15.00000 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 15 then + return -1 +endi +if $data56 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != 1 then + return -1 +endi +if $data63 != 21.00000 then + return -1 +endi +if $data64 != 1 then + return -1 +endi +if $data65 != 21 then + return -1 +endi +if $data66 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data72 != 2 then + return -1 +endi +if $data73 != 0.00000 then + return -1 +endi +if $data74 != 2 then + return -1 +endi +if $data75 != 0 then + return -1 +endi +if $data76 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data82 != 2 then + return -1 +endi +if $data83 != 2.00000 then + return -1 +endi +if $data84 != 2 then + return -1 +endi +if $data85 != 2 then + return -1 +endi +if $data86 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 4 then + return -1 +endi +if $data92 != 2 then + return -1 +endi +if $data93 != 4.00000 then + return -1 +endi +if $data94 != 2 then + return -1 +endi +if $data95 != 4 then + return -1 +endi +if $data96 != tb2 then + return -1 +endi + +sql SELECT tbname,INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(4s) group by tbname; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != tb1 then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data03 != 1 then + return -1 +endi +if $data04 != 0.00000 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data07 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != tb2 then + return -1 +endi +if $data12 != 0 then + return -1 +endi +if $data13 != 2 then + return -1 +endi +if $data14 != 0.00000 then + return -1 +endi +if $data15 != 2 then + return -1 +endi +if $data16 != 0 then + return -1 +endi +if $data17 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data21 != tb2 then + return -1 +endi +if $data22 != 4 then + return -1 +endi +if $data23 != 2 then + return -1 +endi +if $data24 != 4.00000 then + return -1 +endi +if $data25 != 2 then + return -1 +endi +if $data26 != 4 then + return -1 +endi +if $data27 != tb2 then + return -1 +endi +if $data30 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data31 != tb2 then + return -1 +endi +if $data32 != 12 then + return -1 +endi +if $data33 != 2 then + return -1 +endi +if $data34 != 12.00000 then + return -1 +endi +if $data35 != 2 then + return -1 +endi +if $data36 != 12 then + return -1 +endi +if $data37 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != tb3 then + return -1 +endi +if $data42 != 0 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 0.00000 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != 0 then + return -1 +endi +if $data47 != tb3 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM stb1 range('2021-10-20 10:00:00.000','2021-10-20 10:00:40.000') every(1s) fill(linear) group by tbname; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data72 != tb1 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data82 != tb1 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi +if $data92 != tb1 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00'); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00'); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00'); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(VALUE, 100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 every(2s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(5s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(100s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100.00000 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0.00000 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s); +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s); +if $rows != 4 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(2s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(2s); +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(2s); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(2s); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(2s); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(LINEAR); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) limit 10 offset 20; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(VALUE,100); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NULL); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(LINEAR); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 20 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NEXT); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(PREV); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(VALUE,100); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NULL); +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi diff --git a/tests/script/general/parser/interp_full_test2.sim b/tests/script/general/parser/interp_full_test2.sim new file mode 100644 index 0000000000000000000000000000000000000000..e044ef572bbb97d7d71ec96821e8f0e65b21389e --- /dev/null +++ b/tests/script/general/parser/interp_full_test2.sim @@ -0,0 +1,2360 @@ +sleep 100 +sql connect + +sql use db; + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 7 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 8 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 9 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 11 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 13 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 3622 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) limit 10 offset 3612; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NEXT); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 14401 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 1 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) limit 1 offset 14400; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(PREV); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) limit 5 offset 14396; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 18001 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100) limit 20 offset 3600; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(VALUE,100); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data90 != @21-10-20 11:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 18001 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL) limit 20 offset 3600; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NULL); +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NULL); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +if $rows != 10801 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 11:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data90 != @21-10-20 11:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:03.500@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.500@ then + return -1 +endi +if $data11 != 4 then + return -1 +endi +if $data20 != @21-10-20 10:00:05.500@ then + return -1 +endi +if $data21 != 5 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.500@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.500@ then + return -1 +endi +if $data41 != 7 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.500@ then + return -1 +endi +if $data51 != 8 then + return -1 +endi +if $data60 != @21-10-20 10:00:09.500@ then + return -1 +endi +if $data61 != 9 then + return -1 +endi +if $data70 != @21-10-20 10:00:10.500@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:11.500@ then + return -1 +endi +if $data81 != 11 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.500@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + + +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:03.500@ then + return -1 +endi +if $data01 != 3.50000 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.500@ then + return -1 +endi +if $data11 != 4.50000 then + return -1 +endi +if $data20 != @21-10-20 10:00:05.500@ then + return -1 +endi +if $data21 != 5.50000 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.500@ then + return -1 +endi +if $data31 != 6.50000 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.500@ then + return -1 +endi +if $data41 != 7.50000 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.500@ then + return -1 +endi +if $data51 != 8.50000 then + return -1 +endi +if $data60 != @21-10-20 10:00:09.500@ then + return -1 +endi +if $data61 != 9.50000 then + return -1 +endi +if $data70 != @21-10-20 10:00:10.500@ then + return -1 +endi +if $data71 != 10.50000 then + return -1 +endi +if $data80 != @21-10-20 10:00:11.500@ then + return -1 +endi +if $data81 != 11.50000 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.500@ then + return -1 +endi +if $data91 != 12.50000 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 11 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 13 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 14 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:11' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +if $rows != 16 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(LINEAR); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 11 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 13 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 14 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(LINEAR); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(PREV); +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(PREV); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(PREV); +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(NEXT); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 09:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 09:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 09:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 09:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 09:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 09:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 09:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 09:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(NEXT); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(NEXT); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NULL); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(LINEAR); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(PREV); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NEXT); +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(VALUE,100); +if $rows != 0 then + return -1 +endi + + + +print ================== start DESC test + +sql SELECT INTERP(c1) FROM tb1 ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT ts,INTERP(c1) FROM tb1 ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data02 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 where ts > '2021-10-20 10:00:03' ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +sql SELECT INTERP(c1,c2,c3,c4,c6,c5) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 21.00000 then + return -1 +endi +if $data03 != 21 then + return -1 +endi +if $data04 != 21 then + return -1 +endi +if $data05 != 21.000000000 then + return -1 +endi +if $data06 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 15.00000 then + return -1 +endi +if $data13 != 15 then + return -1 +endi +if $data14 != 15 then + return -1 +endi +if $data15 != 15.000000000 then + return -1 +endi +if $data16 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 10.00000 then + return -1 +endi +if $data23 != 10 then + return -1 +endi +if $data24 != 10 then + return -1 +endi +if $data25 != 10.000000000 then + return -1 +endi +if $data26 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data34 != 6 then + return -1 +endi +if $data35 != 6.000000000 then + return -1 +endi +if $data36 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 3.00000 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 3 then + return -1 +endi +if $data45 != 3.000000000 then + return -1 +endi +if $data46 != 3 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1.00000 then + return -1 +endi +if $data53 != 1 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 1.000000000 then + return -1 +endi +if $data56 != 1 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 0.00000 then + return -1 +endi +if $data63 != 0 then + return -1 +endi +if $data64 != 0 then + return -1 +endi +if $data65 != 0.000000000 then + return -1 +endi +if $data66 != 0 then + return -1 +endi + +sql SELECT INTERP(c1),interp(c2),interp(c3) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 0.00000 then + return -1 +endi +if $data63 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1.00000 then + return -1 +endi +if $data53 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 3.00000 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 6.00000 then + return -1 +endi +if $data33 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 10.00000 then + return -1 +endi +if $data23 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 15.00000 then + return -1 +endi +if $data13 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 21.00000 then + return -1 +endi +if $data03 != 21 then + return -1 +endi + +sql SELECT INTERP(c1),ts FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != @21-10-20 10:00:21.000@ then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC; +if $rows != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data82 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +if $data92 != tb2 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 5; +if $rows != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 3; +if $rows != 9 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data32 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 12 then + return -1 +endi +if $data42 != tb2 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data52 != tb2 then + return -1 +endi +if $data60 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data71 != 18 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname ORDER BY ts DESC limit 3 offset 6; +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data12 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi + +sql SELECT INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname ORDER BY ts DESC; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 21.00000 then + return -1 +endi +if $data04 != 1 then + return -1 +endi +if $data05 != 21 then + return -1 +endi +if $data06 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data13 != 15.00000 then + return -1 +endi +if $data14 != 1 then + return -1 +endi +if $data15 != 15 then + return -1 +endi +if $data16 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data23 != 10.00000 then + return -1 +endi +if $data24 != 1 then + return -1 +endi +if $data25 != 10 then + return -1 +endi +if $data26 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data32 != 1 then + return -1 +endi +if $data33 != 6.00000 then + return -1 +endi +if $data34 != 1 then + return -1 +endi +if $data35 != 6 then + return -1 +endi +if $data36 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data42 != 1 then + return -1 +endi +if $data43 != 3.00000 then + return -1 +endi +if $data44 != 1 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data52 != 1 then + return -1 +endi +if $data53 != 1.00000 then + return -1 +endi +if $data54 != 1 then + return -1 +endi +if $data55 != 1 then + return -1 +endi +if $data56 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data62 != 1 then + return -1 +endi +if $data63 != 0.00000 then + return -1 +endi +if $data64 != 1 then + return -1 +endi +if $data65 != 0 then + return -1 +endi +if $data66 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != 2 then + return -1 +endi +if $data73 != 14.00000 then + return -1 +endi +if $data74 != 2 then + return -1 +endi +if $data75 != 14 then + return -1 +endi +if $data76 != tb2 then + return -1 +endi +if $data80 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data81 != 12 then + return -1 +endi +if $data82 != 2 then + return -1 +endi +if $data83 != 12.00000 then + return -1 +endi +if $data84 != 2 then + return -1 +endi +if $data85 != 12 then + return -1 +endi +if $data86 != tb2 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +if $data92 != 2 then + return -1 +endi +if $data93 != 10.00000 then + return -1 +endi +if $data94 != 2 then + return -1 +endi +if $data95 != 10 then + return -1 +endi +if $data96 != tb2 then + return -1 +endi diff --git a/tests/script/general/parser/interp_full_test3.sim b/tests/script/general/parser/interp_full_test3.sim new file mode 100644 index 0000000000000000000000000000000000000000..94745211e4efb71ee96e5e9161f901a2ccb52a71 --- /dev/null +++ b/tests/script/general/parser/interp_full_test3.sim @@ -0,0 +1,2401 @@ +sleep 100 +sql connect + +sql use db; + + +sql SELECT tbname,INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(4s) group by tbname ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != tb1 then + return -1 +endi +if $data02 != 0 then + return -1 +endi +if $data03 != 1 then + return -1 +endi +if $data04 != 0.00000 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data06 != 0 then + return -1 +endi +if $data07 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data31 != tb2 then + return -1 +endi +if $data32 != 0 then + return -1 +endi +if $data33 != 2 then + return -1 +endi +if $data34 != 0.00000 then + return -1 +endi +if $data35 != 2 then + return -1 +endi +if $data36 != 0 then + return -1 +endi +if $data37 != tb2 then + return -1 +endi +if $data20 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data21 != tb2 then + return -1 +endi +if $data22 != 4 then + return -1 +endi +if $data23 != 2 then + return -1 +endi +if $data24 != 4.00000 then + return -1 +endi +if $data25 != 2 then + return -1 +endi +if $data26 != 4 then + return -1 +endi +if $data27 != tb2 then + return -1 +endi +if $data10 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data11 != tb2 then + return -1 +endi +if $data12 != 12 then + return -1 +endi +if $data13 != 2 then + return -1 +endi +if $data14 != 12.00000 then + return -1 +endi +if $data15 != 2 then + return -1 +endi +if $data16 != 12 then + return -1 +endi +if $data17 != tb2 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != tb3 then + return -1 +endi +if $data42 != 0 then + return -1 +endi +if $data43 != 3 then + return -1 +endi +if $data44 != 0.00000 then + return -1 +endi +if $data45 != 3 then + return -1 +endi +if $data46 != 0 then + return -1 +endi +if $data47 != tb3 then + return -1 +endi +sql SELECT INTERP(c1) FROM stb1 range('2021-10-20 10:00:00.000','2021-10-20 10:00:40.000') every(1s) fill(linear) group by tbname ORDER BY ts DESC; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data02 != tb1 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data12 != tb1 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data22 != tb1 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data32 != tb1 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data42 != tb1 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data52 != tb1 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data62 != tb1 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data72 != tb1 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data82 != tb1 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi +if $data92 != tb1 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(VALUE, 100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 every(2s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 every(5s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 every(100s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 4 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100.00000 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0.00000 then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 11:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 7 then + return -1 +endi +if $data60 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data51 != 1 then + return -1 +endi +if $data40 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data41 != 3 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 4 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(2s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 2 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(2s) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 10 offset 10; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 3 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 3 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 1 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 10 offset 20; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(1s) FILL(NULL) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 5 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 20 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(PREV) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != 100 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 EVERY(5s) FILL(NULL) ORDER BY ts DESC; +if $rows != 5 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data00 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC limit 20 offset 10; +if $rows != 12 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 11 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 9 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 8 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 7 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 5 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 4 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 2 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 20 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 19 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 18 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 17 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 16 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 14 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 13 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 12 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 3622 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 20 offset 10 ; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data01 != 15 then + return -1 +endi +if $data10 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC limit 20 offset 20 ; +if $rows != 20 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1 then + return -1 +endi +if $data10 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 09:59:59.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 09:59:58.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 09:59:57.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 09:59:56.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 09:59:55.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 09:59:54.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 09:59:53.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 09:59:52.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 2 then + return -1 +endi +if $data00 != @21-10-20 09:00:01.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 09:00:00.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 18 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 14401 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 13:59:59.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi +if $data20 != @21-10-20 13:59:58.000@ then + return -1 +endi +if $data21 != 21 then + return -1 +endi +if $data30 != @21-10-20 13:59:57.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 13:59:56.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi +if $data50 != @21-10-20 13:59:55.000@ then + return -1 +endi +if $data51 != 21 then + return -1 +endi +if $data60 != @21-10-20 13:59:54.000@ then + return -1 +endi +if $data61 != 21 then + return -1 +endi +if $data70 != @21-10-20 13:59:53.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 13:59:52.000@ then + return -1 +endi +if $data81 != 21 then + return -1 +endi +if $data90 != @21-10-20 13:59:51.000@ then + return -1 +endi +if $data91 != 21 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 30 offset 14379; +if $rows != 22 then + return -1 +endi +if $data00 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data11 != 15 then + return -1 +endi +if $data20 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data21 != 15 then + return -1 +endi +if $data30 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data31 != 15 then + return -1 +endi +if $data40 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 14397 then + return -1 +endi +if $data00 != @21-10-20 14:00:00.000@ then + return -1 +endi +if $data01 != 21 then + return -1 +endi +if $data10 != @21-10-20 13:59:59.000@ then + return -1 +endi +if $data11 != 21 then + return -1 +endi + + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC limit 20 offset 14387; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data81 != 3 then + return -1 +endi +if $data90 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data91 != 3 then + return -1 +endi + +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100) limit 20 offset 3600; +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(VALUE,100); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL) limit 20 offset 3600; +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 09:00:00','2021-10-20 09:00:01') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:04','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 11:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NULL); +sql SELECT INTERP(c1) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c2) FROM tb1 RANGE('2021-10-20 10:00:03.500','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:11' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 10:00:00','2021-10-20 14:00:00') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(PREV); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:15' RANGE('2021-10-20 09:00:00','2021-10-20 09:00:10') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:05','2021-10-20 10:00:16') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:15','2021-10-20 10:00:25') EVERY(1s) FILL(NEXT); +sql SELECT INTERP(c1) FROM tb1 WHERE ts BETWEEN '2021-10-20 10:00:10' AND '2021-10-20 10:00:20' RANGE('2021-10-20 10:00:21','2021-10-20 10:00:30') EVERY(1s) FILL(NEXT); + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') FILL(NULL) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NULL) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(LINEAR) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(PREV) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(NEXT) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c2) FROM tb4 RANGE('2021-10-20 10:00:00','2021-10-20 12:00:00') EVERY(1s) FILL(VALUE,100) ORDER BY ts DESC; +if $rows != 0 then + return -1 +endi + +sql SELECT INTERP(c1) FROM stb1 RANGE('2021-10-20 10:00:00','2021-10-20 10:00:30') EVERY(1s) FILL(LINEAR) GROUP BY TBNAME ORDER BY TBNAME desc; +if $rows != 59 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data02 != tb3 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data12 != tb3 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data22 != tb3 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data32 != tb3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data42 != tb3 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data52 != tb3 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data62 != tb3 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data72 != tb3 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data82 != tb3 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi +if $data92 != tb3 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts; +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30'); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts fill(linear); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') fill(next); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s) fill(prev); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi + diff --git a/tests/script/general/parser/interp_full_test4.sim b/tests/script/general/parser/interp_full_test4.sim new file mode 100644 index 0000000000000000000000000000000000000000..70796bd8b61bdd0706474b8f1ce58b71ef2aba98 --- /dev/null +++ b/tests/script/general/parser/interp_full_test4.sim @@ -0,0 +1,1499 @@ +sleep 100 +sql connect + +sql use db; + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts every(1s) fill(prev) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s); +if $rows != 3 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(linear); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 1 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 2 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 3 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 4 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 7 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 8 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 9 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(linear) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 9 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 8 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 7 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 5 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 4 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 3 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 2 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 1 then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 0 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 0 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 0 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) limit 30 offset 10; +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) order by ts desc; +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(prev) order by ts desc limit 10 offset 21; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data01 != 6 then + return -1 +endi +if $data10 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != 0 then + return -1 +endi +if $data60 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data61 != 0 then + return -1 +endi +if $data70 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data71 != 0 then + return -1 +endi +if $data80 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data81 != 0 then + return -1 +endi +if $data90 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(next); +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 10 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 10 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(next) order by ts desc; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 6 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 6 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 6 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 6 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL) order by ts desc; +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:30.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:29.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:28.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data40 != @21-10-20 10:00:26.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:25.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data70 != @21-10-20 10:00:23.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:22.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data91 != NULL then + return -1 +endi + +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(NULL) order by ts desc limit 10 offset 21; +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data10 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data30 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data31 != 6 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data50 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data51 != NULL then + return -1 +endi +if $data60 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data70 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data71 != NULL then + return -1 +endi +if $data80 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data81 != NULL then + return -1 +endi +if $data90 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data91 != 0 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(VALUE,100); +if $rows != 31 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 100 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi +sql select interp(c1) from tb1,tb2 where tb1.ts=tb2.ts range('2021-10-20 10:00:00','2021-10-20 10:00:30') every(1s) fill(VALUE,100) order by ts desc limit 20 offset 20; +if $rows != 11 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 100 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 100 then + return -1 +endi +if $data30 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data31 != 100 then + return -1 +endi +if $data40 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data41 != 6 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 100 then + return -1 +endi +if $data60 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data61 != 100 then + return -1 +endi +if $data70 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data71 != 100 then + return -1 +endi +if $data80 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data81 != 100 then + return -1 +endi +if $data90 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data91 != 100 then + return -1 +endi + +sql select interp(c1) from (select ts,c1 from tb1); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(c1) from (select ts,c1 from tb1 order by ts); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + + +sql select interp(a) from (select sum(c1) as a from stb1 interval(1s)); +if $rows != 1 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi + +sql select interp(a) from (select top(c1,3) as a from tb1 order by ts) every(1s) fill(prev); +if $rows != 12 then + return -1 +endi +if $data00 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data01 != 10 then + return -1 +endi +if $data10 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data61 != 15 then + return -1 +endi +if $data70 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:19.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql select interp(a) from (select max(c1) as a from tb1 interval(6s)) every(1s) fill(next); +if $rows != 19 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 3 then + return -1 +endi +if $data10 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data11 != 10 then + return -1 +endi +if $data20 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data21 != 10 then + return -1 +endi +if $data30 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data31 != 10 then + return -1 +endi +if $data40 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data41 != 10 then + return -1 +endi +if $data50 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data51 != 10 then + return -1 +endi +if $data60 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data61 != 10 then + return -1 +endi +if $data70 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data71 != 15 then + return -1 +endi +if $data80 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data81 != 15 then + return -1 +endi +if $data90 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data91 != 15 then + return -1 +endi + +sql select interp(a) from (select diff(c2) as a from tb1) every(1s) fill(linear); +if $rows != 21 then + return -1 +endi +if $data00 != @21-10-20 10:00:01.000@ then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +if $data10 != @21-10-20 10:00:02.000@ then + return -1 +endi +if $data11 != 1.50000 then + return -1 +endi +if $data20 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data21 != 2.00000 then + return -1 +endi +if $data30 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data31 != 2.33333 then + return -1 +endi +if $data40 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data41 != 2.66667 then + return -1 +endi +if $data50 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data51 != 3.00000 then + return -1 +endi +if $data60 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data61 != 3.25000 then + return -1 +endi +if $data70 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data71 != 3.50000 then + return -1 +endi +if $data80 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data81 != 3.75000 then + return -1 +endi +if $data90 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data91 != 4.00000 then + return -1 +endi + +sql select interp(a) from (select sum(c2) as a from stb1 interval(6s)) RANGE('2021-10-20 10:00:05.000','2021-10-20 10:00:20.000') every(1s) fill(linear); +if $rows != 14 then + return -1 +endi +if $data00 != @21-10-20 10:00:05.000@ then + return -1 +endi +if $data01 != 42.166666667 then + return -1 +endi +if $data10 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data11 != 48.000000000 then + return -1 +endi +if $data20 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data21 != 46.833333333 then + return -1 +endi +if $data30 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data31 != 45.666666667 then + return -1 +endi +if $data40 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data41 != 44.500000000 then + return -1 +endi +if $data50 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data51 != 43.333333333 then + return -1 +endi +if $data60 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data61 != 42.166666667 then + return -1 +endi +if $data70 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data71 != 41.000000000 then + return -1 +endi +if $data80 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data81 != 44.166666667 then + return -1 +endi +if $data90 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data91 != 47.333333333 then + return -1 +endi + +sql select interp(a) from (select interp(c1) b,interp(c2) a from tb1 where ts < '2021-10-20 10:00:15.000' range('2021-10-20 10:00:05.000','2021-10-20 10:00:20.000') every(3s) fill(prev)) where ts between '2021-10-20 10:00:06.000' and '2021-10-20 10:00:18.000' range('2021-10-20 10:00:00.000','2021-10-20 10:00:25.000') every(1s) fill(linear); +if $rows != 10 then + return -1 +endi +if $data00 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data01 != 6.00000 then + return -1 +endi +if $data10 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data11 != 7.33333 then + return -1 +endi +if $data20 != @21-10-20 10:00:10.000@ then + return -1 +endi +if $data21 != 8.66667 then + return -1 +endi +if $data30 != @21-10-20 10:00:11.000@ then + return -1 +endi +if $data31 != 10.00000 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 10.00000 then + return -1 +endi +if $data50 != @21-10-20 10:00:13.000@ then + return -1 +endi +if $data51 != 10.00000 then + return -1 +endi +if $data60 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data61 != 10.00000 then + return -1 +endi +if $data70 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data71 != 10.00000 then + return -1 +endi +if $data80 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data81 != 10.00000 then + return -1 +endi +if $data90 != @21-10-20 10:00:17.000@ then + return -1 +endi +if $data91 != 10.00000 then + return -1 +endi + +sql select interp(a) from (select interp(c4) a from tb1,tb4_0 where tb1.ts=tb4_0.ts every(3s) fill(linear)) every(4s) fill(prev); +if $rows != 6 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:04.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:08.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data31 != 12 then + return -1 +endi +if $data40 != @21-10-20 10:00:16.000@ then + return -1 +endi +if $data41 != 15 then + return -1 +endi +if $data50 != @21-10-20 10:00:20.000@ then + return -1 +endi +if $data51 != 18 then + return -1 +endi + +sql select interp(c4) from tb1 every(7s) fill(linear) union all select interp(c4) from tb4_0 every(33s) fill(prev); +if $rows != 13 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:07.000@ then + return -1 +endi +if $data11 != 7 then + return -1 +endi +if $data20 != @21-10-20 10:00:14.000@ then + return -1 +endi +if $data21 != 14 then + return -1 +endi +if $data30 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data31 != 21 then + return -1 +endi +if $data40 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data41 != 0 then + return -1 +endi +if $data50 != @21-10-20 10:00:33.000@ then + return -1 +endi +if $data51 != 28 then + return -1 +endi +if $data60 != @21-10-20 10:01:06.000@ then + return -1 +endi +if $data61 != 6 then + return -1 +endi +if $data70 != @21-10-20 10:01:39.000@ then + return -1 +endi +if $data71 != 36 then + return -1 +endi +if $data80 != @21-10-20 10:02:12.000@ then + return -1 +endi +if $data81 != 10 then + return -1 +endi +if $data90 != @21-10-20 10:02:45.000@ then + return -1 +endi +if $data91 != 45 then + return -1 +endi + +sql select interp(c3) from tb4_0 every(3s) fill(linear); +if $rows != 99 then + return -1 +endi +if $data00 != @21-10-20 10:00:00.000@ then + return -1 +endi +if $data01 != 0 then + return -1 +endi +if $data10 != @21-10-20 10:00:03.000@ then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data20 != @21-10-20 10:00:06.000@ then + return -1 +endi +if $data21 != 6 then + return -1 +endi +if $data30 != @21-10-20 10:00:09.000@ then + return -1 +endi +if $data31 != 9 then + return -1 +endi +if $data40 != @21-10-20 10:00:12.000@ then + return -1 +endi +if $data41 != 12 then + return -1 +endi +if $data50 != @21-10-20 10:00:15.000@ then + return -1 +endi +if $data51 != 15 then + return -1 +endi +if $data60 != @21-10-20 10:00:18.000@ then + return -1 +endi +if $data61 != 18 then + return -1 +endi +if $data70 != @21-10-20 10:00:21.000@ then + return -1 +endi +if $data71 != 21 then + return -1 +endi +if $data80 != @21-10-20 10:00:24.000@ then + return -1 +endi +if $data81 != 24 then + return -1 +endi +if $data90 != @21-10-20 10:00:27.000@ then + return -1 +endi +if $data91 != 27 then + return -1 +endi + +sql select interp(c3) from tb4_0 every(5s) fill(linear) order by ts desc; +if $rows != 60 then + return -1 +endi + + +sql select interp(c3) from tb4_0 where ts > '2021-10-20 10:04:15.000' and ts < '2021-10-20 10:04:55.000' every(5s) fill(linear) order by ts desc; +if $rows != 5 then + return -1 +endi +if $data00 != @21-10-20 10:04:41.000@ then + return -1 +endi +if $data01 != 41 then + return -1 +endi +if $data10 != @21-10-20 10:04:36.000@ then + return -1 +endi +if $data11 != 36 then + return -1 +endi +if $data20 != @21-10-20 10:04:31.000@ then + return -1 +endi +if $data21 != 31 then + return -1 +endi +if $data30 != @21-10-20 10:04:26.000@ then + return -1 +endi +if $data31 != 26 then + return -1 +endi +if $data40 != @21-10-20 10:04:21.000@ then + return -1 +endi +if $data41 != 21 then + return -1 +endi diff --git a/tests/script/general/parser/interp_test.sim b/tests/script/general/parser/interp_test.sim deleted file mode 100644 index 8eac8a41d391508737232a3f068c477922bf77aa..0000000000000000000000000000000000000000 --- a/tests/script/general/parser/interp_test.sim +++ /dev/null @@ -1,2496 +0,0 @@ -sleep 100 -sql connect - -$dbPrefix = intp_db -$tbPrefix = intp_tb -$stbPrefix = intp_stb -$tbNum = 4 -$rowNum = 10000 -$totalNum = $tbNum * $rowNum -$ts0 = 1537146000000 -$delta = 600000 -print ========== intp_test.sim -$i = 0 -$db = $dbPrefix . $i -$stb = $stbPrefix . $i -$tsu = $rowNum * $delta -$tsu = $tsu - $delta -$tsu = $tsu + $ts0 - -print ====== use db -sql use $db - -##### select interp from table -print ====== select intp from table -$tb = $tbPrefix . 0 -## interp(*) from tb -sql select interp(*) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi - -## interp + limit offset -sql select interp(*) from $tb where ts = $ts0 limit 5 offset 1 -if $rows != 0 then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -## intp + aggregation functions -$t = $ts0 + $delta -$t = $t + $delta -sql_error select interp(ts), max(c1), min(c2), count(c3), sum(c4), avg(c5), stddev(c6), first(c7), last(c8), interp(c9) from $tb where ts = $t -sql_error select interp(ts) from $tb where ts=$ts0 interval(1s) - -### illegal queries on a table -sql_error select interp(ts), c1 from $tb where ts = $ts0 -sql_error select interp(ts) from $tb where ts >= $ts0 -sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(NULL) - -### interp from tb + fill -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t -if $rows != 0 then - return -1 -endi - -## fill(none) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi - -## fill(NULL) -$t = $tsu - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc -if $rows != 1 then - return -1 -endi -if $data00 != @18-11-25 19:29:59.000@ then - return -1 -endi -if $data01 != NULL then - print expect NULL, actual $data01 - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != NULL then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data06 != NULL then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(none) -if $rows != 0 then - return -1 -endi - -## fill(prev) -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi - -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(prev) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - print expect 0.00000, actual:$data03 - return -1 -endi -# if $data04 != NULL then -# return -1 -# endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(prev) -if $rows != 0 then - return -1 -endi - -## fill(linear) -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -print $data03 -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -# columns contain NULL values -$t = $ts0 + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $t fill(linear) -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -# columns contain NULL values - -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(linear) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi - -$t = $tsu + 1000 -print select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(linear) -if $rows != 0 then - return -1 -endi - -## fill(value) -$t = $ts0 + 1000 -print 91 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi - -# table has NULL columns -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3) -if $rows != 1 then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi - -$t = $ts0 - 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi - -$t = $tsu + 1000 -sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, -1, -2) -if $rows != 0 then - return -1 -endi - -### select interp from stable -## interp(*) from stb -print select interp(*) from $stb where ts = $ts0 -sql select interp(*) from $stb where ts = $ts0 -if $rows != 1 then - return -1 -endi -$t = $ts0 + 1000 -print 92 - -sql select interp(*) from $stb where ts = $t -if $rows != 0 then - return -1 -endi -## interp(*) from stb + group by -sql select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc -print ====== select interp(ts, c1, c2, c3, c4, c5, c7, c9) from $stb where ts = $ts0 group by tbname order by tbname asc -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:00.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data08 != intp_tb0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data28 != intp_tb2 then - return -1 -endi - -## interp(*) from stb + group by + limit offset -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 -if $rows != 0 then - return -1 -endi -sql select interp(*) from $stb where ts = $ts0 group by tbname limit 0 offset 1 - -## interp(*) from stb + group by + fill(none) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(none) group by tbname -if $rows != 0 then - return -1 -endi - -sql select interp(*) from $stb where ts = $ts0 fill(none) group by tbname -if $rows != 4 then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi - -## interp(*) from stb + group by + fill(none) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data12 != NULL then - return -1 -endi -if $data23 != NULL then - return -1 -endi -if $data34 != NULL then - return -1 -endi -if $data05 != NULL then - return -1 -endi -if $data16 != NULL then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data38 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi - -sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname -print $rows - -if $rows != 4 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -if $data02 != 0 then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data24 != NULL then - return -1 -endi - -## interp(*) from stb + group by + fill(prev) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(prev) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00000 then - return -1 -endi -if $data04 != 0.000000000 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary0 then - return -1 -endi -if $data09 != nchar0 then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00000 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != binary0 then - return -1 -endi -if $data29 != nchar0 then - return -1 -endi - -## interp(*) from stb + group by + fill(linear) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(linear) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0.00167 then - return -1 -endi -if $data04 != 0.001666667 then - return -1 -endi -if $data05 != 0 then - return -1 -endi -if $data06 != 0 then - return -1 -endi -if $data07 != NULL then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data22 != NULL then - return -1 -endi -if $data23 != 0.00167 then - return -1 -endi -if $data24 != NULL then - return -1 -endi -if $data25 != 0 then - return -1 -endi -if $data26 != 0 then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi - - ## interp(*) from stb + group by + fill(value) -$t = $ts0 + 1000 -sql select interp(*) from $stb where ts = $t fill(value, -1, -2) group by tbname -print ====== 0:$data00, 1:$data01, 2:$data02, 3:$data03, 4:$data04, 5:$data05, 6:$data06, 7:$data07, 8:$data08, 9:$data09 -print ====== 0:$data20, 1:$data21, 2:$data22, 3:$data23, 4:$data24, 5:$data25, 6:$data26, 7:$data27, 8:$data28, 9:$data29 -if $rows != $tbNum then - return -1 -endi -if $data00 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data01 != -2 then - return -1 -endi -if $data02 != -2 then - return -1 -endi -if $data03 != -2.00000 then - return -1 -endi -if $data04 != -2.000000000 then - return -1 -endi -if $data05 != -2 then - return -1 -endi -if $data06 != -2 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != NULL then - return -1 -endi -if $data09 != NULL then - return -1 -endi -if $data20 != @18-09-17 09:00:01.000@ then - return -1 -endi -if $data21 != -2 then - return -1 -endi -if $data22 != -2 then - return -1 -endi -if $data23 != -2.00000 then - return -1 -endi -if $data24 != -2.000000000 then - return -1 -endi -if $data25 != -2 then - return -1 -endi -if $data26 != -2 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != NULL then - return -1 -endi -if $data29 != NULL then - return -1 -endi - -sql_error select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12'; -sql select interp(ts,c1) from intp_tb0 where ts>'2018-11-25 19:19:00' and ts<'2018-11-25 19:19:12' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi - -sql select interp(c1) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m); -if $rows != 1 then - return -1 -endi - -if $data00 != @18-11-25 18:30:00.000@ then - return -1 -endi - -if $data01 != 3 then - return -1 -endi - -sql select interp(c1,c3,c4,ts) from intp_tb0 where ts>'2018-11-25 18:09:00' and ts<'2018-11-25 19:20:12' every(18m) fill(linear) -if $rows != 5 then - return -1 -endi - -if $data00 != @18-11-25 17:54:00.000@ then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -if $data02 != 0.00000 then - return -1 -endi - -if $data03 != 0.000000000 then - return -1 -endi - -if $data04 != @18-11-25 17:54:00.000@ then - return -1 -endi - -if $data10 != @18-11-25 18:12:00.000@ then - return -1 -endi - -if $data11 != 1 then - return -1 -endi - -if $data12 != 1.20000 then - return -1 -endi - -if $data13 != 1.200000000 then - return -1 -endi - -if $data14 != @18-11-25 18:12:00.000@ then - return -1 -endi - -if $data40 != @18-11-25 19:06:00.000@ then - return -1 -endi - -if $data41 != 6 then - return -1 -endi - -if $data42 != 6.60000 then - return -1 -endi - -if $data43 != 6.600000000 then - return -1 -endi - -if $data44 != @18-11-25 19:06:00.000@ then - return -1 -endi - - -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear); -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data51 != 0 then - return -1 -endi -if $data60 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi - - -sql select interp(c1) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:42:00.000' every(1m) fill(linear) order by ts desc; -if $rows != 8 then - return -1 -endi -if $data00 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:41:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data21 != 0 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:37:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi -if $data60 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @18-09-17 20:35:00.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(2m) fill(linear) order by ts; -if $rows != 9 then - return -1 -endi -if $data00 != @18-09-17 20:34:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:38:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:40:00.000@ then - return -1 -endi -if $data31 != 0.00000 then - return -1 -endi -if $data40 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data41 != 0.20000 then - return -1 -endi -if $data50 != @18-09-17 20:44:00.000@ then - return -1 -endi -if $data51 != 0.40000 then - return -1 -endi -if $data60 != @18-09-17 20:46:00.000@ then - return -1 -endi -if $data61 != 0.60000 then - return -1 -endi -if $data70 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data71 != 0.80000 then - return -1 -endi -if $data80 != @18-09-17 20:50:00.000@ then - return -1 -endi -if $data81 != 1.00000 then - return -1 -endi - - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data31 != 0.20000 then - return -1 -endi -if $data40 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data41 != 0.50000 then - return -1 -endi -if $data50 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data51 != 0.80000 then - return -1 -endi - -sql select interp(c3) from intp_stb0 where ts >= '2018-09-17 20:35:00.000' and ts <= '2018-09-17 20:50:00.000' every(3m) fill(linear) order by ts desc; -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 20:48:00.000@ then - return -1 -endi -if $data01 != 0.80000 then - return -1 -endi -if $data10 != @18-09-17 20:45:00.000@ then - return -1 -endi -if $data11 != 0.50000 then - return -1 -endi -if $data20 != @18-09-17 20:42:00.000@ then - return -1 -endi -if $data21 != 0.20000 then - return -1 -endi -if $data30 != @18-09-17 20:39:00.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @18-09-17 20:36:00.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @18-09-17 20:33:00.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi - - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(linear); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(value, 1); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 1.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 1.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 1.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(NULL); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != NULL then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != NULL then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(prev); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:00' every(1s) fill(next); -if $rows != 6 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(linear); -if $rows != 0 then - return -1 -endi -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(prev); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:56' every(1s) fill(next); -if $rows != 2 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(linear); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(prev); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:19:57' every(1s) fill(next); -if $rows != 3 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(linear); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(prev); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:03' every(1s) fill(next); -if $rows != 10 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != NULL then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != NULL then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != NULL then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != NULL then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(linear); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(prev); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:05' every(1s) fill(next); -if $rows != 12 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(value, 1); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != 1.00000 then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != 1.00000 then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:20:02' and ts<='2021-07-25 02:20:05' every(1s) fill(null); -if $rows != 4 then - return -1 -endi -if $data00 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -if $data20 != @21-07-25 02:20:04.000@ then - return -1 -endi -if $data21 != NULL then - return -1 -endi -if $data30 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data31 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(linear); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(prev); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:20:25' every(1s) fill(next); -if $rows != 32 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(linear); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(prev); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 02:25:00' every(1s) fill(next); -if $rows != 307 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(linear); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.31818 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.77273 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.50000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.50000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.87500 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.11765 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 15.29412 then - return -1 -endi - - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(prev); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 3.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 3.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 4.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 7.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 9.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 14.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 14.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 14.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 14.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<='2021-07-25 03:25:00' every(1s) fill(next); -if $rows != 3907 then - return -1 -endi -if $data00 != @21-07-25 02:19:54.000@ then - return -1 -endi -if $data01 != 1.00000 then - return -1 -endi -if $data10 != @21-07-25 02:19:55.000@ then - return -1 -endi -if $data11 != 4.00000 then - return -1 -endi -if $data20 != @21-07-25 02:19:56.000@ then - return -1 -endi -if $data21 != 4.00000 then - return -1 -endi -if $data30 != @21-07-25 02:19:57.000@ then - return -1 -endi -if $data31 != 5.00000 then - return -1 -endi -if $data40 != @21-07-25 02:19:58.000@ then - return -1 -endi -if $data41 != 8.00000 then - return -1 -endi -if $data50 != @21-07-25 02:19:59.000@ then - return -1 -endi -if $data51 != 10.00000 then - return -1 -endi -if $data60 != @21-07-25 02:20:00.000@ then - return -1 -endi -if $data61 != 20.00000 then - return -1 -endi -if $data70 != @21-07-25 02:20:01.000@ then - return -1 -endi -if $data71 != 20.00000 then - return -1 -endi -if $data80 != @21-07-25 02:20:02.000@ then - return -1 -endi -if $data81 != 20.00000 then - return -1 -endi -if $data90 != @21-07-25 02:20:03.000@ then - return -1 -endi -if $data91 != 20.00000 then - return -1 -endi - -sql select interp(pav) from ap1 where ts> '2021-07-25 02:19:54' and ts<'2021-07-25 02:20:07' every(1s); -if $rows != 1 then - return -1 -endi -if $data00 != @21-07-25 02:20:05.000@ then - return -1 -endi -if $data01 != 20.00000 then - return -1 -endi - diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index fcd9d49fe555ae749da0fcd799e1866a8a05f656..84c9e89d872679f92f45a522ae3f6483b9ebf77f 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -20,7 +20,7 @@ run general/parser/import_commit3.sim run general/parser/import_file.sim run general/parser/insert_tb.sim run general/parser/tags_dynamically_specifiy.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/lastrow.sim run general/parser/limit.sim run general/parser/limit1.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 850f3a19467a8748bba56f80033d4fc0b0bc77a3..2696b93acedd8c116dfd0922798012c27c8e8692 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -75,7 +75,7 @@ cd ../../../debug; make ./test.sh -f general/parser/where.sim ./test.sh -f general/parser/slimit.sim ./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/interp_full.sim ./test.sh -f general/parser/tags_dynamically_specifiy.sim ./test.sh -f general/parser/groupby.sim ./test.sh -f general/parser/set_tag_vals.sim diff --git a/tests/script/jenkins/simple.txt b/tests/script/jenkins/simple.txt index 88ff4d660131bea5dee2f5ccd0dad9d81c7bed5f..a0a2f5191768b70638aa45fa9ad97f73c91d4d86 100644 --- a/tests/script/jenkins/simple.txt +++ b/tests/script/jenkins/simple.txt @@ -138,7 +138,7 @@ cd ../../../debug; make ./test.sh -f general/parser/where.sim ./test.sh -f general/parser/slimit.sim ./test.sh -f general/parser/select_with_tags.sim -./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/interp_full.sim ./test.sh -f general/parser/tags_dynamically_specifiy.sim ./test.sh -f general/parser/groupby.sim ./test.sh -f general/parser/set_tag_vals.sim diff --git a/tests/script/jenkins/wbasic.txt b/tests/script/jenkins/wbasic.txt index 984b15fc5a4e49a5e730667782b41afb8bdb6bb8..22fee77344371a634086ebf2a37a9bf5b03a7f6b 100644 --- a/tests/script/jenkins/wbasic.txt +++ b/tests/script/jenkins/wbasic.txt @@ -143,7 +143,7 @@ wtest.bat -f general/parser/fill_stb.sim wtest.bat -f general/parser/where.sim wtest.bat -f general/parser/slimit.sim wtest.bat -f general/parser/select_with_tags.sim -wtest.bat -f general/parser/interp.sim +wtest.bat -f general/parser/interp_full.sim wtest.bat -f general/parser/tags_dynamically_specifiy.sim wtest.bat -f general/parser/groupby.sim wtest.bat -f general/parser/set_tag_vals.sim diff --git a/tests/script/regressionSuite.sim b/tests/script/regressionSuite.sim index faa6672b42be666d17bafe5a6176d95cdbbc27a8..a705601d96f64f2690c3b933228b02b49d59af68 100644 --- a/tests/script/regressionSuite.sim +++ b/tests/script/regressionSuite.sim @@ -129,7 +129,7 @@ run general/parser/limit2.sim run general/parser/slimit.sim run general/parser/fill.sim run general/parser/fill_stb.sim -run general/parser/interp.sim +run general/parser/interp_full.sim run general/parser/where.sim run general/parser/join.sim run general/parser/join_multivnode.sim