From 612d908b2dfc37e8b355dc3f4899c627702cc7c3 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 8 Jan 2021 17:00:01 +0800 Subject: [PATCH] [TD-2634]: support unsigned tinyint, unsigned smallint, unsigned int, unsigned bigint --- src/client/inc/tsclient.h | 2 +- src/client/src/tscAsync.c | 1 - src/client/src/tscLocal.c | 2 +- src/client/src/tscLocalMerge.c | 8 +- src/client/src/tscParseInsert.c | 176 +- src/client/src/tscPrepare.c | 16 +- src/client/src/tscSQLParser.c | 39 +- src/client/src/tscServer.c | 10 +- src/client/src/tscSql.c | 16 + src/client/src/tscSubquery.c | 7 +- src/client/src/tscUtil.c | 3 +- src/common/inc/tglobal.h | 2 +- src/common/inc/tvariant.h | 3 +- src/common/src/tglobal.c | 2 +- src/common/src/ttypes.c | 430 ++-- src/common/src/tvariant.c | 384 ++-- src/cq/src/cqMain.c | 7 +- src/inc/taos.h | 4 + src/inc/taosdef.h | 49 +- src/inc/ttokendef.h | 214 +- src/inc/ttype.h | 70 +- src/kit/shell/src/shellEngine.c | 16 + src/mnode/src/mnodeTable.c | 3 - src/query/inc/qArithmeticOperator.h | 10 +- src/query/inc/queryLog.h | 3 +- src/query/inc/sql.y | 7 + src/query/src/qAggMain.c | 444 ++-- src/query/src/qArithmeticOperator.c | 3033 ++++++++++++++++++++++++--- src/query/src/qAst.c | 48 +- src/query/src/qExecutor.c | 40 +- src/query/src/qHistogram.c | 6 +- src/query/src/qParserImpl.c | 110 +- src/query/src/qTokenizer.c | 1 + src/query/src/qTsbuf.c | 6 +- src/query/src/sql.c | 2302 ++++++++++---------- src/tsdb/src/tsdbRWHelper.c | 4 +- src/util/inc/tstoken.h | 3 +- src/util/src/tcompare.c | 34 +- 38 files changed, 5107 insertions(+), 2408 deletions(-) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 25a299d098..a3a086ce77 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -460,7 +460,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField } else { assert(bytes == tDataTypeDesc[type].nSize); - pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)&pInfo->pSqlExpr->param[1].i64Key; + pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)&pInfo->pSqlExpr->param[1].i64; pRes->length[columnIndex] = bytes; } } else { diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index b7b3441bd1..e833b8d03d 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -521,7 +521,6 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { } (*pSql->fp)(pSql->param, pSql, code); - return; } diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 16bbd420c0..48380f8641 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -204,7 +204,7 @@ static int32_t tscProcessDescribeTable(SSqlObj *pSql) { assert(tscGetMetaInfo(pQueryInfo, 0)->pTableMeta != NULL); const int32_t NUM_OF_DESC_TABLE_COLUMNS = 4; - const int32_t TYPE_COLUMN_LENGTH = 16; + const int32_t TYPE_COLUMN_LENGTH = 20; const int32_t NOTE_COLUMN_MIN_LENGTH = 8; int32_t noteFieldLen = NOTE_COLUMN_MIN_LENGTH; diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index 921aa9bade..4aa751574c 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -95,11 +95,11 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc int32_t functionId = pExpr->functionId; if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF) { pCtx->ptsOutputBuf = pReducer->pCtx[0].aOutputBuf; - pCtx->param[2].i64Key = pQueryInfo->order.order; + pCtx->param[2].i64 = pQueryInfo->order.order; pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT; - pCtx->param[1].i64Key = pQueryInfo->order.orderColId; + pCtx->param[1].i64 = pQueryInfo->order.orderColId; } else if (functionId == TSDB_FUNC_APERCT) { - pCtx->param[0].i64Key = pExpr->param[0].i64Key; + pCtx->param[0].i64 = pExpr->param[0].i64; pCtx->param[0].nType = pExpr->param[0].nType; } @@ -1064,7 +1064,7 @@ static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalReducer *pLocalReducer, } } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, j); - pCtx->param[0].i64Key = pExpr->param[0].i64Key; + pCtx->param[0].i64 = pExpr->param[0].i64; } pCtx->currentStage = MERGE_STAGE; diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index ec90d21394..350cf1919c 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -20,6 +20,7 @@ #include "os.h" +#include "ttype.h" #include "hash.h" #include "tscUtil.h" #include "tschemautil.h" @@ -40,46 +41,9 @@ enum { static int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int32_t * numOfRows); -static int32_t tscToInteger(SStrToken *pToken, int64_t *value, char **endPtr) { - if (pToken->n == 0) { - return TK_ILLEGAL; - } - - - int32_t radix = 10; - if (pToken->type == TK_HEX) { - radix = 16; - } else if (pToken->type == TK_BIN) { - radix = 2; - } - - errno = 0; - *value = strtoll(pToken->z, endPtr, radix); - if (**endPtr == 'e' || **endPtr == 'E' || **endPtr == '.') { - errno = 0; - double v = round(strtod(pToken->z, endPtr)); - if (v > INT64_MAX || v <= INT64_MIN) { - errno = ERANGE; - } else { - *value = (int64_t)v; - } - } - - // not a valid integer number, return error - if (*endPtr - pToken->z != pToken->n) { - return TK_ILLEGAL; - } - - return pToken->type; -} - static int32_t tscToDouble(SStrToken *pToken, double *value, char **endPtr) { - if (pToken->n == 0) { - return TK_ILLEGAL; - } - errno = 0; - *value = strtod(pToken->z, endPtr); + *value = strtold(pToken->z, endPtr); // not a valid integer number, return error if ((*endPtr - pToken->z) != pToken->n) { @@ -163,13 +127,19 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1 return TSDB_CODE_SUCCESS; } +// todo extract the null value check + int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, char *msg, char **str, bool primaryKey, int16_t timePrec) { int64_t iv; int32_t numType; - char * endptr = NULL; + char *endptr = NULL; errno = 0; // clear the previous existed error information + if (IS_NUMERIC_TYPE(pSchema->type) && pToken->n == 0) { + return tscInvalidSQLErrMsg(msg, "invalid numeric data", pToken->z); + } + switch (pSchema->type) { case TSDB_DATA_TYPE_BOOL: { // bool if ((pToken->type == TK_BOOL || pToken->type == TK_STRING) && (pToken->n != 0)) { @@ -195,33 +165,47 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, } break; } + case TSDB_DATA_TYPE_TINYINT: - if (pToken->type == TK_NULL) { - *((int8_t *)payload) = TSDB_DATA_TINYINT_NULL; - } else if ((pToken->type == TK_STRING) && (pToken->n != 0) && - (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)) { - *((int8_t *)payload) = TSDB_DATA_TINYINT_NULL; + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { + *((uint8_t *)payload) = TSDB_DATA_TINYINT_NULL; } else { - numType = tscToInteger(pToken, &iv, &endptr); + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (TK_ILLEGAL == numType) { return tscInvalidSQLErrMsg(msg, "invalid tinyint data", pToken->z); - } else if (errno == ERANGE || iv > INT8_MAX || iv <= INT8_MIN) { - return tscInvalidSQLErrMsg(msg, "tinyint data overflow", pToken->z); + } else if (errno == ERANGE || !IS_VALID_TINYINT(iv)) { + return tscInvalidSQLErrMsg(msg, "data overflow", pToken->z); } - *((int8_t *)payload) = (int8_t)iv; + *((uint8_t *)payload) = (uint8_t)iv; + } + + break; + + case TSDB_DATA_TYPE_UTINYINT: + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { + *((uint8_t *)payload) = TSDB_DATA_UTINYINT_NULL; + } else { + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); + if (TK_ILLEGAL == numType) { + return tscInvalidSQLErrMsg(msg, "invalid unsigned tinyint data", pToken->z); + } else if (errno == ERANGE || IS_VALID_UTINYINT(iv)) { + return tscInvalidSQLErrMsg(msg, "unsigned tinyint data overflow", pToken->z); + } + + *((uint8_t *)payload) = (uint8_t)iv; } break; case TSDB_DATA_TYPE_SMALLINT: - if (pToken->type == TK_NULL) { - *((int16_t *)payload) = TSDB_DATA_SMALLINT_NULL; - } else if ((pToken->type == TK_STRING) && (pToken->n != 0) && - (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)) { + if ((pToken->type == TK_NULL) || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { *((int16_t *)payload) = TSDB_DATA_SMALLINT_NULL; } else { - numType = tscToInteger(pToken, &iv, &endptr); + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (TK_ILLEGAL == numType) { return tscInvalidSQLErrMsg(msg, "invalid smallint data", pToken->z); } else if (errno == ERANGE || iv > INT16_MAX || iv <= INT16_MIN) { @@ -230,16 +214,32 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, *((int16_t *)payload) = (int16_t)iv; } + + break; + + case TSDB_DATA_TYPE_USMALLINT: + if ((pToken->type == TK_NULL) || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { + *((uint16_t *)payload) = TSDB_DATA_USMALLINT_NULL; + } else { + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); + if (TK_ILLEGAL == numType) { + return tscInvalidSQLErrMsg(msg, "invalid unsigned smallint data", pToken->z); + } else if (errno == ERANGE || iv >= UINT16_MAX) { + return tscInvalidSQLErrMsg(msg, "unsigned smallint data overflow", pToken->z); + } + + *((uint16_t *)payload) = (uint16_t)iv; + } + break; case TSDB_DATA_TYPE_INT: - if (pToken->type == TK_NULL) { - *((int32_t *)payload) = TSDB_DATA_INT_NULL; - } else if ((pToken->type == TK_STRING) && (pToken->n != 0) && - (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)) { + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { *((int32_t *)payload) = TSDB_DATA_INT_NULL; } else { - numType = tscToInteger(pToken, &iv, &endptr); + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (TK_ILLEGAL == numType) { return tscInvalidSQLErrMsg(msg, "invalid int data", pToken->z); } else if (errno == ERANGE || iv > INT32_MAX || iv <= INT32_MIN) { @@ -251,17 +251,32 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, break; + case TSDB_DATA_TYPE_UINT: + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { + *((uint32_t *)payload) = TSDB_DATA_UINT_NULL; + } else { + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); + if (TK_ILLEGAL == numType) { + return tscInvalidSQLErrMsg(msg, "invalid unsigned int data", pToken->z); + } else if (errno == ERANGE || iv >= UINT32_MAX) { + return tscInvalidSQLErrMsg(msg, "unsigned int data overflow", pToken->z); + } + + *((uint32_t *)payload) = (uint32_t)iv; + } + + break; + case TSDB_DATA_TYPE_BIGINT: - if (pToken->type == TK_NULL) { - *((int64_t *)payload) = TSDB_DATA_BIGINT_NULL; - } else if ((pToken->type == TK_STRING) && (pToken->n != 0) && - (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)) { + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { *((int64_t *)payload) = TSDB_DATA_BIGINT_NULL; } else { - numType = tscToInteger(pToken, &iv, &endptr); + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, true); if (TK_ILLEGAL == numType) { return tscInvalidSQLErrMsg(msg, "invalid bigint data", pToken->z); - } else if (errno == ERANGE || iv == INT64_MIN) { + } else if (errno == ERANGE || !IS_VALID_BIGINT(iv)) { return tscInvalidSQLErrMsg(msg, "bigint data overflow", pToken->z); } @@ -269,6 +284,22 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, } break; + case TSDB_DATA_TYPE_UBIGINT: + if (pToken->type == TK_NULL || ((pToken->type == TK_STRING) && (pToken->n != 0) && + (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0))) { + *((uint64_t *)payload) = TSDB_DATA_UBIGINT_NULL; + } else { + numType = tStrToInteger(pToken->z, pToken->type, pToken->n, &iv, false); + if (TK_ILLEGAL == numType) { + return tscInvalidSQLErrMsg(msg, "invalid unsigned bigint data", pToken->z); + } else if (errno == ERANGE || !IS_VALID_UBIGINT((uint64_t)iv)) { + return tscInvalidSQLErrMsg(msg, "unsigned bigint data overflow", pToken->z); + } + + *((uint64_t *)payload) = iv; + } + break; + case TSDB_DATA_TYPE_FLOAT: if (pToken->type == TK_NULL) { *((int32_t *)payload) = TSDB_DATA_FLOAT_NULL; @@ -281,16 +312,11 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, return tscInvalidSQLErrMsg(msg, "illegal float data", pToken->z); } - float fv = (float)dv; - if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || (fv > FLT_MAX || fv < -FLT_MAX)) { + if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || dv > FLT_MAX || dv < -FLT_MAX || isinf(dv) || isnan(dv)) { return tscInvalidSQLErrMsg(msg, "illegal float data", pToken->z); } - if (isinf(fv) || isnan(fv)) { - *((int32_t *)payload) = TSDB_DATA_FLOAT_NULL; - } - - *((float *)payload) = fv; + *((float *)payload) = (float)dv; } break; @@ -306,15 +332,11 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SStrToken *pToken, char *payload, return tscInvalidSQLErrMsg(msg, "illegal double data", pToken->z); } - if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || (dv > DBL_MAX || dv < -DBL_MAX)) { + if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || isinf(dv)) { return tscInvalidSQLErrMsg(msg, "illegal double data", pToken->z); } - if (isinf(dv) || isnan(dv)) { - *((int64_t *)payload) = TSDB_DATA_DOUBLE_NULL; - } else { - *((double *)payload) = dv; - } + *((double *)payload) = dv; } break; diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 8134a35811..7aa689ea53 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -84,35 +84,35 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) { var->nLen = 0; if (tb->is_null != NULL && *(tb->is_null)) { var->nType = TSDB_DATA_TYPE_NULL; - var->i64Key = 0; + var->i64 = 0; continue; } var->nType = tb->buffer_type; switch (tb->buffer_type) { case TSDB_DATA_TYPE_NULL: - var->i64Key = 0; + var->i64 = 0; break; case TSDB_DATA_TYPE_BOOL: - var->i64Key = (*(int8_t*)tb->buffer) ? 1 : 0; + var->i64 = (*(int8_t*)tb->buffer) ? 1 : 0; break; case TSDB_DATA_TYPE_TINYINT: - var->i64Key = *(int8_t*)tb->buffer; + var->i64 = *(int8_t*)tb->buffer; break; case TSDB_DATA_TYPE_SMALLINT: - var->i64Key = *(int16_t*)tb->buffer; + var->i64 = *(int16_t*)tb->buffer; break; case TSDB_DATA_TYPE_INT: - var->i64Key = *(int32_t*)tb->buffer; + var->i64 = *(int32_t*)tb->buffer; break; case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: - var->i64Key = *(int64_t*)tb->buffer; + var->i64 = *(int64_t*)tb->buffer; break; case TSDB_DATA_TYPE_FLOAT: @@ -219,7 +219,7 @@ static char* normalStmtBuildSql(STscStmt* stmt) { case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_BIGINT: - taosStringBuilderAppendInteger(&sb, var->i64Key); + taosStringBuilderAppendInteger(&sb, var->i64); break; case TSDB_DATA_TYPE_FLOAT: diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 8ac47d1ec3..22752fc7de 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -19,6 +19,7 @@ #define _GNU_SOURCE #include "os.h" +#include "ttype.h" #include "qAst.h" #include "taos.h" #include "taosmsg.h" @@ -484,10 +485,10 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { case TSDB_SQL_CREATE_USER: case TSDB_SQL_ALTER_USER: { - const char* msg5 = "invalid user rights"; - const char* msg7 = "not support options"; const char* msg2 = "invalid user/account name"; const char* msg3 = "name too long"; + const char* msg5 = "invalid user rights"; + const char* msg7 = "not support options"; pCmd->command = pInfo->type; @@ -950,7 +951,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) { return false; } - if (pField->type < TSDB_DATA_TYPE_BOOL || pField->type > TSDB_DATA_TYPE_NCHAR) { + if (!isValidDataType(pField->type)) { invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4); return false; } @@ -1754,7 +1755,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS // set reverse order scan data blocks for last query if (functionID == TSDB_FUNC_LAST) { pExpr->numOfParams = 1; - pExpr->param[0].i64Key = TSDB_ORDER_DESC; + pExpr->param[0].i64 = TSDB_ORDER_DESC; pExpr->param[0].nType = TSDB_DATA_TYPE_INT; } @@ -1945,7 +1946,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, index.columnIndex); int16_t colType = pSchema->type; - if (colType <= TSDB_DATA_TYPE_BOOL || colType >= TSDB_DATA_TYPE_BINARY) { + if (!IS_NUMERIC_TYPE(colType)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -2105,7 +2106,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if (!TSDB_COL_IS_TAG(pIndex->flag) && pIndex->colIndex < tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) { // group by normal columns SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, colIndex + i); pExpr->numOfParams = 1; - pExpr->param->i64Key = TSDB_ORDER_ASC; + pExpr->param->i64 = TSDB_ORDER_ASC; break; } @@ -2182,7 +2183,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col // 2. valid the column type int16_t colType = pSchema[index.columnIndex].type; - if (colType == TSDB_DATA_TYPE_BOOL || colType >= TSDB_DATA_TYPE_BINARY) { + if (!IS_NUMERIC_TYPE(colType)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -2727,7 +2728,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) { if ((functionId >= TSDB_FUNC_SUM && functionId <= TSDB_FUNC_TWA) || (functionId >= TSDB_FUNC_FIRST_DST && functionId <= TSDB_FUNC_LAST_DST) || (functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE)) { - if (getResultDataInfo(pSrcSchema->type, pSrcSchema->bytes, functionId, (int32_t)pExpr->param[0].i64Key, &type, &bytes, + if (getResultDataInfo(pSrcSchema->type, pSrcSchema->bytes, functionId, (int32_t)pExpr->param[0].i64, &type, &bytes, &interBytes, 0, true) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -2827,7 +2828,7 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool int32_t factor = functionCompatList[tscSqlExprGet(pQueryInfo, startIdx)->functionId]; if (tscSqlExprGet(pQueryInfo, 0)->functionId == TSDB_FUNC_LAST_ROW && (joinQuery || intervalQuery)) { - return false; + return false; } // diff function cannot be executed with other function @@ -4396,8 +4397,8 @@ int32_t getTimeRange(STimeWindow* win, tSQLExpr* pRight, int32_t optr, int16_t t * * Additional check to avoid data overflow */ - if (pRight->val.i64Key <= INT64_MAX / 1000) { - pRight->val.i64Key *= 1000; + if (pRight->val.i64 <= INT64_MAX / 1000) { + pRight->val.i64 *= 1000; } } else if (pRight->nSQLOptr == TK_FLOAT && timePrecision == TSDB_TIME_PRECISION_MILLI) { pRight->val.dKey *= 1000; @@ -5380,22 +5381,22 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* p tVariantListItem* p0 = taosArrayGet(pKeep, 0); switch (s) { case 1: { - pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64Key); + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); } break; case 2: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); - pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64Key); - pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64Key); + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); + pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); break; } case 3: { tVariantListItem* p1 = taosArrayGet(pKeep, 1); tVariantListItem* p2 = taosArrayGet(pKeep, 2); - pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64Key); - pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64Key); - pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64Key); + pMsg->daysToKeep = htonl((int32_t)p0->pVar.i64); + pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); + pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64); break; } default: { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } @@ -5561,7 +5562,7 @@ static void doUpdateSqlFunctionForTagPrj(SQueryInfo* pQueryInfo) { if ((pExpr->functionId != TSDB_FUNC_TAG_DUMMY && pExpr->functionId != TSDB_FUNC_TS_DUMMY) && !(pExpr->functionId == TSDB_FUNC_PRJ && TSDB_COL_IS_UD_COL(pExpr->colInfo.flag))) { SSchema* pColSchema = &pSchema[pExpr->colInfo.colIndex]; - getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, (int32_t)pExpr->param[0].i64Key, &pExpr->resType, + getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, (int32_t)pExpr->param[0].i64, &pExpr->resType, &pExpr->resBytes, &pExpr->interBytes, tagLength, isSTable); } } @@ -6760,7 +6761,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS // check for dividing by 0 if ((*pExpr)->_node.optr == TSDB_BINARY_OP_DIVIDE) { if (pRight->nodeType == TSQL_NODE_VALUE) { - if (pRight->pVal->nType == TSDB_DATA_TYPE_INT && pRight->pVal->i64Key == 0) { + if (pRight->pVal->nType == TSDB_DATA_TYPE_INT && pRight->pVal->i64 == 0) { return TSDB_CODE_TSC_INVALID_SQL; } else if (pRight->pVal->nType == TSDB_DATA_TYPE_FLOAT && pRight->pVal->dKey == 0) { return TSDB_CODE_TSC_INVALID_SQL; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 4949aa9b9d..81bb87a7db 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -755,12 +755,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SColumn *pCol = taosArrayGetP(pQueryInfo->colList, i); SSchema *pColSchema = &pSchema[pCol->colIndex.columnIndex]; - if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || pColSchema->type < TSDB_DATA_TYPE_BOOL || - pColSchema->type > TSDB_DATA_TYPE_NCHAR) { + if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || !isValidDataType(pColSchema->type)) { tscError("%p tid:%d uid:%" PRIu64" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s", pSql, pTableMeta->id.tid, pTableMeta->id.uid, pTableMetaInfo->name, tscGetNumOfColumns(pTableMeta), pCol->colIndex.columnIndex, pColSchema->name); - return TSDB_CODE_TSC_INVALID_SQL; } @@ -826,7 +824,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { memcpy(pMsg, pExpr->param[j].pz, pExpr->param[j].nLen); pMsg += pExpr->param[j].nLen; } else { - pSqlFuncExpr->arg[j].argValue.i64 = htobe64(pExpr->param[j].i64Key); + pSqlFuncExpr->arg[j].argValue.i64 = htobe64(pExpr->param[j].i64); } } @@ -866,7 +864,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { memcpy(pMsg, pExpr->param[j].pz, pExpr->param[j].nLen); pMsg += pExpr->param[j].nLen; } else { - pSqlFuncExpr1->arg[j].argValue.i64 = htobe64(pExpr->param[j].i64Key); + pSqlFuncExpr1->arg[j].argValue.i64 = htobe64(pExpr->param[j].i64); } } @@ -1830,7 +1828,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { assert(i == 0); } - assert(pSchema->type >= TSDB_DATA_TYPE_BOOL && pSchema->type <= TSDB_DATA_TYPE_NCHAR); + assert(isValidDataType(pSchema->type)); pSchema++; } diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 377cb24b1d..6dcd7beea4 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -788,18 +788,34 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) len += sprintf(str + len, "%d", *((int8_t *)row[i])); break; + case TSDB_DATA_TYPE_UTINYINT: + len += sprintf(str + len, "%u", *((uint8_t *)row[i])); + break; + case TSDB_DATA_TYPE_SMALLINT: len += sprintf(str + len, "%d", *((int16_t *)row[i])); break; + case TSDB_DATA_TYPE_USMALLINT: + len += sprintf(str + len, "%u", *((uint16_t *)row[i])); + break; + case TSDB_DATA_TYPE_INT: len += sprintf(str + len, "%d", *((int32_t *)row[i])); break; + case TSDB_DATA_TYPE_UINT: + len += sprintf(str + len, "%u", *((uint32_t *)row[i])); + break; + case TSDB_DATA_TYPE_BIGINT: len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i])); break; + case TSDB_DATA_TYPE_UBIGINT: + len += sprintf(str + len, "%" PRIu64, *((uint64_t *)row[i])); + break; + case TSDB_DATA_TYPE_FLOAT: { float fv = 0; fv = GET_FLOAT_VAL(row[i]); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 063b6af0e6..6b3532fef6 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -459,7 +459,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { int16_t colId = tscGetJoinTagColIdByUid(&pQueryInfo->tagCond, pTableMetaInfo->pTableMeta->id.uid); // set the tag column id for executor to extract correct tag value - pExpr->param[0] = (tVariant) {.i64Key = colId, .nType = TSDB_DATA_TYPE_BIGINT, .nLen = sizeof(int64_t)}; + pExpr->param[0] = (tVariant) {.i64 = colId, .nType = TSDB_DATA_TYPE_BIGINT, .nLen = sizeof(int64_t)}; pExpr->numOfParams = 1; } @@ -642,7 +642,7 @@ static void issueTSCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj* if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, 0); int16_t tagColId = tscGetJoinTagColIdByUid(&pSupporter->tagCond, pTableMetaInfo->pTableMeta->id.uid); - pExpr->param->i64Key = tagColId; + pExpr->param->i64 = tagColId; pExpr->numOfParams = 1; } @@ -1520,7 +1520,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { int16_t tagColId = tscGetJoinTagColIdByUid(&pSupporter->tagCond, pTableMetaInfo->pTableMeta->id.uid); - pExpr->param->i64Key = tagColId; + pExpr->param->i64 = tagColId; pExpr->numOfParams = 1; } @@ -2093,6 +2093,7 @@ static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsuppo return pNew; } +// todo there is are race condition in this function, while cancel is called by user. void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) { // the param may be null, since it may be done by other query threads. and the asyncOnError may enter in this // function while kill query by a user. diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 5d818692ed..b44ebb3c98 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -71,6 +71,7 @@ void tsSetSTableQueryCond(STagCond* pTagCond, uint64_t uid, SBufferWriter* bw) { bool tscQueryTags(SQueryInfo* pQueryInfo) { int32_t numOfCols = (int32_t) tscSqlExprNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < numOfCols; ++i) { SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); int32_t functId = pExpr->functionId; @@ -314,7 +315,7 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) { } else { for (int32_t k = 0; k < pRes->numOfRows; ++k) { char* p = ((char**)pRes->urow)[i] + k * pInfo->field.bytes; - memcpy(p, &pInfo->pSqlExpr->param[1].i64Key, pInfo->field.bytes); + memcpy(p, &pInfo->pSqlExpr->param[1].i64, pInfo->field.bytes); } } } diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index f1fc5ca808..a7238d7f37 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -190,7 +190,7 @@ extern int32_t monDebugFlag; extern int32_t uDebugFlag; extern int32_t rpcDebugFlag; extern int32_t odbcDebugFlag; -extern int32_t qDebugFlag; +extern uint32_t qDebugFlag; extern int32_t wDebugFlag; extern int32_t cqDebugFlag; extern int32_t debugFlag; diff --git a/src/common/inc/tvariant.h b/src/common/inc/tvariant.h index e9973bcb95..dfcc940418 100644 --- a/src/common/inc/tvariant.h +++ b/src/common/inc/tvariant.h @@ -28,7 +28,8 @@ typedef struct tVariant { uint32_t nType; int32_t nLen; // only used for string, for number, it is useless union { - int64_t i64Key; + int64_t i64; + uint64_t u64; double dKey; char * pz; wchar_t *wpz; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 8fa17f8751..63edb6d206 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -218,7 +218,7 @@ int32_t odbcDebugFlag = 131; int32_t httpDebugFlag = 131; int32_t mqttDebugFlag = 131; int32_t monDebugFlag = 131; -int32_t qDebugFlag = 131; +uint32_t qDebugFlag = 131; int32_t rpcDebugFlag = 131; int32_t uDebugFlag = 131; int32_t debugFlag = 0; diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index f28481977f..72dfa5c2bd 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -18,7 +18,7 @@ #include "ttokendef.h" #include "tscompression.h" -const int32_t TYPE_BYTES[11] = { +const int32_t TYPE_BYTES[15] = { -1, // TSDB_DATA_TYPE_NULL sizeof(int8_t), // TSDB_DATA_TYPE_BOOL sizeof(int8_t), // TSDB_DATA_TYPE_TINYINT @@ -29,10 +29,28 @@ const int32_t TYPE_BYTES[11] = { sizeof(double), // TSDB_DATA_TYPE_DOUBLE sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_BINARY sizeof(TSKEY), // TSDB_DATA_TYPE_TIMESTAMP - sizeof(VarDataOffsetT) // TSDB_DATA_TYPE_NCHAR + sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_NCHAR + sizeof(uint8_t), // TSDB_DATA_TYPE_UTINYINT + sizeof(uint16_t), // TSDB_DATA_TYPE_USMALLINT + sizeof(uint32_t), // TSDB_DATA_TYPE_UINT + sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT }; -static void getStatics_bool(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +#define DO_STATICS(__sum, __min, __max, __minIndex, __maxIndex, _list, _index) \ + do { \ + (__sum) += (_list)[(_index)]; \ + if ((__min) > (_list)[(_index)]) { \ + (__min) = (_list)[(_index)]; \ + (__minIndex) = (_index); \ + } \ + \ + if ((__max) < (_list)[(_index)]) { \ + (__max) = (_list)[(_index)]; \ + (__maxIndex) = (_index); \ + } \ + } while (0) + +static void getStatics_bool(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { int8_t *data = (int8_t *)pData; *min = INT64_MAX; @@ -43,26 +61,17 @@ static void getStatics_bool(const TSKEY *primaryKey, const void *pData, int32_t ASSERT(numOfRow <= INT16_MAX); for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((char *)&data[i], TSDB_DATA_TYPE_BOOL)) { + if (data[i] == TSDB_DATA_BOOL_NULL) { (*numOfNull) += 1; continue; } - - *sum += data[i]; - if (*min > data[i]) { - *min = data[i]; - *minIndex = i; - } - - if (*max < data[i]) { - *max = data[i]; - *maxIndex = i; - } + + DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i); } } -static void getStatics_i8(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, - int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { +static void getStatics_i8(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { int8_t *data = (int8_t *)pData; *min = INT64_MAX; *max = INT64_MIN; @@ -72,26 +81,43 @@ static void getStatics_i8(const TSKEY *primaryKey, const void *pData, int32_t nu ASSERT(numOfRow <= INT16_MAX); for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((char *)&data[i], TSDB_DATA_TYPE_TINYINT)) { + if (((uint8_t)data[i]) == TSDB_DATA_TINYINT_NULL) { (*numOfNull) += 1; continue; } - - *sum += data[i]; - if (*min > data[i]) { - *min = data[i]; - *minIndex = i; - } - - if (*max < data[i]) { - *max = data[i]; - *maxIndex = i; - } + + DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i); } } -static void getStatics_i16(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, - int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { +static void getStatics_u8(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + uint8_t *data = (uint8_t *)pData; + uint64_t _min = UINT64_MAX; + uint64_t _max = 0; + uint64_t _sum = 0; + + *minIndex = 0; + *maxIndex = 0; + + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (((uint8_t)data[i]) == TSDB_DATA_UTINYINT_NULL) { + (*numOfNull) += 1; + continue; + } + + DO_STATICS(_sum, _min, _max, *minIndex, *maxIndex, data, i); + } + + *min = _min; + *max = _max; + *sum = _sum; +} + +static void getStatics_i16(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { int16_t *data = (int16_t *)pData; *min = INT64_MAX; *max = INT64_MIN; @@ -100,39 +126,45 @@ static void getStatics_i16(const TSKEY *primaryKey, const void *pData, int32_t n ASSERT(numOfRow <= INT16_MAX); - // int64_t lastKey = 0; - // int16_t lastVal = TSDB_DATA_SMALLINT_NULL; - for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((const char*) &data[i], TSDB_DATA_TYPE_SMALLINT)) { + if (((uint16_t)data[i]) == TSDB_DATA_SMALLINT_NULL) { (*numOfNull) += 1; continue; } - - *sum += data[i]; - if (*min > data[i]) { - *min = data[i]; - *minIndex = i; - } - - if (*max < data[i]) { - *max = data[i]; - *maxIndex = i; - } - - // if (isNull(&lastVal, TSDB_DATA_TYPE_SMALLINT)) { - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } else { - // *wsum = lastVal * (primaryKey[i] - lastKey); - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } + + DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i); } + } -static void getStatics_i32(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, - int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { +static void getStatics_u16(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + uint16_t *data = (uint16_t *)pData; + uint64_t _min = UINT64_MAX; + uint64_t _max = 0; + uint64_t _sum = 0; + + *minIndex = 0; + *maxIndex = 0; + + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (((uint16_t)data[i]) == TSDB_DATA_USMALLINT_NULL) { + (*numOfNull) += 1; + continue; + } + + DO_STATICS(_sum, _min, _max, *minIndex, *maxIndex, data, i); + } + + *min = _min; + *max = _max; + *sum = _sum; +} + +static void getStatics_i32(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { int32_t *data = (int32_t *)pData; *min = INT64_MAX; *max = INT64_MIN; @@ -141,29 +173,43 @@ static void getStatics_i32(const TSKEY *primaryKey, const void *pData, int32_t n ASSERT(numOfRow <= INT16_MAX); - // int64_t lastKey = 0; - // int32_t lastVal = TSDB_DATA_INT_NULL; - for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((const char*) &data[i], TSDB_DATA_TYPE_INT)) { + if (((uint32_t)data[i]) == TSDB_DATA_INT_NULL) { (*numOfNull) += 1; continue; } - - *sum += data[i]; - if (*min > data[i]) { - *min = data[i]; - *minIndex = i; - } - - if (*max < data[i]) { - *max = data[i]; - *maxIndex = i; - } + + DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i); } } -static void getStatics_i64(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +static void getStatics_u32(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, + int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + uint32_t *data = (uint32_t *)pData; + uint64_t _min = UINT64_MAX; + uint64_t _max = 0; + uint64_t _sum = 0; + + *minIndex = 0; + *maxIndex = 0; + + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (((uint32_t)data[i]) == TSDB_DATA_UINT_NULL) { + (*numOfNull) += 1; + continue; + } + + DO_STATICS(_sum, _min, _max, *minIndex, *maxIndex, data, i); + } + + *min = _min; + *max = _max; + *sum = _sum; +} + +static void getStatics_i64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { int64_t *data = (int64_t *)pData; *min = INT64_MAX; @@ -174,52 +220,60 @@ static void getStatics_i64(const TSKEY *primaryKey, const void *pData, int32_t n ASSERT(numOfRow <= INT16_MAX); for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((const char*) &data[i], TSDB_DATA_TYPE_BIGINT)) { + if (((uint64_t)data[i]) == TSDB_DATA_BIGINT_NULL) { (*numOfNull) += 1; continue; } - - *sum += data[i]; - if (*min > data[i]) { - *min = data[i]; - *minIndex = i; - } - - if (*max < data[i]) { - *max = data[i]; - *maxIndex = i; - } - - // if (isNull(&lastVal, TSDB_DATA_TYPE_BIGINT)) { - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } else { - // *wsum = lastVal * (primaryKey[i] - lastKey); - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } + + DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i); } } -static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +static void getStatics_u64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, + int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + uint64_t *data = (uint64_t *)pData; + uint64_t _min = UINT64_MAX; + uint64_t _max = 0; + uint64_t _sum = 0; + + *minIndex = 0; + *maxIndex = 0; + + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (((uint64_t)data[i]) == TSDB_DATA_UBIGINT_NULL) { + (*numOfNull) += 1; + continue; + } + + DO_STATICS(_sum, _min, _max, *minIndex, *maxIndex, data, i); + } + + *min = _min; + *max = _max; + *sum = _sum; +} + +static void getStatics_f(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { - float *data = (float *)pData; - float fmin = FLT_MAX; - float fmax = -FLT_MAX; - double dsum = 0; - *minIndex = 0; - *maxIndex = 0; + float *data = (float *)pData; + float fmin = FLT_MAX; + float fmax = -FLT_MAX; + double dsum = 0; + *minIndex = 0; + *maxIndex = 0; ASSERT(numOfRow <= INT16_MAX); for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((const char*) &data[i], TSDB_DATA_TYPE_FLOAT)) { + if ((*(uint32_t*)&(data[i])) == TSDB_DATA_FLOAT_NULL) { (*numOfNull) += 1; continue; } - - float fv = 0; - fv = GET_FLOAT_VAL((const char*)&(data[i])); + + float fv = GET_FLOAT_VAL((const char*)&(data[i])); + dsum += fv; if (fmin > fv) { fmin = fv; @@ -232,28 +286,24 @@ static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t num } } - double csum = 0; - csum = GET_DOUBLE_VAL((const char *)sum); - csum += dsum; - - SET_DOUBLE_VAL(sum, csum); + SET_DOUBLE_VAL(sum, dsum); SET_DOUBLE_VAL(max, fmax); SET_DOUBLE_VAL(min, fmin); } -static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +static void getStatics_d(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { double *data = (double *)pData; - double dmin = DBL_MAX; - double dmax = -DBL_MAX; - double dsum = 0; - *minIndex = 0; - *maxIndex = 0; + double dmin = DBL_MAX; + double dmax = -DBL_MAX; + double dsum = 0; + *minIndex = 0; + *maxIndex = 0; ASSERT(numOfRow <= INT16_MAX); for (int32_t i = 0; i < numOfRow; ++i) { - if (isNull((const char*) &data[i], TSDB_DATA_TYPE_DOUBLE)) { + if ((*(uint64_t*)&(data[i])) == TSDB_DATA_DOUBLE_NULL) { (*numOfNull) += 1; continue; } @@ -272,16 +322,12 @@ static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t num } } - double csum = 0; - csum = GET_DOUBLE_VAL((const char *)sum); - csum += dsum; - - SET_DOUBLE_PTR(sum, &csum); + SET_DOUBLE_PTR(sum, &dsum); SET_DOUBLE_PTR(max, &dmax); SET_DOUBLE_PTR(min, &dmin); } -static void getStatics_bin(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +static void getStatics_bin(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { const char* data = pData; ASSERT(numOfRow <= INT16_MAX); @@ -301,7 +347,7 @@ static void getStatics_bin(const TSKEY *primaryKey, const void *pData, int32_t n *maxIndex = 0; } -static void getStatics_nchr(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, +static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { const char* data = pData; ASSERT(numOfRow <= INT16_MAX); @@ -321,18 +367,22 @@ static void getStatics_nchr(const TSKEY *primaryKey, const void *pData, int32_t *maxIndex = 0; } -tDataTypeDescriptor tDataTypeDesc[11] = { - {TSDB_DATA_TYPE_NULL, 6, 1, "NOTYPE", NULL, NULL, NULL}, - {TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", tsCompressBool, tsDecompressBool, getStatics_bool}, - {TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", tsCompressTinyint, tsDecompressTinyint, getStatics_i8}, - {TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", tsCompressSmallint, tsDecompressSmallint, getStatics_i16}, - {TSDB_DATA_TYPE_INT, 3, INT_BYTES, "INT", tsCompressInt, tsDecompressInt, getStatics_i32}, - {TSDB_DATA_TYPE_BIGINT, 6, LONG_BYTES, "BIGINT", tsCompressBigint, tsDecompressBigint, getStatics_i64}, - {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", tsCompressFloat, tsDecompressFloat, getStatics_f}, - {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", tsCompressDouble, tsDecompressDouble, getStatics_d}, - {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", tsCompressString, tsDecompressString, getStatics_bin}, - {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, - {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", tsCompressString, tsDecompressString, getStatics_nchr}, +tDataTypeDescriptor tDataTypeDesc[15] = { + {TSDB_DATA_TYPE_NULL, 6,1, "NOTYPE", NULL, NULL, NULL}, + {TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", tsCompressBool, tsDecompressBool, getStatics_bool}, + {TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", tsCompressTinyint, tsDecompressTinyint, getStatics_i8}, + {TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", tsCompressSmallint, tsDecompressSmallint, getStatics_i16}, + {TSDB_DATA_TYPE_INT, 3, INT_BYTES, "INT", tsCompressInt, tsDecompressInt, getStatics_i32}, + {TSDB_DATA_TYPE_BIGINT, 6, LONG_BYTES, "BIGINT", tsCompressBigint, tsDecompressBigint, getStatics_i64}, + {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", tsCompressFloat, tsDecompressFloat, getStatics_f}, + {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", tsCompressDouble, tsDecompressDouble, getStatics_d}, + {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", tsCompressString, tsDecompressString, getStatics_bin}, + {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, + {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", tsCompressString, tsDecompressString, getStatics_nchr}, + {TSDB_DATA_TYPE_UTINYINT, 16, CHAR_BYTES, "TINYINT UNSIGNED", tsCompressTinyint, tsDecompressTinyint, getStatics_u8}, + {TSDB_DATA_TYPE_USMALLINT, 17, SHORT_BYTES, "SMALLINT UNSIGNED", tsCompressSmallint, tsDecompressSmallint, getStatics_u16}, + {TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", tsCompressInt, tsDecompressInt, getStatics_u32}, + {TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", tsCompressBigint, tsDecompressBigint, getStatics_u64}, }; char tTokenTypeSwitcher[13] = { @@ -352,7 +402,7 @@ char tTokenTypeSwitcher[13] = { }; bool isValidDataType(int32_t type) { - return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_NCHAR; + return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_UBIGINT; } void setVardataNull(char* val, int32_t type) { @@ -397,6 +447,26 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) { *(uint64_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_BIGINT_NULL; } break; + case TSDB_DATA_TYPE_UTINYINT: + for (int32_t i = 0; i < numOfElems; ++i) { + *(uint8_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UTINYINT_NULL; + } + break; + case TSDB_DATA_TYPE_USMALLINT: + for (int32_t i = 0; i < numOfElems; ++i) { + *(uint16_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_USMALLINT_NULL; + } + break; + case TSDB_DATA_TYPE_UINT: + for (int32_t i = 0; i < numOfElems; ++i) { + *(uint32_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UINT_NULL; + } + break; + case TSDB_DATA_TYPE_UBIGINT: + for (int32_t i = 0; i < numOfElems; ++i) { + *(uint64_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UBIGINT_NULL; + } + break; case TSDB_DATA_TYPE_FLOAT: for (int32_t i = 0; i < numOfElems; ++i) { *(uint32_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_FLOAT_NULL; @@ -422,13 +492,17 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) { } } -static uint8_t nullBool = TSDB_DATA_BOOL_NULL; -static uint8_t nullTinyInt = TSDB_DATA_TINYINT_NULL; -static uint16_t nullSmallInt = TSDB_DATA_SMALLINT_NULL; -static uint32_t nullInt = TSDB_DATA_INT_NULL; -static uint64_t nullBigInt = TSDB_DATA_BIGINT_NULL; -static uint32_t nullFloat = TSDB_DATA_FLOAT_NULL; -static uint64_t nullDouble = TSDB_DATA_DOUBLE_NULL; +static uint8_t nullBool = TSDB_DATA_BOOL_NULL; +static uint8_t nullTinyInt = TSDB_DATA_TINYINT_NULL; +static uint16_t nullSmallInt = TSDB_DATA_SMALLINT_NULL; +static uint32_t nullInt = TSDB_DATA_INT_NULL; +static uint64_t nullBigInt = TSDB_DATA_BIGINT_NULL; +static uint32_t nullFloat = TSDB_DATA_FLOAT_NULL; +static uint64_t nullDouble = TSDB_DATA_DOUBLE_NULL; +static uint8_t nullTinyIntu = TSDB_DATA_UTINYINT_NULL; +static uint16_t nullSmallIntu = TSDB_DATA_USMALLINT_NULL; +static uint32_t nullIntu = TSDB_DATA_UINT_NULL; +static uint64_t nullBigIntu = TSDB_DATA_UBIGINT_NULL; static union { tstr str; @@ -436,17 +510,25 @@ static union { } nullBinary = {.str = {.len = 1}}, nullNchar = {.str = {.len = 4}}; static void *nullValues[] = { - &nullBool, &nullTinyInt, &nullSmallInt, &nullInt, &nullBigInt, - &nullFloat, &nullDouble, &nullBinary, &nullBigInt, &nullNchar, + &nullBool, &nullTinyInt, &nullSmallInt, &nullInt, &nullBigInt, + &nullFloat, &nullDouble, &nullBinary, &nullBigInt, &nullNchar, + &nullTinyIntu, &nullSmallIntu, &nullIntu, &nullBigIntu, }; void *getNullValue(int32_t type) { - assert(type >= TSDB_DATA_TYPE_BOOL && type <= TSDB_DATA_TYPE_NCHAR); + assert(type >= TSDB_DATA_TYPE_BOOL && type <= TSDB_DATA_TYPE_UBIGINT); return nullValues[type - 1]; } void assignVal(char *val, const char *src, int32_t len, int32_t type) { switch (type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + *((int8_t *)val) = GET_INT8_VAL(src); + break; + case TSDB_DATA_TYPE_SMALLINT: + *((int16_t *)val) = GET_INT16_VAL(src); + break; case TSDB_DATA_TYPE_INT: { *((int32_t *)val) = GET_INT32_VAL(src); break; @@ -457,17 +539,10 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { case TSDB_DATA_TYPE_DOUBLE: SET_DOUBLE_VAL(val, GET_DOUBLE_VAL(src)); break; - case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: *((int64_t *)val) = GET_INT64_VAL(src); break; - case TSDB_DATA_TYPE_SMALLINT: - *((int16_t *)val) = GET_INT16_VAL(src); - break; - case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: - *((int8_t *)val) = GET_INT8_VAL(src); - break; case TSDB_DATA_TYPE_BINARY: varDataCopy(val, src); break; @@ -483,12 +558,14 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf) { switch (type) { - case TSDB_DATA_TYPE_INT: { + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_UINT: { SWAP(*(int32_t *)(pLeft), *(int32_t *)(pRight), int32_t); break; } case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_TIMESTAMP: { SWAP(*(int64_t *)(pLeft), *(int64_t *)(pRight), int64_t); break; @@ -497,7 +574,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf SWAP(*(double *)(pLeft), *(double *)(pRight), double); break; } - case TSDB_DATA_TYPE_SMALLINT: { + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_USMALLINT: { SWAP(*(int16_t *)(pLeft), *(int16_t *)(pRight), int16_t); break; } @@ -508,7 +586,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf } case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: { + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_UTINYINT: { SWAP(*(int8_t *)(pLeft), *(int8_t *)(pRight), int8_t); break; } @@ -521,3 +600,38 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf } } } + +int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bool issigned) { + errno = 0; + + char* endPtr = NULL; + if (type == TK_FLOAT) { + double v = strtod(z, &endPtr); + if ((errno == ERANGE && v == HUGE_VALF) || isinf(v) || isnan(v)) { + errno = ERANGE; + } else if ((issigned && (v < INT64_MIN || v > INT64_MAX)) || ((!issigned) && (v < 0 || v > UINT64_MAX))) { + errno = ERANGE; + } else { + *value = round(v); + } + + return type; + } + + int32_t radix = 10; + if (type == TK_HEX) { + radix = 16; + } else if (type == TK_BIN) { + radix = 2; + } + + // the string may be overflow according to errno + *value = strtoll(z, &endPtr, radix); + + // not a valid integer number, return error + if (endPtr - z != n) { + return TK_ILLEGAL; + } + + return type; +} diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 571ec2e0dd..236ecc1833 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -21,6 +21,7 @@ #include "tstoken.h" #include "ttokendef.h" #include "tutil.h" +#include "ttype.h" // todo support scientific expression number and oct number void tVariantCreate(tVariant *pVar, SStrToken *token) { tVariantCreateFromString(pVar, token->z, token->n, token->type); } @@ -32,10 +33,10 @@ void tVariantCreateFromString(tVariant *pVar, char *pz, uint32_t len, uint32_t t case TSDB_DATA_TYPE_BOOL: { int32_t k = strncasecmp(pz, "true", 4); if (k == 0) { - pVar->i64Key = TSDB_TRUE; + pVar->i64 = TSDB_TRUE; } else { assert(strncasecmp(pz, "false", 5) == 0); - pVar->i64Key = TSDB_FALSE; + pVar->i64 = TSDB_FALSE; } break; } @@ -43,7 +44,7 @@ void tVariantCreateFromString(tVariant *pVar, char *pz, uint32_t len, uint32_t t case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_INT: - pVar->i64Key = strtoll(pz, NULL, 10); + pVar->i64 = strtoll(pz, NULL, 10); break; case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_FLOAT: @@ -74,20 +75,36 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: { - pVar->i64Key = GET_INT8_VAL(pz); + pVar->i64 = GET_INT8_VAL(pz); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + pVar->u64 = GET_UINT8_VAL(pz); break; } case TSDB_DATA_TYPE_SMALLINT: { - pVar->i64Key = GET_INT16_VAL(pz); + pVar->i64 = GET_INT16_VAL(pz); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + pVar->u64 = GET_UINT16_VAL(pz); break; } case TSDB_DATA_TYPE_INT: { - pVar->i64Key = GET_INT32_VAL(pz); + pVar->i64 = GET_INT32_VAL(pz); + break; + } + case TSDB_DATA_TYPE_UINT: { + pVar->u64 = GET_UINT32_VAL(pz); break; } case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: { - pVar->i64Key = GET_INT64_VAL(pz); + pVar->i64 = GET_INT64_VAL(pz); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + pVar->u64 = GET_UINT64_VAL(pz); break; } case TSDB_DATA_TYPE_DOUBLE: { @@ -115,7 +132,7 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 } default: - pVar->i64Key = GET_INT32_VAL(pVar); + pVar->i64 = GET_INT32_VAL(pz); } pVar->nType = type; @@ -159,8 +176,8 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) { } - if (pSrc->nType >= TSDB_DATA_TYPE_BOOL && pSrc->nType <= TSDB_DATA_TYPE_DOUBLE) { - pDst->i64Key = pSrc->i64Key; + if (IS_NUMERIC_TYPE(pSrc->nType)) { + pDst->i64 = pSrc->i64; } else if (pSrc->nType == TSDB_DATA_TYPE_ARRAY) { // this is only for string array size_t num = taosArrayGetSize(pSrc->arr); pDst->arr = taosArrayInit(num, sizeof(char*)); @@ -189,30 +206,30 @@ int32_t tVariantCompare(const tVariant* p1, const tVariant* p2) { return 1; } - switch (p1->nType) { - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: { - if (p1->nLen == p2->nLen) { - return memcmp(p1->pz, p2->pz, p1->nLen); - } else { - return p1->nLen > p2->nLen? 1:-1; - } - }; - - case TSDB_DATA_TYPE_FLOAT: - case TSDB_DATA_TYPE_DOUBLE: - if (p1->dKey == p2->dKey) { - return 0; - } else { - return p1->dKey > p2->dKey? 1:-1; - } - - default: - if (p1->i64Key == p2->i64Key) { - return 0; - } else { - return p1->i64Key > p2->i64Key? 1:-1; - } + if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_NCHAR) { + if (p1->nLen == p2->nLen) { + return memcmp(p1->pz, p2->pz, p1->nLen); + } else { + return p1->nLen > p2->nLen? 1:-1; + } + } else if (p1->nType == TSDB_DATA_TYPE_FLOAT || p1->nType == TSDB_DATA_TYPE_DOUBLE) { + if (p1->dKey == p2->dKey) { + return 0; + } else { + return p1->dKey > p2->dKey? 1:-1; + } + } else if (IS_UNSIGNED_NUMERIC_TYPE(p1->nType)) { + if (p1->u64 == p2->u64) { + return 0; + } else { + return p1->u64 > p2->u64? 1:-1; + } + } else { + if (p1->i64 == p2->i64) { + return 0; + } else { + return p1->i64 > p2->i64? 1:-1; + } } } @@ -239,11 +256,15 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_INT: - return sprintf(dst, "%d", (int32_t)pVar->i64Key); + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + return sprintf(dst, "%d", (int32_t)pVar->i64); case TSDB_DATA_TYPE_BIGINT: - return sprintf(dst, "%" PRId64, pVar->i64Key); - + return sprintf(dst, "%" PRId64, pVar->i64); + case TSDB_DATA_TYPE_UBIGINT: + return sprintf(dst, "%" PRIu64, pVar->u64); case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_DOUBLE: return sprintf(dst, "%.9lf", pVar->dKey); @@ -253,121 +274,6 @@ int32_t tVariantToString(tVariant *pVar, char *dst) { } } -#if 0 -static int32_t doConvertToInteger(tVariant *pVariant, char *pDest, int32_t type, bool releaseVariantPtr) { - if (pVariant->nType == TSDB_DATA_TYPE_NULL) { - setNull(pDest, type, tDataTypeDesc[type].nSize); - return 0; - } - - if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - *((int64_t *)pDest) = pVariant->i64Key; - } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { - if ((pVariant->dKey < INT64_MIN) || (pVariant->dKey > INT64_MAX)) { - return -1; - } - - *((int64_t *)pDest) = (int64_t)pVariant->dKey; - } else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) { - errno = 0; - char *endPtr = NULL; - - SStrToken token = {0}; - token.n = tSQLGetToken(pVariant->pz, &token.type); - - if (token.type == TK_MINUS || token.type == TK_PLUS) { - token.n = tSQLGetToken(pVariant->pz + token.n, &token.type); - } - - if (token.type == TK_FLOAT) { - double v = strtod(pVariant->pz, &endPtr); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if ((errno == ERANGE && v == -1) || (isinf(v) || isnan(v))) { - return -1; - } - - if ((v < INT64_MIN) || (v > INT64_MAX)) { - return -1; - } - - *((int64_t *)pDest) = (int64_t)v; - } else if (token.type == TK_INTEGER) { - int64_t val = strtoll(pVariant->pz, &endPtr, 10); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if (errno == ERANGE) { - return -1; // data overflow - } - - *((int64_t *)pDest) = val; - } else if (token.type == TK_NULL) { - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - setNull(pDest, type, tDataTypeDesc[type].nSize); - } else { - return -1; - } - - } else if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { - errno = 0; - wchar_t *endPtr = NULL; - - SStrToken token = {0}; - token.n = tSQLGetToken(pVariant->pz, &token.type); - - if (token.type == TK_MINUS || token.type == TK_PLUS) { - token.n = tSQLGetToken(pVariant->pz + token.n, &token.type); - } - - if (token.type == TK_FLOAT) { - double v = wcstod(pVariant->wpz, &endPtr); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if ((errno == ERANGE && v == -1) || (isinf(v) || isnan(v))) { - return -1; - } - - if ((v < INT64_MIN) || (v > INT64_MAX)) { - return -1; - } - - *((int64_t *)pDest) = (int64_t)v; - } else if (token.type == TK_NULL) { - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - setNull(pDest, type, tDataTypeDesc[type].nSize); - } else { - int64_t val = wcstoll(pVariant->wpz, &endPtr, 10); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if (errno == ERANGE) { - return -1; // data overflow - } - - *((int64_t *)pDest) = val; - } - } - - return 0; -} -#endif static FORCE_INLINE int32_t convertToBoolImpl(char *pStr, int32_t len) { if ((strncasecmp(pStr, "true", len) == 0) && (len == 4)) { return TSDB_TRUE; @@ -385,15 +291,18 @@ static FORCE_INLINE int32_t wcsconvertToBoolImpl(wchar_t *pstr, int32_t len) { return TSDB_TRUE; } else if (wcsncasecmp(pstr, L"false", len) == 0 && (len == 5)) { return TSDB_FALSE; + } else if (memcmp(pstr, L"null", wcslen(L"null")) == 0) { + return TSDB_DATA_BOOL_NULL; } else { return -1; } } static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { - const int32_t INITIAL_ALLOC_SIZE = 20; + const int32_t INITIAL_ALLOC_SIZE = 40; char * pBuf = NULL; - + + // it is a in-place convert type for tVariant, local buffer is needed if (*pDest == pVariant->pz) { pBuf = calloc(1, INITIAL_ALLOC_SIZE); } @@ -413,12 +322,12 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { } } else { - if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - sprintf(pBuf == NULL ? *pDest : pBuf, "%" PRId64, pVariant->i64Key); + if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType)) { + sprintf(pBuf == NULL ? *pDest : pBuf, "%" PRId64, pVariant->i64); } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { sprintf(pBuf == NULL ? *pDest : pBuf, "%lf", pVariant->dKey); } else if (pVariant->nType == TSDB_DATA_TYPE_BOOL) { - sprintf(pBuf == NULL ? *pDest : pBuf, "%s", (pVariant->i64Key == TSDB_TRUE) ? "TRUE" : "FALSE"); + sprintf(pBuf == NULL ? *pDest : pBuf, "%s", (pVariant->i64 == TSDB_TRUE) ? "TRUE" : "FALSE"); } else if (pVariant->nType == 0) { // null data setNull(pBuf == NULL ? *pDest : pBuf, TSDB_DATA_TYPE_BINARY, 0); } @@ -438,16 +347,19 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { char * pDst = tmpBuf; int32_t nLen = 0; - - if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - nLen = sprintf(pDst, "%" PRId64, pVariant->i64Key); + + // convert the number to string, than convert it to wchar string. + if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType)) { + nLen = sprintf(pDst, "%" PRId64, pVariant->i64); + } else if (IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) { + nLen = sprintf(pDst, "%"PRIu64, pVariant->u64); } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { nLen = sprintf(pDst, "%lf", pVariant->dKey); } else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) { pDst = pVariant->pz; nLen = pVariant->nLen; } else if (pVariant->nType == TSDB_DATA_TYPE_BOOL) { - nLen = sprintf(pDst, "%s", (pVariant->i64Key == TSDB_TRUE) ? "TRUE" : "FALSE"); + nLen = sprintf(pDst, "%s", (pVariant->i64 == TSDB_TRUE) ? "TRUE" : "FALSE"); } if (*pDest == pVariant->pz) { @@ -481,38 +393,35 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { static FORCE_INLINE int32_t convertToDouble(char *pStr, int32_t len, double *value) { SStrToken stoken = {.z = pStr, .n = len}; - - if (TK_ILLEGAL == isValidNumber(&stoken)) { + if (TK_ILLEGAL == tGetNumericStringType(&stoken)) { return -1; } *value = strtod(pStr, NULL); - return 0; } -static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result, int32_t type, int64_t lowBnd, - int64_t upperBnd, bool releaseVariantPtr) { +static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result, int32_t type, bool releaseVariantPtr) { if (pVariant->nType == TSDB_DATA_TYPE_NULL) { setNull((char *)result, type, tDataTypeDesc[type].nSize); return 0; } - - if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - *result = pVariant->i64Key; - } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { - *result = (int64_t)pVariant->dKey; + + errno = 0; + if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType)) { + *result = pVariant->i64; + } else if (IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) { + *result = pVariant->u64; + } else if (IS_FLOAT_TYPE(pVariant->nType)) { + *result = (int64_t) pVariant->dKey; } else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) { - errno = 0; - char *endPtr = NULL; - - SStrToken token = {0}; - token.n = tSQLGetToken(pVariant->pz, &token.type); - + SStrToken token = {.z = pVariant->pz, .n = pVariant->nLen}; + int32_t n = tSQLGetToken(pVariant->pz, &token.type); if (token.type == TK_MINUS || token.type == TK_PLUS) { - token.n = tSQLGetToken(pVariant->pz + token.n, &token.type); + // decide if pVariant->pz is NULL or not + tSQLGetToken(pVariant->pz + n, &token.type); } - + if (token.type == TK_NULL) { if (releaseVariantPtr) { free(pVariant->pz); @@ -522,39 +431,25 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result setNull((char *)result, type, tDataTypeDesc[type].nSize); return 0; } - - SStrToken sToken = {.z = pVariant->pz, .n = pVariant->nLen}; - if (TK_ILLEGAL == isValidNumber(&sToken)) { + + // decide if it is a valid number + token.type = tGetNumericStringType(&token); + if (token.type == TK_ILLEGAL) { return -1; } - - if (token.type == TK_FLOAT) { - double v = strtod(pVariant->pz, &endPtr); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if ((errno == ERANGE && v == -1) || (isinf(v) || isnan(v))) { - return -1; - } - - *result = (int64_t)v; - } else if (token.type == TK_INTEGER) { - int64_t val = strtoll(pVariant->pz, &endPtr, 10); - if (releaseVariantPtr) { - free(pVariant->pz); - pVariant->nLen = 0; - } - - if (errno == ERANGE) { - return -1; // data overflow - } - - *result = val; - } else { + + int64_t res = 0; + int32_t t = tStrToInteger(token.z, token.type, token.n, &res, true); + if (TK_ILLEGAL == t || errno == ERANGE) { return -1; } + + if (releaseVariantPtr) { + free(pVariant->pz); + pVariant->nLen = 0; + } + + *result = res; } else if (pVariant->nType == TSDB_DATA_TYPE_NCHAR) { errno = 0; wchar_t *endPtr = NULL; @@ -599,19 +494,35 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result *result = val; } } - - if ((*result <= lowBnd) || (*result > upperBnd)) { - return -1; + + bool code = false; + switch(type) { + case TSDB_DATA_TYPE_TINYINT: + code = IS_VALID_TINYINT(*result); break; + case TSDB_DATA_TYPE_SMALLINT: + code = IS_VALID_SMALLINT(*result); break; + case TSDB_DATA_TYPE_INT: + code = IS_VALID_INT(*result); break; + case TSDB_DATA_TYPE_BIGINT: + code = IS_VALID_BIGINT(*result); break; + case TSDB_DATA_TYPE_UTINYINT: + code = IS_VALID_UTINYINT(*result); break; + case TSDB_DATA_TYPE_USMALLINT: + code = IS_VALID_USMALLINT(*result); break; + case TSDB_DATA_TYPE_UINT: + code = IS_VALID_UINT(*result); break; + case TSDB_DATA_TYPE_UBIGINT: + code = IS_VALID_UBIGINT(*result); break; } - - return 0; + + return code? 0:-1; } static int32_t convertToBool(tVariant *pVariant, int64_t *pDest) { if (pVariant->nType == TSDB_DATA_TYPE_BOOL) { - *pDest = pVariant->i64Key; // in order to be compatible to null of bool - } else if (pVariant->nType >= TSDB_DATA_TYPE_TINYINT && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - *pDest = ((pVariant->i64Key != 0) ? TSDB_TRUE : TSDB_FALSE); + *pDest = pVariant->i64; // in order to be compatible to null of bool + } else if (IS_NUMERIC_TYPE(pVariant->nType)) { + *pDest = ((pVariant->i64 != 0) ? TSDB_TRUE : TSDB_FALSE); } else if (pVariant->nType == TSDB_DATA_TYPE_FLOAT || pVariant->nType == TSDB_DATA_TYPE_DOUBLE) { *pDest = ((pVariant->dKey != 0) ? TSDB_TRUE : TSDB_FALSE); } else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) { @@ -647,53 +558,46 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu } errno = 0; // reset global error code - + int64_t result; + switch (type) { case TSDB_DATA_TYPE_BOOL: { - int64_t dst = 0; - if (convertToBool(pVariant, &dst) < 0) { + if (convertToBool(pVariant, &result) < 0) { return -1; } - *(int8_t *)payload = (int8_t)dst; + + *(int8_t *)payload = (int8_t)result; break; } case TSDB_DATA_TYPE_TINYINT: { - int64_t result = 0; - if (convertToInteger(pVariant, &result, type, INT8_MIN, INT8_MAX, false) < 0) { + if (convertToInteger(pVariant, &result, type, false) < 0) { return -1; } - *((int8_t *)payload) = (int8_t)result; break; } case TSDB_DATA_TYPE_SMALLINT: { - int64_t result = 0; - if (convertToInteger(pVariant, &result, type, INT16_MIN, INT16_MAX, false) < 0) { + if (convertToInteger(pVariant, &result, type, false) < 0) { return -1; } - *((int16_t *)payload) = (int16_t)result; break; } case TSDB_DATA_TYPE_INT: { - int64_t result = 0; - if (convertToInteger(pVariant, &result, type, INT32_MIN, INT32_MAX, false) < 0) { + if (convertToInteger(pVariant, &result, type, false) < 0) { return -1; } - *((int32_t *)payload) = (int32_t)result; break; } case TSDB_DATA_TYPE_BIGINT: { - int64_t result = 0; - if (convertToInteger(pVariant, &result, type, INT64_MIN, INT64_MAX, false) < 0) { + if (convertToInteger(pVariant, &result, type, false) < 0) { return -1; } - *((int64_t *)payload) = (int64_t)result; break; } @@ -715,7 +619,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu SET_FLOAT_VAL(payload, value); } } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - SET_FLOAT_VAL(payload, pVariant->i64Key); + SET_FLOAT_VAL(payload, pVariant->i64); } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { SET_FLOAT_VAL(payload, pVariant->dKey); } else if (pVariant->nType == TSDB_DATA_TYPE_NULL) { @@ -746,7 +650,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu SET_DOUBLE_VAL(payload, value); } } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - SET_DOUBLE_VAL(payload, pVariant->i64Key); + SET_DOUBLE_VAL(payload, pVariant->i64); } else if (pVariant->nType == TSDB_DATA_TYPE_DOUBLE || pVariant->nType == TSDB_DATA_TYPE_FLOAT) { SET_DOUBLE_VAL(payload, pVariant->dKey); } else if (pVariant->nType == TSDB_DATA_TYPE_NULL) { @@ -794,7 +698,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, int16_t type, bool inclu if (pVariant->nType == TSDB_DATA_TYPE_NULL) { *((int64_t *)payload) = TSDB_DATA_BIGINT_NULL; } else { - *((int64_t *)payload) = pVariant->i64Key; + *((int64_t *)payload) = pVariant->i64; } break; } @@ -848,7 +752,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { switch (type) { case TSDB_DATA_TYPE_BOOL: { // bool - if (convertToBool(pVariant, &pVariant->i64Key) < 0) { + if (convertToBool(pVariant, &pVariant->i64) < 0) { return -1; } @@ -859,7 +763,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_SMALLINT: { - convertToInteger(pVariant, &(pVariant->i64Key), type, INT64_MIN, INT64_MAX, true); + convertToInteger(pVariant, &(pVariant->i64), type, true); pVariant->nType = TSDB_DATA_TYPE_BIGINT; break; } @@ -886,7 +790,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { free(pVariant->pz); pVariant->dKey = v; } else if (pVariant->nType >= TSDB_DATA_TYPE_BOOL && pVariant->nType <= TSDB_DATA_TYPE_BIGINT) { - pVariant->dKey = (double)(pVariant->i64Key); + pVariant->dKey = (double)(pVariant->i64); } pVariant->nType = TSDB_DATA_TYPE_DOUBLE; @@ -909,6 +813,4 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) { } return 0; -} - - +} \ No newline at end of file diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index de76c30e8e..acaf4bb5e7 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -295,6 +295,8 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { if (pObj->pStream == NULL) { pObj->pStream = taos_open_stream(pContext->dbConn, pObj->sqlStr, cqProcessStreamRes, 0, pObj, NULL); + + // TODO the pObj->pStream may be released if error happens if (pObj->pStream) { tscSetStreamDestTable(pObj->pStream, pObj->dstTable); pContext->num++; @@ -306,11 +308,14 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { } static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) { - SCqObj *pObj = (SCqObj *)param; + SCqObj *pObj = (SCqObj *)param; if (tres == NULL && row == NULL) { + taos_close_stream(pObj->pStream); + pObj->pStream = NULL; return; } + SCqContext *pContext = pObj->pContext; STSchema *pSchema = pObj->pSchema; if (pObj->pStream == NULL) return; diff --git a/src/inc/taos.h b/src/inc/taos.h index cd863587a6..5e4f50e31d 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -42,6 +42,10 @@ typedef void **TAOS_ROW; #define TSDB_DATA_TYPE_BINARY 8 // string #define TSDB_DATA_TYPE_TIMESTAMP 9 // 8 bytes #define TSDB_DATA_TYPE_NCHAR 10 // unicode string +#define TSDB_DATA_TYPE_UTINYINT 11 // 1 byte +#define TSDB_DATA_TYPE_USMALLINT 12 // 2 bytes +#define TSDB_DATA_TYPE_UINT 13 // 4 bytes +#define TSDB_DATA_TYPE_UBIGINT 14 // 8 bytes typedef enum { TSDB_OPTION_LOCALE, diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 7f1ed40815..9a52cb3bee 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -60,7 +60,7 @@ typedef struct tstr { // Bytes for each type. -extern const int32_t TYPE_BYTES[11]; +extern const int32_t TYPE_BYTES[15]; // TODO: replace and remove code below #define CHAR_BYTES sizeof(char) @@ -92,6 +92,11 @@ extern const int32_t TYPE_BYTES[11]; #define TSDB_DATA_NCHAR_NULL 0xFFFFFFFF #define TSDB_DATA_BINARY_NULL 0xFF +#define TSDB_DATA_UTINYINT_NULL 0xFF +#define TSDB_DATA_USMALLINT_NULL 0xFFFF +#define TSDB_DATA_UINT_NULL 0xFFFFFFFF +#define TSDB_DATA_UBIGINT_NULL 0xFFFFFFFFFFFFFFFFL + #define TSDB_DATA_NULL_STR "NULL" #define TSDB_DATA_NULL_STR_L "null" @@ -131,19 +136,16 @@ do { \ (src) = (void *)((char *)src + sizeof(type));\ } while(0) -#define GET_INT8_VAL(x) (*(int8_t *)(x)) -#define GET_INT16_VAL(x) (*(int16_t *)(x)) -#define GET_INT32_VAL(x) (*(int32_t *)(x)) -#define GET_INT64_VAL(x) (*(int64_t *)(x)) +#define GET_INT8_VAL(x) (*(int8_t *)(x)) +#define GET_INT16_VAL(x) (*(int16_t *)(x)) +#define GET_INT32_VAL(x) (*(int32_t *)(x)) +#define GET_INT64_VAL(x) (*(int64_t *)(x)) +#define GET_UINT8_VAL(x) (*(uint8_t*) (x)) +#define GET_UINT16_VAL(x) (*(uint16_t *)(x)) +#define GET_UINT32_VAL(x) (*(uint32_t *)(x)) +#define GET_UINT64_VAL(x) (*(uint64_t *)(x)) + #ifdef _TD_ARM_32 - - //#define __float_align_declear() float __underlyFloat = 0.0; - //#define __float_align_declear() - //#define GET_FLOAT_VAL_ALIGN(x) (*(int32_t*)&(__underlyFloat) = *(int32_t*)(x); __underlyFloat); - // notes: src must be float or double type variable !!! - //#define SET_FLOAT_VAL_ALIGN(dst, src) (*(int32_t*) dst = *(int32_t*)src); - //#define SET_DOUBLE_VAL_ALIGN(dst, src) (*(int64_t*) dst = *(int64_t*)src); - float taos_align_get_float(const char* pBuf); double taos_align_get_double(const char* pBuf); @@ -171,14 +173,14 @@ typedef struct tDataTypeDescriptor { char algorithm, char *const buffer, int bufferSize); int (*decompFunc)(const char *const input, int compressedSize, const int nelements, char *const output, int outputSize, char algorithm, char *const buffer, int bufferSize); - void (*getStatisFunc)(const TSKEY *primaryKey, const void *pData, int32_t numofrow, int64_t *min, int64_t *max, - int64_t *sum, int16_t *minindex, int16_t *maxindex, int16_t *numofnull); + void (*getStatisFunc)(const void *pData, int32_t numofrow, int64_t *min, int64_t *max, int64_t *sum, + int16_t *minindex, int16_t *maxindex, int16_t *numofnull); } tDataTypeDescriptor; -extern tDataTypeDescriptor tDataTypeDesc[11]; +extern tDataTypeDescriptor tDataTypeDesc[15]; bool isValidDataType(int32_t type); -//bool isNull(const char *val, int32_t type); + static FORCE_INLINE bool isNull(const char *val, int32_t type) { switch (type) { case TSDB_DATA_TYPE_BOOL: @@ -200,6 +202,15 @@ static FORCE_INLINE bool isNull(const char *val, int32_t type) { return varDataLen(val) == sizeof(int32_t) && *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL; case TSDB_DATA_TYPE_BINARY: return varDataLen(val) == sizeof(int8_t) && *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL; + case TSDB_DATA_TYPE_UTINYINT: + return *(uint8_t*) val == TSDB_DATA_UTINYINT_NULL; + case TSDB_DATA_TYPE_USMALLINT: + return *(uint16_t*) val == TSDB_DATA_USMALLINT_NULL; + case TSDB_DATA_TYPE_UINT: + return *(uint32_t*) val == TSDB_DATA_UINT_NULL; + case TSDB_DATA_TYPE_UBIGINT: + return *(uint64_t*) val == TSDB_DATA_UBIGINT_NULL; + default: return false; }; @@ -213,6 +224,10 @@ void* getNullValue(int32_t type); void assignVal(char *val, const char *src, int32_t len, int32_t type); void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf); +int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bool issigned); + +#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL) + // TODO: check if below is necessary #define TSDB_RELATION_INVALID 0 #define TSDB_RELATION_LESS 1 diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 7bd7b228cb..09500fc8c5 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -117,112 +117,114 @@ #define TK_CACHELAST 99 #define TK_LP 100 #define TK_RP 101 -#define TK_TAGS 102 -#define TK_USING 103 -#define TK_AS 104 -#define TK_COMMA 105 -#define TK_NULL 106 -#define TK_SELECT 107 -#define TK_UNION 108 -#define TK_ALL 109 -#define TK_FROM 110 -#define TK_VARIABLE 111 -#define TK_INTERVAL 112 -#define TK_FILL 113 -#define TK_SLIDING 114 -#define TK_ORDER 115 -#define TK_BY 116 -#define TK_ASC 117 -#define TK_DESC 118 -#define TK_GROUP 119 -#define TK_HAVING 120 -#define TK_LIMIT 121 -#define TK_OFFSET 122 -#define TK_SLIMIT 123 -#define TK_SOFFSET 124 -#define TK_WHERE 125 -#define TK_NOW 126 -#define TK_RESET 127 -#define TK_QUERY 128 -#define TK_ADD 129 -#define TK_COLUMN 130 -#define TK_TAG 131 -#define TK_CHANGE 132 -#define TK_SET 133 -#define TK_KILL 134 -#define TK_CONNECTION 135 -#define TK_STREAM 136 -#define TK_COLON 137 -#define TK_ABORT 138 -#define TK_AFTER 139 -#define TK_ATTACH 140 -#define TK_BEFORE 141 -#define TK_BEGIN 142 -#define TK_CASCADE 143 -#define TK_CLUSTER 144 -#define TK_CONFLICT 145 -#define TK_COPY 146 -#define TK_DEFERRED 147 -#define TK_DELIMITERS 148 -#define TK_DETACH 149 -#define TK_EACH 150 -#define TK_END 151 -#define TK_EXPLAIN 152 -#define TK_FAIL 153 -#define TK_FOR 154 -#define TK_IGNORE 155 -#define TK_IMMEDIATE 156 -#define TK_INITIALLY 157 -#define TK_INSTEAD 158 -#define TK_MATCH 159 -#define TK_KEY 160 -#define TK_OF 161 -#define TK_RAISE 162 -#define TK_REPLACE 163 -#define TK_RESTRICT 164 -#define TK_ROW 165 -#define TK_STATEMENT 166 -#define TK_TRIGGER 167 -#define TK_VIEW 168 -#define TK_COUNT 169 -#define TK_SUM 170 -#define TK_AVG 171 -#define TK_MIN 172 -#define TK_MAX 173 -#define TK_FIRST 174 -#define TK_LAST 175 -#define TK_TOP 176 -#define TK_BOTTOM 177 -#define TK_STDDEV 178 -#define TK_PERCENTILE 179 -#define TK_APERCENTILE 180 -#define TK_LEASTSQUARES 181 -#define TK_HISTOGRAM 182 -#define TK_DIFF 183 -#define TK_SPREAD 184 -#define TK_TWA 185 -#define TK_INTERP 186 -#define TK_LAST_ROW 187 -#define TK_RATE 188 -#define TK_IRATE 189 -#define TK_SUM_RATE 190 -#define TK_SUM_IRATE 191 -#define TK_AVG_RATE 192 -#define TK_AVG_IRATE 193 -#define TK_TBID 194 -#define TK_SEMI 195 -#define TK_NONE 196 -#define TK_PREV 197 -#define TK_LINEAR 198 -#define TK_IMPORT 199 -#define TK_METRIC 200 -#define TK_TBNAME 201 -#define TK_JOIN 202 -#define TK_METRICS 203 -#define TK_STABLE 204 -#define TK_INSERT 205 -#define TK_INTO 206 -#define TK_VALUES 207 +#define TK_UNSIGNED 102 +#define TK_TAGS 103 +#define TK_USING 104 +#define TK_AS 105 +#define TK_COMMA 106 +#define TK_NULL 107 +#define TK_SELECT 108 +#define TK_UNION 109 +#define TK_ALL 110 +#define TK_FROM 111 +#define TK_VARIABLE 112 +#define TK_INTERVAL 113 +#define TK_FILL 114 +#define TK_SLIDING 115 +#define TK_ORDER 116 +#define TK_BY 117 +#define TK_ASC 118 +#define TK_DESC 119 +#define TK_GROUP 120 +#define TK_HAVING 121 +#define TK_LIMIT 122 +#define TK_OFFSET 123 +#define TK_SLIMIT 124 +#define TK_SOFFSET 125 +#define TK_WHERE 126 +#define TK_NOW 127 +#define TK_RESET 128 +#define TK_QUERY 129 +#define TK_ADD 130 +#define TK_COLUMN 131 +#define TK_TAG 132 +#define TK_CHANGE 133 +#define TK_SET 134 +#define TK_KILL 135 +#define TK_CONNECTION 136 +#define TK_STREAM 137 +#define TK_COLON 138 +#define TK_ABORT 139 +#define TK_AFTER 140 +#define TK_ATTACH 141 +#define TK_BEFORE 142 +#define TK_BEGIN 143 +#define TK_CASCADE 144 +#define TK_CLUSTER 145 +#define TK_CONFLICT 146 +#define TK_COPY 147 +#define TK_DEFERRED 148 +#define TK_DELIMITERS 149 +#define TK_DETACH 150 +#define TK_EACH 151 +#define TK_END 152 +#define TK_EXPLAIN 153 +#define TK_FAIL 154 +#define TK_FOR 155 +#define TK_IGNORE 156 +#define TK_IMMEDIATE 157 +#define TK_INITIALLY 158 +#define TK_INSTEAD 159 +#define TK_MATCH 160 +#define TK_KEY 161 +#define TK_OF 162 +#define TK_RAISE 163 +#define TK_REPLACE 164 +#define TK_RESTRICT 165 +#define TK_ROW 166 +#define TK_STATEMENT 167 +#define TK_TRIGGER 168 +#define TK_VIEW 169 +#define TK_COUNT 170 +#define TK_SUM 171 +#define TK_AVG 172 +#define TK_MIN 173 +#define TK_MAX 174 +#define TK_FIRST 175 +#define TK_LAST 176 +#define TK_TOP 177 +#define TK_BOTTOM 178 +#define TK_STDDEV 179 +#define TK_PERCENTILE 180 +#define TK_APERCENTILE 181 +#define TK_LEASTSQUARES 182 +#define TK_HISTOGRAM 183 +#define TK_DIFF 184 +#define TK_SPREAD 185 +#define TK_TWA 186 +#define TK_INTERP 187 +#define TK_LAST_ROW 188 +#define TK_RATE 189 +#define TK_IRATE 190 +#define TK_SUM_RATE 191 +#define TK_SUM_IRATE 192 +#define TK_AVG_RATE 193 +#define TK_AVG_IRATE 194 +#define TK_TBID 195 +#define TK_SEMI 196 +#define TK_NONE 197 +#define TK_PREV 198 +#define TK_LINEAR 199 +#define TK_IMPORT 200 +#define TK_METRIC 201 +#define TK_TBNAME 202 +#define TK_JOIN 203 +#define TK_METRICS 204 +#define TK_STABLE 205 +#define TK_INSERT 206 +#define TK_INTO 207 +#define TK_VALUES 208 + #define TK_SPACE 300 diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 7f6a8d65e7..aa8e1e8616 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -8,27 +8,55 @@ extern "C" { #include "taosdef.h" #define GET_TYPED_DATA(_v, _finalType, _type, _data) \ - switch (_type) { \ - case TSDB_DATA_TYPE_BOOL: \ - case TSDB_DATA_TYPE_TINYINT: \ - (_v) = (_finalType)GET_INT8_VAL(_data); \ - break; \ - case TSDB_DATA_TYPE_SMALLINT: \ - (_v) = (_finalType)GET_INT16_VAL(_data); \ - break; \ - case TSDB_DATA_TYPE_BIGINT: \ - (_v) = (_finalType)(GET_INT64_VAL(_data)); \ - break; \ - case TSDB_DATA_TYPE_FLOAT: \ - (_v) = (_finalType)GET_FLOAT_VAL(_data); \ - break; \ - case TSDB_DATA_TYPE_DOUBLE: \ - (_v) = (_finalType)GET_DOUBLE_VAL(_data); \ - break; \ - default: \ - (_v) = (_finalType)GET_INT32_VAL(_data); \ - break; \ - } + do { \ + switch (_type) { \ + case TSDB_DATA_TYPE_BOOL: \ + case TSDB_DATA_TYPE_TINYINT: \ + (_v) = (_finalType)GET_INT8_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UTINYINT: \ + (_v) = (_finalType)GET_UINT8_VAL(_data); \ + case TSDB_DATA_TYPE_SMALLINT: \ + (_v) = (_finalType)GET_INT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_USMALLINT: \ + (_v) = (_finalType)GET_UINT16_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_BIGINT: \ + (_v) = (_finalType)(GET_INT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_UBIGINT: \ + (_v) = (_finalType)(GET_UINT64_VAL(_data)); \ + break; \ + case TSDB_DATA_TYPE_FLOAT: \ + (_v) = (_finalType)GET_FLOAT_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_DOUBLE: \ + (_v) = (_finalType)GET_DOUBLE_VAL(_data); \ + break; \ + case TSDB_DATA_TYPE_UINT: \ + (_v) = (_finalType)GET_UINT32_VAL(_data); \ + break; \ + default: \ + (_v) = (_finalType)GET_INT32_VAL(_data); \ + break; \ + } \ + } while (0) + +#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT) +#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT) +#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE) + +#define IS_NUMERIC_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)) || (IS_FLOAT_TYPE(_t))) + +#define IS_VALID_TINYINT(_t) ((_t) > INT8_MIN && (_t) <= INT8_MAX) +#define IS_VALID_SMALLINT(_t) ((_t) > INT16_MIN && (_t) <= INT16_MAX) +#define IS_VALID_INT(_t) ((_t) > INT32_MIN && (_t) <= INT32_MAX) +#define IS_VALID_BIGINT(_t) ((_t) > INT64_MIN && (_t) <= INT64_MAX) +#define IS_VALID_UTINYINT(_t) ((_t) >= 0 && (_t) < UINT8_MAX) +#define IS_VALID_USMALLINT(_t) ((_t) >= 0 && (_t) < UINT16_MAX) +#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) < UINT32_MAX) +#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) < UINT64_MAX) #ifdef __cplusplus } diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index fca0e93472..a986f2d3cb 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -603,15 +603,27 @@ static void printField(const char* val, TAOS_FIELD* field, int width, int32_t le case TSDB_DATA_TYPE_TINYINT: printf("%*d", width, *((int8_t *)val)); break; + case TSDB_DATA_TYPE_UTINYINT: + printf("%*u", width, *((uint8_t *)val)); + break; case TSDB_DATA_TYPE_SMALLINT: printf("%*d", width, *((int16_t *)val)); break; + case TSDB_DATA_TYPE_USMALLINT: + printf("%*u", width, *((uint16_t *)val)); + break; case TSDB_DATA_TYPE_INT: printf("%*d", width, *((int32_t *)val)); break; + case TSDB_DATA_TYPE_UINT: + printf("%*u", width, *((uint32_t *)val)); + break; case TSDB_DATA_TYPE_BIGINT: printf("%*" PRId64, width, *((int64_t *)val)); break; + case TSDB_DATA_TYPE_UBIGINT: + printf("%*" PRIu64, width, *((uint64_t *)val)); + break; case TSDB_DATA_TYPE_FLOAT: printf("%*.5f", width, GET_FLOAT_VAL(val)); break; @@ -679,15 +691,19 @@ static int calcColWidth(TAOS_FIELD* field, int precision) { return MAX(5, width); // 'false' case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_UTINYINT: return MAX(4, width); // '-127' case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_USMALLINT: return MAX(6, width); // '-32767' case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_UINT: return MAX(11, width); // '-2147483648' case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_UBIGINT: return MAX(21, width); // '-9223372036854775807' case TSDB_DATA_TYPE_FLOAT: diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index f53a4209b0..5a02857c85 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -35,12 +35,9 @@ #include "mnodeAcct.h" #include "mnodeDb.h" #include "mnodeDnode.h" -#include "mnodeMnode.h" -#include "mnodeProfile.h" #include "mnodeSdb.h" #include "mnodeShow.h" #include "mnodeTable.h" -#include "mnodeUser.h" #include "mnodeVgroup.h" #include "mnodeWrite.h" #include "mnodeRead.h" diff --git a/src/query/inc/qArithmeticOperator.h b/src/query/inc/qArithmeticOperator.h index f13c63acc3..27e8871e2f 100644 --- a/src/query/inc/qArithmeticOperator.h +++ b/src/query/inc/qArithmeticOperator.h @@ -13,17 +13,17 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_TSYNTAXTREEFUNCTION_H -#define TDENGINE_TSYNTAXTREEFUNCTION_H +#ifndef TDENGINE_QARITHMETICOPERATOR_H +#define TDENGINE_QARITHMETICOPERATOR_H #ifdef __cplusplus extern "C" { #endif -typedef void (*_bi_consumer_fn_t)(void *left, void *right, int32_t numOfLeft, int32_t numOfRight, void *output, - int32_t order); +typedef void (*_arithmetic_operator_fn_t)(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, + int32_t rightType, void *output, int32_t order); -_bi_consumer_fn_t getArithmeticOperatorFn(int32_t leftType, int32_t rightType, int32_t optr); +_arithmetic_operator_fn_t getArithmeticOperatorFn(int32_t arithmeticOptr); #ifdef __cplusplus } diff --git a/src/query/inc/queryLog.h b/src/query/inc/queryLog.h index d4e909d33a..26544ab0f9 100644 --- a/src/query/inc/queryLog.h +++ b/src/query/inc/queryLog.h @@ -22,8 +22,7 @@ extern "C" { #include "tlog.h" -extern int32_t qDebugFlag; -extern int8_t tscEmbedded; +extern uint32_t qDebugFlag; #define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", 255, __VA_ARGS__); }} while(0) #define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", 255, __VA_ARGS__); }} while(0) diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index dda15fb508..1fa1369bb5 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -291,6 +291,13 @@ typename(A) ::= ids(X) LP signed(Y) RP. { } } +// define the unsigned number type +typename(A) ::= ids(X) UNSIGNED(Z). { + X.type = 0; + X.n = ((Z.z + Z.n) - X.z); + tSqlSetColumnType (&A, &X); +} + %type signed {int64_t} signed(A) ::= INTEGER(X). { A = strtol(X.z, NULL, 10); } signed(A) ::= PLUS INTEGER(X). { A = strtol(X.z, NULL, 10); } diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 0754483449..0427d65561 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -21,7 +21,7 @@ #include "qTsbuf.h" #include "taosdef.h" #include "taosmsg.h" -#include "tscLog.h" +#include "queryLog.h" #include "tscSubquery.h" #include "tsqlfunction.h" #include "ttype.h" @@ -51,16 +51,16 @@ #define INC_INIT_VAL(ctx, res) (GET_RES_INFO(ctx)->numOfRes += (res)); -#define DO_UPDATE_TAG_COLUMNS(ctx, ts) \ - do { \ - for (int32_t _i = 0; _i < (ctx)->tagInfo.numOfTagCols; ++_i) { \ - SQLFunctionCtx *__ctx = (ctx)->tagInfo.pTagCtxList[_i]; \ - if (__ctx->functionId == TSDB_FUNC_TS_DUMMY) { \ - __ctx->tag.i64Key = (ts); \ - __ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; \ - } \ - aAggs[TSDB_FUNC_TAG].xFunction(__ctx); \ - } \ +#define DO_UPDATE_TAG_COLUMNS(ctx, ts) \ + do { \ + for (int32_t _i = 0; _i < (ctx)->tagInfo.numOfTagCols; ++_i) { \ + SQLFunctionCtx *__ctx = (ctx)->tagInfo.pTagCtxList[_i]; \ + if (__ctx->functionId == TSDB_FUNC_TS_DUMMY) { \ + __ctx->tag.i64 = (ts); \ + __ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; \ + } \ + aAggs[TSDB_FUNC_TAG].xFunction(__ctx); \ + } \ } while (0) #define DO_UPDATE_TAG_COLUMNS_WITHOUT_TS(ctx) \ @@ -158,7 +158,7 @@ typedef struct SRateInfo { int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, int16_t *bytes, int32_t *interBytes, int16_t extLength, bool isSuperTable) { if (!isValidDataType(dataType)) { - tscError("Illegal data type %d or data type length %d", dataType, dataBytes); + qError("Illegal data type %d or data type length %d", dataType, dataBytes); return TSDB_CODE_TSC_INVALID_SQL; } @@ -263,8 +263,10 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI } if (functionId == TSDB_FUNC_SUM) { - if (dataType >= TSDB_DATA_TYPE_TINYINT && dataType <= TSDB_DATA_TYPE_BIGINT) { + if (IS_SIGNED_NUMERIC_TYPE(dataType)) { *type = TSDB_DATA_TYPE_BIGINT; + } else if (IS_UNSIGNED_NUMERIC_TYPE(dataType)) { + *type = TSDB_DATA_TYPE_UBIGINT; } else { *type = TSDB_DATA_TYPE_DOUBLE; } @@ -463,7 +465,7 @@ int32_t no_data_info(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, int32_t colId } #define LIST_ADD_N(x, ctx, p, t, numOfElem, tsdbType) \ - { \ + do { \ t *d = (t *)(p); \ for (int32_t i = 0; i < (ctx)->size; ++i) { \ if (((ctx)->hasNull) && isNull((char *)&(d)[i], tsdbType)) { \ @@ -472,7 +474,7 @@ int32_t no_data_info(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, int32_t colId (x) += (d)[i]; \ (numOfElem)++; \ } \ - }; + } while(0) #define UPDATE_DATA(ctx, left, right, num, sign, k) \ do { \ @@ -516,9 +518,12 @@ static void do_sum(SQLFunctionCtx *pCtx) { notNullElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; assert(pCtx->size >= pCtx->preAggVals.statis.numOfNull); - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { - int64_t *retVal = (int64_t*) pCtx->aOutputBuf; + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) { + int64_t *retVal = (int64_t *)pCtx->aOutputBuf; *retVal += pCtx->preAggVals.statis.sum; + } else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) { + uint64_t *retVal = (uint64_t *)pCtx->aOutputBuf; + *retVal += (uint64_t)pCtx->preAggVals.statis.sum; } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { double *retVal = (double*) pCtx->aOutputBuf; *retVal += GET_DOUBLE_VAL((const char*)&(pCtx->preAggVals.statis.sum)); @@ -526,10 +531,10 @@ static void do_sum(SQLFunctionCtx *pCtx) { } else { // computing based on the true data block void *pData = GET_INPUT_DATA_LIST(pCtx); notNullElems = 0; - - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { - int64_t *retVal = (int64_t*) pCtx->aOutputBuf; - + + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) { + int64_t *retVal = (int64_t *)pCtx->aOutputBuf; + if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { LIST_ADD_N(*retVal, pCtx, pData, int8_t, notNullElems, pCtx->inputType); } else if (pCtx->inputType == TSDB_DATA_TYPE_SMALLINT) { @@ -539,11 +544,23 @@ static void do_sum(SQLFunctionCtx *pCtx) { } else if (pCtx->inputType == TSDB_DATA_TYPE_BIGINT) { LIST_ADD_N(*retVal, pCtx, pData, int64_t, notNullElems, pCtx->inputType); } + } else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) { + uint64_t *retVal = (uint64_t *)pCtx->aOutputBuf; + + if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { + LIST_ADD_N(*retVal, pCtx, pData, uint8_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_SMALLINT) { + LIST_ADD_N(*retVal, pCtx, pData, uint16_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_INT) { + LIST_ADD_N(*retVal, pCtx, pData, uint32_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_BIGINT) { + LIST_ADD_N(*retVal, pCtx, pData, uint64_t, notNullElems, pCtx->inputType); + } } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE) { - double *retVal = (double*) pCtx->aOutputBuf; + double *retVal = (double *)pCtx->aOutputBuf; LIST_ADD_N(*retVal, pCtx, pData, double, notNullElems, pCtx->inputType); } else if (pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { - double *retVal = (double*) pCtx->aOutputBuf; + double *retVal = (double *)pCtx->aOutputBuf; LIST_ADD_N(*retVal, pCtx, pData, float, notNullElems, pCtx->inputType); } } @@ -668,7 +685,7 @@ static int32_t firstFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, i } static int32_t lastFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, int32_t colId) { - if (pCtx->order != pCtx->param[0].i64Key) { + if (pCtx->order != pCtx->param[0].i64) { return BLK_DATA_NO_NEEDED; } @@ -700,7 +717,7 @@ static int32_t firstDistFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY en } static int32_t lastDistFuncRequired(SQLFunctionCtx *pCtx, TSKEY start, TSKEY end, int32_t colId) { - if (pCtx->order != pCtx->param[0].i64Key) { + if (pCtx->order != pCtx->param[0].i64) { return BLK_DATA_NO_NEEDED; } @@ -732,15 +749,16 @@ static void avg_function(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SAvgInfo *pAvgInfo = (SAvgInfo *)GET_ROWCELL_INTERBUF(pResInfo); - double * pVal = &pAvgInfo->sum; + double *pVal = &pAvgInfo->sum; - if (pCtx->preAggVals.isSet) { - // Pre-aggregation + if (pCtx->preAggVals.isSet) { // Pre-aggregation notNullElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; assert(notNullElems >= 0); - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) { *pVal += pCtx->preAggVals.statis.sum; + } else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) { + *pVal += (uint64_t) pCtx->preAggVals.statis.sum; } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { *pVal += GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.sum)); } @@ -759,6 +777,14 @@ static void avg_function(SQLFunctionCtx *pCtx) { LIST_ADD_N(*pVal, pCtx, pData, double, notNullElems, pCtx->inputType); } else if (pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { LIST_ADD_N(*pVal, pCtx, pData, float, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UTINYINT) { + LIST_ADD_N(*pVal, pCtx, pData, uint8_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_USMALLINT) { + LIST_ADD_N(*pVal, pCtx, pData, uint16_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UINT) { + LIST_ADD_N(*pVal, pCtx, pData, uint32_t, notNullElems, pCtx->inputType); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UBIGINT) { + LIST_ADD_N(*pVal, pCtx, pData, uint64_t, notNullElems, pCtx->inputType); } } @@ -804,8 +830,16 @@ static void avg_function_f(SQLFunctionCtx *pCtx, int32_t index) { pAvgInfo->sum += GET_DOUBLE_VAL(pData); } else if (pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { pAvgInfo->sum += GET_FLOAT_VAL(pData); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UTINYINT) { + pAvgInfo->sum += GET_UINT8_VAL(pData); + } else if (pCtx->inputType == TSDB_DATA_TYPE_USMALLINT) { + pAvgInfo->sum += GET_UINT16_VAL(pData); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UINT) { + pAvgInfo->sum += GET_UINT32_VAL(pData); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UBIGINT) { + pAvgInfo->sum += GET_UINT64_VAL(pData); } - + // restore sum and count of elements pAvgInfo->num += 1; @@ -822,7 +856,7 @@ static void avg_func_merge(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); double *sum = (double*) pCtx->aOutputBuf; - char * input = GET_INPUT_DATA_LIST(pCtx); + char *input = GET_INPUT_DATA_LIST(pCtx); for (int32_t i = 0; i < pCtx->size; ++i, input += pCtx->inputBytes) { SAvgInfo *pInput = (SAvgInfo *)input; @@ -848,13 +882,12 @@ static void avg_finalizer(SQLFunctionCtx *pCtx) { if (GET_INT64_VAL(GET_ROWCELL_INTERBUF(pResInfo)) <= 0) { setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); - return; // empty table + return; } *(double *)pCtx->aOutputBuf = (*(double *)pCtx->aOutputBuf) / *(int64_t *)GET_ROWCELL_INTERBUF(pResInfo); } else { // this is the secondary merge, only in the secondary merge, the input type is TSDB_DATA_TYPE_BINARY - assert(pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_DOUBLE); - + assert(IS_NUMERIC_TYPE(pCtx->inputType)); SAvgInfo *pAvgInfo = (SAvgInfo *)GET_ROWCELL_INTERBUF(pResInfo); if (pAvgInfo->num == 0) { // all data are NULL or empty table @@ -881,12 +914,8 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, if (*notNullElems == 0) { return; } - - if (*notNullElems == 0){ - return; - } - void * tval = NULL; + void* tval = NULL; int16_t index = 0; if (isMin) { @@ -913,7 +942,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, key = pCtx->ptsList[index]; } - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) { int64_t val = GET_INT64_VAL(tval); if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { int8_t *data = (int8_t *)pOutput; @@ -926,7 +955,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, } else if (pCtx->inputType == TSDB_DATA_TYPE_INT) { int32_t *data = (int32_t *)pOutput; #if defined(_DEBUG_VIEW) - tscDebug("max value updated according to pre-cal:%d", *data); + qDebug("max value updated according to pre-cal:%d", *data); #endif if ((*data < val) ^ isMin) { @@ -934,7 +963,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, for (int32_t i = 0; i < (pCtx)->tagInfo.numOfTagCols; ++i) { SQLFunctionCtx *__ctx = pCtx->tagInfo.pTagCtxList[i]; if (__ctx->functionId == TSDB_FUNC_TS_DUMMY) { - __ctx->tag.i64Key = key; + __ctx->tag.i64 = key; __ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; } @@ -945,11 +974,27 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, int64_t *data = (int64_t *)pOutput; UPDATE_DATA(pCtx, *data, val, notNullElems, isMin, key); } + } else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) { + uint64_t val = GET_UINT64_VAL(tval); + if (pCtx->inputType == TSDB_DATA_TYPE_UTINYINT) { + uint8_t *data = (uint8_t *)pOutput; + + UPDATE_DATA(pCtx, *data, (uint8_t)val, notNullElems, isMin, key); + } else if (pCtx->inputType == TSDB_DATA_TYPE_USMALLINT) { + uint16_t *data = (uint16_t *)pOutput; + UPDATE_DATA(pCtx, *data, (uint16_t)val, notNullElems, isMin, key); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UINT) { + uint32_t *data = (uint32_t *)pOutput; + UPDATE_DATA(pCtx, *data, (uint32_t)val, notNullElems, isMin, key); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UBIGINT) { + uint64_t *data = (uint64_t *)pOutput; + UPDATE_DATA(pCtx, *data, val, notNullElems, isMin, key); + } } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE) { - double *data = (double *)pOutput; - double val = GET_DOUBLE_VAL(tval); - - UPDATE_DATA(pCtx, *data, val, notNullElems, isMin, key); + double *data = (double *)pOutput; + double val = GET_DOUBLE_VAL(tval); + + UPDATE_DATA(pCtx, *data, val, notNullElems, isMin, key); } else if (pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { float *data = (float *)pOutput; double val = GET_DOUBLE_VAL(tval); @@ -965,7 +1010,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, *notNullElems = 0; - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType)) { if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { TYPED_LOOPCHECK_N(int8_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); } else if (pCtx->inputType == TSDB_DATA_TYPE_SMALLINT) { @@ -989,11 +1034,21 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, *notNullElems += 1; } #if defined(_DEBUG_VIEW) - tscDebug("max value updated:%d", *retVal); + qDebug("max value updated:%d", *retVal); #endif } else if (pCtx->inputType == TSDB_DATA_TYPE_BIGINT) { TYPED_LOOPCHECK_N(int64_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); } + } else if (IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType)) { + if (pCtx->inputType == TSDB_DATA_TYPE_UTINYINT) { + TYPED_LOOPCHECK_N(uint8_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); + } else if (pCtx->inputType == TSDB_DATA_TYPE_USMALLINT) { + TYPED_LOOPCHECK_N(uint16_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); + } else if (pCtx->inputType == TSDB_DATA_TYPE_UINT) { + TYPED_LOOPCHECK_N(uint32_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); + } else if (pCtx->inputType == TSDB_DATA_TYPE_BIGINT) { + TYPED_LOOPCHECK_N(uint64_t, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); + } } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE) { TYPED_LOOPCHECK_N(double, pOutput, p, pCtx, pCtx->inputType, isMin, *notNullElems); } else if (pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { @@ -1009,28 +1064,40 @@ static bool min_func_setup(SQLFunctionCtx *pCtx) { GET_TRUE_DATA_TYPE(); switch (type) { + case TSDB_DATA_TYPE_TINYINT: + *((int8_t *)pCtx->aOutputBuf) = INT8_MAX; + break; + case TSDB_DATA_TYPE_UTINYINT: + *(uint8_t *) pCtx->aOutputBuf = UINT8_MAX; + break; + case TSDB_DATA_TYPE_SMALLINT: + *((int16_t *)pCtx->aOutputBuf) = INT16_MAX; + break; + case TSDB_DATA_TYPE_USMALLINT: + *((uint16_t *)pCtx->aOutputBuf) = UINT16_MAX; + break; case TSDB_DATA_TYPE_INT: *((int32_t *)pCtx->aOutputBuf) = INT32_MAX; break; + case TSDB_DATA_TYPE_UINT: + *((uint32_t *)pCtx->aOutputBuf) = UINT32_MAX; + break; + case TSDB_DATA_TYPE_BIGINT: + *((int64_t *)pCtx->aOutputBuf) = INT64_MAX; + break; + case TSDB_DATA_TYPE_UBIGINT: + *((uint64_t *)pCtx->aOutputBuf) = UINT64_MAX; + break; case TSDB_DATA_TYPE_FLOAT: *((float *)pCtx->aOutputBuf) = FLT_MAX; break; case TSDB_DATA_TYPE_DOUBLE: *((double *)pCtx->aOutputBuf) = DBL_MAX; break; - case TSDB_DATA_TYPE_BIGINT: - *((int64_t *)pCtx->aOutputBuf) = INT64_MAX; - break; - case TSDB_DATA_TYPE_SMALLINT: - *((int16_t *)pCtx->aOutputBuf) = INT16_MAX; - break; - case TSDB_DATA_TYPE_TINYINT: - *((int8_t *)pCtx->aOutputBuf) = INT8_MAX; - break; default: - tscError("illegal data type:%d in min/max query", pCtx->inputType); + qError("illegal data type:%d in min/max query", pCtx->inputType); } - + return true; } @@ -1045,6 +1112,9 @@ static bool max_func_setup(SQLFunctionCtx *pCtx) { case TSDB_DATA_TYPE_INT: *((int32_t *)pCtx->aOutputBuf) = INT32_MIN; break; + case TSDB_DATA_TYPE_UINT: + *((uint32_t *)pCtx->aOutputBuf) = 0; + break; case TSDB_DATA_TYPE_FLOAT: *((float *)pCtx->aOutputBuf) = -FLT_MAX; break; @@ -1054,14 +1124,23 @@ static bool max_func_setup(SQLFunctionCtx *pCtx) { case TSDB_DATA_TYPE_BIGINT: *((int64_t *)pCtx->aOutputBuf) = INT64_MIN; break; + case TSDB_DATA_TYPE_UBIGINT: + *((uint64_t *)pCtx->aOutputBuf) = 0; + break; case TSDB_DATA_TYPE_SMALLINT: *((int16_t *)pCtx->aOutputBuf) = INT16_MIN; break; + case TSDB_DATA_TYPE_USMALLINT: + *((uint16_t *)pCtx->aOutputBuf) = 0; + break; case TSDB_DATA_TYPE_TINYINT: *((int8_t *)pCtx->aOutputBuf) = INT8_MIN; break; + case TSDB_DATA_TYPE_UTINYINT: + *((uint8_t *)pCtx->aOutputBuf) = 0; + break; default: - tscError("illegal data type:%d in min/max query", pCtx->inputType); + qError("illegal data type:%d in min/max query", pCtx->inputType); } return true; @@ -1108,7 +1187,6 @@ static int32_t minmax_merge_impl(SQLFunctionCtx *pCtx, int32_t bytes, char *outp int32_t notNullElems = 0; GET_TRUE_DATA_TYPE(); - assert(pCtx->stableQuery); for (int32_t i = 0; i < pCtx->size; ++i) { @@ -1122,7 +1200,7 @@ static int32_t minmax_merge_impl(SQLFunctionCtx *pCtx, int32_t bytes, char *outp int8_t v = GET_INT8_VAL(input); DUPATE_DATA_WITHOUT_TS(pCtx, *(int8_t *)output, v, notNullElems, isMin); break; - }; + } case TSDB_DATA_TYPE_SMALLINT: { int16_t v = GET_INT16_VAL(input); DUPATE_DATA_WITHOUT_TS(pCtx, *(int16_t *)output, v, notNullElems, isMin); @@ -1156,7 +1234,7 @@ static int32_t minmax_merge_impl(SQLFunctionCtx *pCtx, int32_t bytes, char *outp int64_t v = GET_INT64_VAL(input); DUPATE_DATA_WITHOUT_TS(pCtx, *(int64_t *)output, v, notNullElems, isMin); break; - }; + } default: break; } @@ -1312,10 +1390,9 @@ static void stddev_function(SQLFunctionCtx *pCtx) { break; } default: - tscError("stddev function not support data type:%d", pCtx->inputType); + qError("stddev function not support data type:%d", pCtx->inputType); } - // TODO get the correct data SET_VAL(pCtx, 1, 1); } } @@ -1362,7 +1439,7 @@ static void stddev_function_f(SQLFunctionCtx *pCtx, int32_t index) { break; } default: - tscError("stddev function not support data type:%d", pCtx->inputType); + qError("stddev function not support data type:%d", pCtx->inputType); } SET_VAL(pCtx, 1, 1); @@ -1421,7 +1498,7 @@ static bool first_last_function_setup(SQLFunctionCtx *pCtx) { // used to keep the timestamp for comparison pCtx->param[1].nType = 0; - pCtx->param[1].i64Key = 0; + pCtx->param[1].i64 = 0; return true; } @@ -1552,9 +1629,9 @@ static void first_dist_func_merge(SQLFunctionCtx *pCtx) { } // The param[1] is used to keep the initial value of max ts value - if (pCtx->param[1].nType != pCtx->outputType || pCtx->param[1].i64Key > pInput->ts) { + if (pCtx->param[1].nType != pCtx->outputType || pCtx->param[1].i64 > pInput->ts) { memcpy(pCtx->aOutputBuf, pData, pCtx->outputBytes); - pCtx->param[1].i64Key = pInput->ts; + pCtx->param[1].i64 = pInput->ts; pCtx->param[1].nType = pCtx->outputType; DO_UPDATE_TAG_COLUMNS(pCtx, pInput->ts); @@ -1573,7 +1650,7 @@ static void first_dist_func_merge(SQLFunctionCtx *pCtx) { * least one data in this block that is not null.(TODO opt for this case) */ static void last_function(SQLFunctionCtx *pCtx) { - if (pCtx->order != pCtx->param[0].i64Key || pCtx->preAggVals.dataBlockLoaded == false) { + if (pCtx->order != pCtx->param[0].i64 || pCtx->preAggVals.dataBlockLoaded == false) { return; } @@ -1609,7 +1686,7 @@ static void last_function_f(SQLFunctionCtx *pCtx, int32_t index) { } // the scan order is not the required order, ignore it - if (pCtx->order != pCtx->param[0].i64Key) { + if (pCtx->order != pCtx->param[0].i64) { return; } @@ -1645,7 +1722,7 @@ static void last_data_assign_impl(SQLFunctionCtx *pCtx, char *pData, int32_t ind if (pInfo->hasResult != DATA_SET_FLAG || pInfo->ts < timestamp[index]) { #if defined(_DEBUG_VIEW) - tscDebug("assign index:%d, ts:%" PRId64 ", val:%d, ", index, timestamp[index], *(int32_t *)pData); + qDebug("assign index:%d, ts:%" PRId64 ", val:%d, ", index, timestamp[index], *(int32_t *)pData); #endif memcpy(pCtx->aOutputBuf, pData, pCtx->inputBytes); @@ -1661,7 +1738,7 @@ static void last_dist_function(SQLFunctionCtx *pCtx) { * 1. for scan data is not the required order * 2. for data blocks that are not loaded, no need to check data */ - if (pCtx->order != pCtx->param[0].i64Key) { + if (pCtx->order != pCtx->param[0].i64) { return; } @@ -1706,7 +1783,7 @@ static void last_dist_function_f(SQLFunctionCtx *pCtx, int32_t index) { * 1. for scan data in asc order, no need to check data * 2. for data blocks that are not loaded, no need to check data */ - if (pCtx->order != pCtx->param[0].i64Key) { + if (pCtx->order != pCtx->param[0].i64) { return; } @@ -1732,9 +1809,9 @@ static void last_dist_func_merge(SQLFunctionCtx *pCtx) { * param[1] used to keep the corresponding timestamp to decide if current result is * the true last result */ - if (pCtx->param[1].nType != pCtx->outputType || pCtx->param[1].i64Key < pInput->ts) { + if (pCtx->param[1].nType != pCtx->outputType || pCtx->param[1].i64 < pInput->ts) { memcpy(pCtx->aOutputBuf, pData, pCtx->outputBytes); - pCtx->param[1].i64Key = pInput->ts; + pCtx->param[1].i64 = pInput->ts; pCtx->param[1].nType = pCtx->outputType; DO_UPDATE_TAG_COLUMNS(pCtx, pInput->ts); @@ -1794,7 +1871,7 @@ static void last_row_finalizer(SQLFunctionCtx *pCtx) { static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int64_t tsKey, char *pTags, SExtTagsInfo *pTagInfo, int16_t stage) { dst->v.nType = type; - dst->v.i64Key = *(int64_t *)val; + dst->v.i64 = *(int64_t *)val; dst->timestamp = tsKey; int32_t size = 0; @@ -1805,7 +1882,7 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6 SQLFunctionCtx* ctx = pTagInfo->pTagCtxList[i]; if (ctx->functionId == TSDB_FUNC_TS_DUMMY) { ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; - ctx->tag.i64Key = tsKey; + ctx->tag.i64 = tsKey; } tVariantDump(&ctx->tag, dst->pTags + size, ctx->tag.nType, true); @@ -1832,15 +1909,15 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, if (pInfo->num < maxLen) { if (pInfo->num == 0 || ((type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) && - val.i64Key >= pList[pInfo->num - 1]->v.i64Key) || + val.i64 >= pList[pInfo->num - 1]->v.i64) || ((type >= TSDB_DATA_TYPE_FLOAT && type <= TSDB_DATA_TYPE_DOUBLE) && val.dKey >= pList[pInfo->num - 1]->v.dKey)) { - valuePairAssign(pList[pInfo->num], type, (const char*)&val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[pInfo->num], type, (const char*)&val.i64, ts, pTags, pTagInfo, stage); } else { int32_t i = pInfo->num - 1; if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) { - while (i >= 0 && pList[i]->v.i64Key > val.i64Key) { + while (i >= 0 && pList[i]->v.i64 > val.i64) { VALUEPAIRASSIGN(pList[i + 1], pList[i], pTagInfo->tagsLen); i -= 1; } @@ -1851,18 +1928,18 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, } } - valuePairAssign(pList[i + 1], type, (const char*) &val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[i + 1], type, (const char*) &val.i64, ts, pTags, pTagInfo, stage); } pInfo->num++; } else { int32_t i = 0; - if (((type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) && val.i64Key > pList[0]->v.i64Key) || + if (((type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) && val.i64 > pList[0]->v.i64) || ((type >= TSDB_DATA_TYPE_FLOAT && type <= TSDB_DATA_TYPE_DOUBLE) && val.dKey > pList[0]->v.dKey)) { // find the appropriate the slot position if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) { - while (i + 1 < maxLen && pList[i + 1]->v.i64Key < val.i64Key) { + while (i + 1 < maxLen && pList[i + 1]->v.i64 < val.i64) { VALUEPAIRASSIGN(pList[i], pList[i + 1], pTagInfo->tagsLen); i += 1; } @@ -1873,7 +1950,7 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, } } - valuePairAssign(pList[i], type, (const char*) &val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[i], type, (const char*) &val.i64, ts, pTags, pTagInfo, stage); } } } @@ -1888,12 +1965,12 @@ static void do_bottom_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pDa if (pInfo->num < maxLen) { if (pInfo->num == 0) { - valuePairAssign(pList[pInfo->num], type, (const char*) &val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[pInfo->num], type, (const char*) &val.i64, ts, pTags, pTagInfo, stage); } else { int32_t i = pInfo->num - 1; if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) { - while (i >= 0 && pList[i]->v.i64Key < val.i64Key) { + while (i >= 0 && pList[i]->v.i64 < val.i64) { VALUEPAIRASSIGN(pList[i + 1], pList[i], pTagInfo->tagsLen); i -= 1; } @@ -1904,18 +1981,18 @@ static void do_bottom_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pDa } } - valuePairAssign(pList[i + 1], type, (const char*)&val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[i + 1], type, (const char*)&val.i64, ts, pTags, pTagInfo, stage); } pInfo->num++; } else { int32_t i = 0; - if (((type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) && val.i64Key < pList[0]->v.i64Key) || + if (((type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) && val.i64 < pList[0]->v.i64) || ((type >= TSDB_DATA_TYPE_FLOAT && type <= TSDB_DATA_TYPE_DOUBLE) && val.dKey < pList[0]->v.dKey)) { // find the appropriate the slot position if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_BIGINT) { - while (i + 1 < maxLen && pList[i + 1]->v.i64Key > val.i64Key) { + while (i + 1 < maxLen && pList[i + 1]->v.i64 > val.i64) { VALUEPAIRASSIGN(pList[i], pList[i + 1], pTagInfo->tagsLen); i += 1; } @@ -1926,7 +2003,7 @@ static void do_bottom_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pDa } } - valuePairAssign(pList[i], type, (const char*)&val.i64Key, ts, pTags, pTagInfo, stage); + valuePairAssign(pList[i], type, (const char*)&val.i64, ts, pTags, pTagInfo, stage); } } } @@ -1956,10 +2033,10 @@ static int32_t resDataAscComparFn(const void *pLeft, const void *pRight) { return pLeftElem->v.dKey > pRightElem->v.dKey ? 1 : -1; } } else { - if (pLeftElem->v.i64Key == pRightElem->v.i64Key) { + if (pLeftElem->v.i64 == pRightElem->v.i64) { return 0; } else { - return pLeftElem->v.i64Key > pRightElem->v.i64Key ? 1 : -1; + return pLeftElem->v.i64 > pRightElem->v.i64 ? 1 : -1; } } } @@ -1976,17 +2053,19 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { int32_t len = (int32_t)(GET_RES_INFO(pCtx)->numOfRes); switch (type) { + case TSDB_DATA_TYPE_UINT: case TSDB_DATA_TYPE_INT: { int32_t *output = (int32_t *)pCtx->aOutputBuf; for (int32_t i = 0; i < len; ++i, output += step) { - *output = (int32_t)tvp[i]->v.i64Key; + *output = (int32_t)tvp[i]->v.i64; } break; } + case TSDB_DATA_TYPE_UBIGINT: case TSDB_DATA_TYPE_BIGINT: { int64_t *output = (int64_t *)pCtx->aOutputBuf; for (int32_t i = 0; i < len; ++i, output += step) { - *output = tvp[i]->v.i64Key; + *output = tvp[i]->v.i64; } break; } @@ -2004,22 +2083,24 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) { } break; } + case TSDB_DATA_TYPE_USMALLINT: case TSDB_DATA_TYPE_SMALLINT: { int16_t *output = (int16_t *)pCtx->aOutputBuf; for (int32_t i = 0; i < len; ++i, output += step) { - *output = (int16_t)tvp[i]->v.i64Key; + *output = (int16_t)tvp[i]->v.i64; } break; } + case TSDB_DATA_TYPE_UTINYINT: case TSDB_DATA_TYPE_TINYINT: { int8_t *output = (int8_t *)pCtx->aOutputBuf; for (int32_t i = 0; i < len; ++i, output += step) { - *output = (int8_t)tvp[i]->v.i64Key; + *output = (int8_t)tvp[i]->v.i64; } break; } default: { - tscError("top/bottom function not support data type:%d", pCtx->inputType); + qError("top/bottom function not support data type:%d", pCtx->inputType); return; } } @@ -2077,7 +2158,7 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha STopBotInfo *pTopBotInfo = getTopBotOutputInfo(pCtx); // required number of results are not reached, continue load data block - if (pTopBotInfo->num < pCtx->param[0].i64Key) { + if (pTopBotInfo->num < pCtx->param[0].i64) { return true; } @@ -2086,13 +2167,13 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha if (functionId == TSDB_FUNC_TOP) { switch (pCtx->inputType) { case TSDB_DATA_TYPE_TINYINT: - return GET_INT8_VAL(maxval) > pRes[0]->v.i64Key; + return GET_INT8_VAL(maxval) > pRes[0]->v.i64; case TSDB_DATA_TYPE_SMALLINT: - return GET_INT16_VAL(maxval) > pRes[0]->v.i64Key; + return GET_INT16_VAL(maxval) > pRes[0]->v.i64; case TSDB_DATA_TYPE_INT: - return GET_INT32_VAL(maxval) > pRes[0]->v.i64Key; + return GET_INT32_VAL(maxval) > pRes[0]->v.i64; case TSDB_DATA_TYPE_BIGINT: - return GET_INT64_VAL(maxval) > pRes[0]->v.i64Key; + return GET_INT64_VAL(maxval) > pRes[0]->v.i64; case TSDB_DATA_TYPE_FLOAT: return GET_FLOAT_VAL(maxval) > pRes[0]->v.dKey; case TSDB_DATA_TYPE_DOUBLE: @@ -2103,13 +2184,13 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha } else { switch (pCtx->inputType) { case TSDB_DATA_TYPE_TINYINT: - return GET_INT8_VAL(minval) < pRes[0]->v.i64Key; + return GET_INT8_VAL(minval) < pRes[0]->v.i64; case TSDB_DATA_TYPE_SMALLINT: - return GET_INT16_VAL(minval) < pRes[0]->v.i64Key; + return GET_INT16_VAL(minval) < pRes[0]->v.i64; case TSDB_DATA_TYPE_INT: - return GET_INT32_VAL(minval) < pRes[0]->v.i64Key; + return GET_INT32_VAL(minval) < pRes[0]->v.i64; case TSDB_DATA_TYPE_BIGINT: - return GET_INT64_VAL(minval) < pRes[0]->v.i64Key; + return GET_INT64_VAL(minval) < pRes[0]->v.i64; case TSDB_DATA_TYPE_FLOAT: return GET_FLOAT_VAL(minval) < pRes[0]->v.dKey; case TSDB_DATA_TYPE_DOUBLE: @@ -2129,12 +2210,12 @@ bool topbot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, const cha static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) { char *tmp = (char *)pTopBotInfo + sizeof(STopBotInfo); pTopBotInfo->res = (tValuePair**) tmp; - tmp += POINTER_BYTES * pCtx->param[0].i64Key; + tmp += POINTER_BYTES * pCtx->param[0].i64; size_t size = sizeof(tValuePair) + pCtx->tagInfo.tagsLen; -// assert(pCtx->param[0].i64Key > 0); +// assert(pCtx->param[0].i64 > 0); - for (int32_t i = 0; i < pCtx->param[0].i64Key; ++i) { + for (int32_t i = 0; i < pCtx->param[0].i64; ++i) { pTopBotInfo->res[i] = (tValuePair*) tmp; pTopBotInfo->res[i]->pTags = tmp + sizeof(tValuePair); tmp += size; @@ -2167,7 +2248,7 @@ static void top_function(SQLFunctionCtx *pCtx) { } notNullElems++; - do_top_function_add(pRes, (int32_t)pCtx->param[0].i64Key, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); + do_top_function_add(pRes, (int32_t)pCtx->param[0].i64, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); } if (!pCtx->hasNull) { @@ -2195,7 +2276,7 @@ static void top_function_f(SQLFunctionCtx *pCtx, int32_t index) { SET_VAL(pCtx, 1, 1); TSKEY ts = GET_TS_DATA(pCtx, index); - do_top_function_add(pRes, (int32_t)pCtx->param[0].i64Key, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); + do_top_function_add(pRes, (int32_t)pCtx->param[0].i64, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2212,7 +2293,7 @@ static void top_func_merge(SQLFunctionCtx *pCtx) { // the intermediate result is binary, we only use the output data type for (int32_t i = 0; i < pInput->num; ++i) { int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT)? TSDB_DATA_TYPE_DOUBLE:pCtx->outputType; - do_top_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, + do_top_function_add(pOutput, (int32_t)pCtx->param[0].i64, &pInput->res[i]->v.i64, pInput->res[i]->timestamp, type, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); } @@ -2238,7 +2319,7 @@ static void bottom_function(SQLFunctionCtx *pCtx) { } notNullElems++; - do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64Key, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); + do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64, data, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); } if (!pCtx->hasNull) { @@ -2264,7 +2345,7 @@ static void bottom_function_f(SQLFunctionCtx *pCtx, int32_t index) { STopBotInfo *pRes = getTopBotOutputInfo(pCtx); SET_VAL(pCtx, 1, 1); - do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64Key, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); + do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0); SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); pResInfo->hasResult = DATA_SET_FLAG; @@ -2281,7 +2362,7 @@ static void bottom_func_merge(SQLFunctionCtx *pCtx) { // the intermediate result is binary, we only use the output data type for (int32_t i = 0; i < pInput->num; ++i) { int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT) ? TSDB_DATA_TYPE_DOUBLE : pCtx->outputType; - do_bottom_function_add(pOutput, (int32_t)pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, type, + do_bottom_function_add(pOutput, (int32_t)pCtx->param[0].i64, &pInput->res[i]->v.i64, pInput->res[i]->timestamp, type, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage); } @@ -2307,11 +2388,11 @@ static void top_bottom_func_finalizer(SQLFunctionCtx *pCtx) { tValuePair **tvp = pRes->res; // user specify the order of output by sort the result according to timestamp - if (pCtx->param[1].i64Key == PRIMARYKEY_TIMESTAMP_COL_INDEX) { - __compar_fn_t comparator = (pCtx->param[2].i64Key == TSDB_ORDER_ASC) ? resAscComparFn : resDescComparFn; + if (pCtx->param[1].i64 == PRIMARYKEY_TIMESTAMP_COL_INDEX) { + __compar_fn_t comparator = (pCtx->param[2].i64 == TSDB_ORDER_ASC) ? resAscComparFn : resDescComparFn; qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); - } else if (pCtx->param[1].i64Key > PRIMARYKEY_TIMESTAMP_COL_INDEX) { - __compar_fn_t comparator = (pCtx->param[2].i64Key == TSDB_ORDER_ASC) ? resDataAscComparFn : resDataDescComparFn; + } else if (pCtx->param[1].i64 > PRIMARYKEY_TIMESTAMP_COL_INDEX) { + __compar_fn_t comparator = (pCtx->param[2].i64 == TSDB_ORDER_ASC) ? resDataAscComparFn : resDataDescComparFn; qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } @@ -2438,7 +2519,7 @@ static void percentile_function_f(SQLFunctionCtx *pCtx, int32_t index) { } static void percentile_finalizer(SQLFunctionCtx *pCtx) { - double v = pCtx->param[0].nType == TSDB_DATA_TYPE_INT ? pCtx->param[0].i64Key : pCtx->param[0].dKey; + double v = pCtx->param[0].nType == TSDB_DATA_TYPE_INT ? pCtx->param[0].i64 : pCtx->param[0].dKey; SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SPercentileInfo* ppInfo = (SPercentileInfo *) GET_ROWCELL_INTERBUF(pResInfo); @@ -2586,7 +2667,7 @@ static void apercentile_func_merge(SQLFunctionCtx *pCtx) { } static void apercentile_finalizer(SQLFunctionCtx *pCtx) { - double v = (pCtx->param[0].nType == TSDB_DATA_TYPE_INT) ? pCtx->param[0].i64Key : pCtx->param[0].dKey; + double v = (pCtx->param[0].nType == TSDB_DATA_TYPE_INT) ? pCtx->param[0].i64 : pCtx->param[0].dKey; SResultRowCellInfo * pResInfo = GET_RES_INFO(pCtx); SAPercentileInfo *pOutput = GET_ROWCELL_INTERBUF(pResInfo); @@ -2761,7 +2842,7 @@ static void leastsquares_function_f(SQLFunctionCtx *pCtx, int32_t index) { break; } default: - tscError("error data type in leastsquare function:%d", pCtx->inputType); + qError("error data type in leastsquare function:%d", pCtx->inputType); }; SET_VAL(pCtx, 1, 1); @@ -2841,7 +2922,7 @@ static void col_project_function_f(SQLFunctionCtx *pCtx, int32_t index) { } // only one output - if (pCtx->param[0].i64Key == 1 && pResInfo->numOfRes >= 1) { + if (pCtx->param[0].i64 == 1 && pResInfo->numOfRes >= 1) { return; } @@ -2942,23 +3023,23 @@ static void diff_function(SQLFunctionCtx *pCtx) { } if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { - *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64Key); + *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64); *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } else { - *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64Key); // direct previous may be null + *pOutput = (int32_t)(pData[i] - pCtx->param[1].i64); // direct previous may be null *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; notNullElems++; } @@ -2974,28 +3055,28 @@ static void diff_function(SQLFunctionCtx *pCtx) { } if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { - *pOutput = pData[i] - pCtx->param[1].i64Key; + *pOutput = pData[i] - pCtx->param[1].i64; *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pCtx->param[1].i64Key; + *pOutput = pData[i] - pCtx->param[1].i64; *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; notNullElems++; } break; - }; + } case TSDB_DATA_TYPE_DOUBLE: { double *pData = (double *)data; double *pOutput = (double *)pCtx->aOutputBuf; @@ -3025,7 +3106,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { notNullElems++; } break; - }; + } case TSDB_DATA_TYPE_FLOAT: { float *pData = (float *)data; float *pOutput = (float *)pCtx->aOutputBuf; @@ -3058,7 +3139,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { notNullElems++; } break; - }; + } case TSDB_DATA_TYPE_SMALLINT: { int16_t *pData = (int16_t *)data; int16_t *pOutput = (int16_t *)pCtx->aOutputBuf; @@ -3069,27 +3150,27 @@ static void diff_function(SQLFunctionCtx *pCtx) { } if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { - *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64Key); + *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64); *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } else { - *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64Key); + *pOutput = (int16_t)(pData[i] - pCtx->param[1].i64); *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; notNullElems++; } break; - }; + } case TSDB_DATA_TYPE_TINYINT: { int8_t *pData = (int8_t *)data; int8_t *pOutput = (int8_t *)pCtx->aOutputBuf; @@ -3100,30 +3181,30 @@ static void diff_function(SQLFunctionCtx *pCtx) { } if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; } else if ((i == 0 && pCtx->order == TSDB_ORDER_ASC) || (i == pCtx->size - 1 && pCtx->order == TSDB_ORDER_DESC)) { - *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64Key); + *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64); *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } else { - *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64Key); + *pOutput = (int8_t)(pData[i] - pCtx->param[1].i64); *pTimestamp = tsList[i]; pOutput += 1; pTimestamp += 1; } - pCtx->param[1].i64Key = pData[i]; + pCtx->param[1].i64 = pData[i]; pCtx->param[1].nType = pCtx->inputType; notNullElems++; } break; - }; + } default: - tscError("error input type"); + qError("error input type"); } // initial value is not set yet @@ -3147,10 +3228,10 @@ static void diff_function(SQLFunctionCtx *pCtx) { do { \ if ((ctx)->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { \ (ctx)->param[1].nType = (ctx)->inputType; \ - *(type *)&(ctx)->param[1].i64Key = *(type *)(d); \ + *(type *)&(ctx)->param[1].i64 = *(type *)(d); \ } else { \ - *(type *)(ctx)->aOutputBuf = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64Key)); \ - *(type *)(&(ctx)->param[1].i64Key) = *(type *)(d); \ + *(type *)(ctx)->aOutputBuf = *(type *)(d) - (*(type *)(&(ctx)->param[1].i64)); \ + *(type *)(&(ctx)->param[1].i64) = *(type *)(d); \ *(int64_t *)(ctx)->ptsOutputBuf = GET_TS_DATA(ctx, index); \ } \ } while (0); @@ -3172,10 +3253,10 @@ static void diff_function_f(SQLFunctionCtx *pCtx, int32_t index) { case TSDB_DATA_TYPE_INT: { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].nType = pCtx->inputType; - pCtx->param[1].i64Key = *(int32_t *)pData; + pCtx->param[1].i64 = *(int32_t *)pData; } else { - *(int32_t *)pCtx->aOutputBuf = *(int32_t *)pData - (int32_t)pCtx->param[1].i64Key; - pCtx->param[1].i64Key = *(int32_t *)pData; + *(int32_t *)pCtx->aOutputBuf = *(int32_t *)pData - (int32_t)pCtx->param[1].i64; + pCtx->param[1].i64 = *(int32_t *)pData; *(int64_t *)pCtx->ptsOutputBuf = GET_TS_DATA(pCtx, index); } break; @@ -3201,7 +3282,7 @@ static void diff_function_f(SQLFunctionCtx *pCtx, int32_t index) { break; }; default: - tscError("error input type"); + qError("error input type"); } if (GET_RES_INFO(pCtx)->numOfRes > 0) { @@ -3297,17 +3378,17 @@ static void spread_function(SQLFunctionCtx *pCtx) { if (numOfElems == 0) { goto _spread_over; } - - if ((pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) || + + if (IS_SIGNED_NUMERIC_TYPE(pCtx->inputType) || IS_UNSIGNED_NUMERIC_TYPE(pCtx->inputType) || (pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)) { if (pInfo->min > pCtx->preAggVals.statis.min) { pInfo->min = (double)pCtx->preAggVals.statis.min; } - + if (pInfo->max < pCtx->preAggVals.statis.max) { pInfo->max = (double)pCtx->preAggVals.statis.max; } - } else if (pCtx->inputType == TSDB_DATA_TYPE_DOUBLE || pCtx->inputType == TSDB_DATA_TYPE_FLOAT) { + } else if (IS_FLOAT_TYPE(pCtx->inputType)) { if (pInfo->min > GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.min))) { pInfo->min = GET_DOUBLE_VAL((const char *)&(pCtx->preAggVals.statis.min)); } @@ -3402,7 +3483,7 @@ static void spread_function_f(SQLFunctionCtx *pCtx, int32_t index) { * here we set the result value back to the intermediate buffer, to apply the finalize the function * the final result is generated in spread_function_finalizer */ -void spread_func_sec_merge(SQLFunctionCtx *pCtx) { +void spread_func_merge(SQLFunctionCtx *pCtx) { SSpreadInfo *pData = (SSpreadInfo *)GET_INPUT_DATA_LIST(pCtx); if (pData->hasResult != DATA_SET_FLAG) { return; @@ -3436,8 +3517,7 @@ void spread_function_finalizer(SQLFunctionCtx *pCtx) { *(double *)pCtx->aOutputBuf = pCtx->param[3].dKey - pCtx->param[0].dKey; } else { - assert((pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_DOUBLE) || - (pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)); + assert(IS_NUMERIC_TYPE(pCtx->inputType) || (pCtx->inputType == TSDB_DATA_TYPE_TIMESTAMP)); SSpreadInfo *pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); if (pInfo->hasResult != DATA_SET_FLAG) { @@ -3802,11 +3882,11 @@ static void ts_comp_function(SQLFunctionCtx *pCtx) { // primary ts must be existed, so no need to check its existance if (pCtx->order == TSDB_ORDER_ASC) { - tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64Key, &pCtx->tag, input, pCtx->size * TSDB_KEYSIZE); + tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64, &pCtx->tag, input, pCtx->size * TSDB_KEYSIZE); } else { for (int32_t i = pCtx->size - 1; i >= 0; --i) { char *d = GET_INPUT_DATA(pCtx, i); - tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64Key, &pCtx->tag, d, (int32_t)TSDB_KEYSIZE); + tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64, &pCtx->tag, d, (int32_t)TSDB_KEYSIZE); } } @@ -3825,7 +3905,7 @@ static void ts_comp_function_f(SQLFunctionCtx *pCtx, int32_t index) { STSBuf *pTSbuf = pInfo->pTSBuf; - tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64Key, &pCtx->tag, pData, TSDB_KEYSIZE); + tsBufAppend(pTSbuf, (int32_t)pCtx->param[0].i64, &pCtx->tag, pData, TSDB_KEYSIZE); SET_VAL(pCtx, pCtx->size, 1); pResInfo->hasResult = DATA_SET_FLAG; @@ -3873,7 +3953,7 @@ static double do_calc_rate(const SRateInfo* pRateInfo) { double resultVal = ((double)diff) / duration; - tscDebug("do_calc_rate() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " resultVal:%f", + qDebug("do_calc_rate() isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " resultVal:%f", pRateInfo->isIRate, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, resultVal); return resultVal; @@ -3907,12 +3987,12 @@ static void rate_function(SQLFunctionCtx *pCtx) { SRateInfo *pRateInfo = (SRateInfo *)GET_ROWCELL_INTERBUF(pResInfo); TSKEY *primaryKey = GET_TS_LIST(pCtx); - tscDebug("%p rate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull); + qDebug("%p rate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull); for (int32_t i = 0; i < pCtx->size; ++i) { char *pData = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(pData, pCtx->inputType)) { - tscDebug("%p rate_function() index of null data:%d", pCtx, i); + qDebug("%p rate_function() index of null data:%d", pCtx, i); continue; } @@ -3925,19 +4005,19 @@ static void rate_function(SQLFunctionCtx *pCtx) { pRateInfo->firstValue = v; pRateInfo->firstKey = primaryKey[i]; - tscDebug("firstValue:%" PRId64 " firstKey:%" PRId64, pRateInfo->firstValue, pRateInfo->firstKey); + qDebug("firstValue:%" PRId64 " firstKey:%" PRId64, pRateInfo->firstValue, pRateInfo->firstKey); } if (INT64_MIN == pRateInfo->lastValue) { pRateInfo->lastValue = v; } else if (v < pRateInfo->lastValue) { pRateInfo->CorrectionValue += pRateInfo->lastValue; - tscDebug("CorrectionValue:%" PRId64, pRateInfo->CorrectionValue); + qDebug("CorrectionValue:%" PRId64, pRateInfo->CorrectionValue); } pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[i]; - tscDebug("lastValue:%" PRId64 " lastKey:%" PRId64, pRateInfo->lastValue, pRateInfo->lastKey); + qDebug("lastValue:%" PRId64 " lastKey:%" PRId64, pRateInfo->lastValue, pRateInfo->lastKey); } if (!pCtx->hasNull) { @@ -3985,7 +4065,7 @@ static void rate_function_f(SQLFunctionCtx *pCtx, int32_t index) { pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[index]; - tscDebug("====%p rate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " CorrectionValue:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->CorrectionValue); + qDebug("====%p rate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " CorrectionValue:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->CorrectionValue); SET_VAL(pCtx, 1, 1); @@ -4007,7 +4087,7 @@ static void rate_func_copy(SQLFunctionCtx *pCtx) { pResInfo->hasResult = ((SRateInfo*)pCtx->aInputElemBuf)->hasResult; SRateInfo* pRateInfo = (SRateInfo*)pCtx->aInputElemBuf; - tscDebug("%p rate_func_merge() firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d", + qDebug("%p rate_func_merge() firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d", pCtx, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, pRateInfo->hasResult); } @@ -4015,7 +4095,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SRateInfo *pRateInfo = (SRateInfo *)GET_ROWCELL_INTERBUF(pResInfo); - tscDebug("%p isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d", + qDebug("%p isIRate:%d firstKey:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " lastValue:%" PRId64 " CorrectionValue:%" PRId64 " hasResult:%d", pCtx, pRateInfo->isIRate, pRateInfo->firstKey, pRateInfo->lastKey, pRateInfo->firstValue, pRateInfo->lastValue, pRateInfo->CorrectionValue, pRateInfo->hasResult); if (pRateInfo->hasResult != DATA_SET_FLAG) { @@ -4025,7 +4105,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) { *(double*)pCtx->aOutputBuf = do_calc_rate(pRateInfo); - tscDebug("rate_finalizer() output result:%f", *(double *)pCtx->aOutputBuf); + qDebug("rate_finalizer() output result:%f", *(double *)pCtx->aOutputBuf); // cannot set the numOfIteratedElems again since it is set during previous iteration pResInfo->numOfRes = 1; @@ -4041,7 +4121,7 @@ static void irate_function(SQLFunctionCtx *pCtx) { SRateInfo *pRateInfo = (SRateInfo *)GET_ROWCELL_INTERBUF(pResInfo); TSKEY *primaryKey = GET_TS_LIST(pCtx); - tscDebug("%p irate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull); + qDebug("%p irate_function() size:%d, hasNull:%d", pCtx, pCtx->size, pCtx->hasNull); if (pCtx->size < 1) { return; @@ -4050,7 +4130,7 @@ static void irate_function(SQLFunctionCtx *pCtx) { for (int32_t i = pCtx->size - 1; i >= 0; --i) { char *pData = GET_INPUT_DATA(pCtx, i); if (pCtx->hasNull && isNull(pData, pCtx->inputType)) { - tscDebug("%p irate_function() index of null data:%d", pCtx, i); + qDebug("%p irate_function() index of null data:%d", pCtx, i); continue; } @@ -4064,7 +4144,7 @@ static void irate_function(SQLFunctionCtx *pCtx) { pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[i]; - tscDebug("%p irate_function() lastValue:%" PRId64 " lastKey:%" PRId64, pCtx, pRateInfo->lastValue, pRateInfo->lastKey); + qDebug("%p irate_function() lastValue:%" PRId64 " lastKey:%" PRId64, pCtx, pRateInfo->lastValue, pRateInfo->lastKey); continue; } @@ -4072,7 +4152,7 @@ static void irate_function(SQLFunctionCtx *pCtx) { pRateInfo->firstValue = v; pRateInfo->firstKey = primaryKey[i]; - tscDebug("%p irate_function() firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, pRateInfo->firstValue, pRateInfo->firstKey); + qDebug("%p irate_function() firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, pRateInfo->firstValue, pRateInfo->firstKey); break; } } @@ -4110,7 +4190,7 @@ static void irate_function_f(SQLFunctionCtx *pCtx, int32_t index) { pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[index]; - tscDebug("====%p irate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->firstValue , pRateInfo->firstKey); + qDebug("====%p irate_function_f() index:%d lastValue:%" PRId64 " lastKey:%" PRId64 " firstValue:%" PRId64 " firstKey:%" PRId64, pCtx, index, pRateInfo->lastValue, pRateInfo->lastKey, pRateInfo->firstValue , pRateInfo->firstKey); SET_VAL(pCtx, 1, 1); @@ -4134,7 +4214,7 @@ static void do_sumrate_merge(SQLFunctionCtx *pCtx) { for (int32_t i = 0; i < pCtx->size; ++i, input += pCtx->inputBytes) { SRateInfo *pInput = (SRateInfo *)input; - tscDebug("%p do_sumrate_merge() hasResult:%d input num:%" PRId64 " input sum:%f total num:%" PRId64 " total sum:%f", pCtx, pInput->hasResult, pInput->num, pInput->sum, pRateInfo->num, pRateInfo->sum); + qDebug("%p do_sumrate_merge() hasResult:%d input num:%" PRId64 " input sum:%f total num:%" PRId64 " total sum:%f", pCtx, pInput->hasResult, pInput->num, pInput->sum, pRateInfo->num, pRateInfo->sum); if (pInput->hasResult != DATA_SET_FLAG) { continue; @@ -4157,7 +4237,7 @@ static void do_sumrate_merge(SQLFunctionCtx *pCtx) { } static void sumrate_func_merge(SQLFunctionCtx *pCtx) { - tscDebug("%p sumrate_func_merge() process ...", pCtx); + qDebug("%p sumrate_func_merge() process ...", pCtx); do_sumrate_merge(pCtx); } @@ -4165,7 +4245,7 @@ static void sumrate_finalizer(SQLFunctionCtx *pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SRateInfo *pRateInfo = (SRateInfo *)GET_ROWCELL_INTERBUF(pResInfo); - tscDebug("%p sumrate_finalizer() superTableQ:%d num:%" PRId64 " sum:%f hasResult:%d", pCtx, pCtx->stableQuery, pRateInfo->num, pRateInfo->sum, pRateInfo->hasResult); + qDebug("%p sumrate_finalizer() superTableQ:%d num:%" PRId64 " sum:%f hasResult:%d", pCtx, pCtx->stableQuery, pRateInfo->num, pRateInfo->sum, pRateInfo->hasResult); if (pRateInfo->hasResult != DATA_SET_FLAG) { setNull(pCtx->aOutputBuf, TSDB_DATA_TYPE_DOUBLE, sizeof(double)); @@ -4408,7 +4488,7 @@ SQLAggFuncElem aAggs[] = {{ spread_function_f, no_next_step, spread_function_finalizer, - spread_func_sec_merge, + spread_func_merge, count_load_data_info, }, { diff --git a/src/query/src/qArithmeticOperator.c b/src/query/src/qArithmeticOperator.c index 0955d48df0..27bdd4372b 100644 --- a/src/query/src/qArithmeticOperator.c +++ b/src/query/src/qArithmeticOperator.c @@ -21,29 +21,29 @@ #define ARRAY_LIST_OP(left, right, _left_type, _right_type, len1, len2, out, op, _res_type, _ord) \ { \ - int32_t i = ((_ord) == TSDB_ORDER_ASC) ? 0 : MAX(len1, len2) - 1; \ - int32_t step = ((_ord) == TSDB_ORDER_ASC) ? 1 : -1; \ + int32_t i = ((_ord) == TSDB_ORDER_ASC) ? 0 : MAX(len1, len2) - 1; \ + int32_t step = ((_ord) == TSDB_ORDER_ASC) ? 1 : -1; \ \ if ((len1) == (len2)) { \ - for (; i < (len2) && i >= 0; i += step, (out) += 1) { \ + for (; i < (len2) && i >= 0; i += step, (out) += 1) { \ if (isNull((char *)&((left)[i]), _left_type) || isNull((char *)&((right)[i]), _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[i] op(right)[i]; \ } \ } else if ((len1) == 1) { \ - for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ + for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ if (isNull((char *)(left), _left_type) || isNull((char *)&(right)[i], _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[0] op(right)[i]; \ } \ } else if ((len2) == 1) { \ - for (; i >= 0 && i < (len1); i += step, (out) += 1) { \ + for (; i >= 0 && i < (len1); i += step, (out) += 1) { \ if (isNull((char *)&(left)[i], _left_type) || isNull((char *)(right), _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[i] op(right)[0]; \ @@ -53,29 +53,29 @@ #define ARRAY_LIST_OP_REM(left, right, _left_type, _right_type, len1, len2, out, op, _res_type, _ord) \ { \ - int32_t i = (_ord == TSDB_ORDER_ASC) ? 0 : MAX(len1, len2) - 1; \ - int32_t step = (_ord == TSDB_ORDER_ASC) ? 1 : -1; \ + int32_t i = (_ord == TSDB_ORDER_ASC) ? 0 : MAX(len1, len2) - 1; \ + int32_t step = (_ord == TSDB_ORDER_ASC) ? 1 : -1; \ \ if (len1 == (len2)) { \ - for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ + for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ if (isNull((char *)&(left[i]), _left_type) || isNull((char *)&(right[i]), _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[i] - ((int64_t)(((double)(left)[i]) / (right)[i])) * (right)[i]; \ } \ } else if (len1 == 1) { \ - for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ + for (; i >= 0 && i < (len2); i += step, (out) += 1) { \ if (isNull((char *)(left), _left_type) || isNull((char *)&((right)[i]), _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[0] - ((int64_t)(((double)(left)[0]) / (right)[i])) * (right)[i]; \ } \ } else if ((len2) == 1) { \ - for (; i >= 0 && i < len1; i += step, (out) += 1) { \ + for (; i >= 0 && i < len1; i += step, (out) += 1) { \ if (isNull((char *)&((left)[i]), _left_type) || isNull((char *)(right), _right_type)) { \ - setNull((char *)(out), _res_type, tDataTypeDesc[_res_type].nSize); \ + SET_DOUBLE_NULL(out); \ continue; \ } \ *(out) = (double)(left)[i] - ((int64_t)(((double)(left)[i]) / (right)[0])) * (right)[0]; \ @@ -99,10 +99,42 @@ _type_right *pRight = (_type_right *)(right); \ _type_res * pOutput = (_type_res *)(out); -#define TYPE_CONVERT(left, right, out, _type_left, _type_right) \ - TYPE_CONVERT_DOUBLE_RES(left, right, out, _type_left, _type_right, double) +#define DO_VECTOR_ADD(left, numLeft, leftType, leftOriginType, right, numRight, rightType, rightOriginType, _output, \ + _order) \ + do { \ + TYPE_CONVERT_DOUBLE_RES(left, right, _output, leftOriginType, rightOriginType, double); \ + ARRAY_LIST_ADD(pLeft, pRight, leftType, rightType, numLeft, numRight, pOutput, _order); \ + } while (0) -void calc_fn_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +#define DO_VECTOR_SUB(left, numLeft, leftType, leftOriginType, right, numRight, rightType, rightOriginType, _output, \ + _order) \ + do { \ + TYPE_CONVERT_DOUBLE_RES(left, right, _output, leftOriginType, rightOriginType, double); \ + ARRAY_LIST_SUB(pLeft, pRight, leftType, rightType, numLeft, numRight, pOutput, _order); \ + } while (0) + +#define DO_VECTOR_MULTIPLY(left, numLeft, leftType, leftOriginType, right, numRight, rightType, rightOriginType, \ + _output, _order) \ + do { \ + TYPE_CONVERT_DOUBLE_RES(left, right, _output, leftOriginType, rightOriginType, double); \ + ARRAY_LIST_MULTI(pLeft, pRight, leftType, rightType, numLeft, numRight, pOutput, _order); \ + } while (0) + +#define DO_VECTOR_DIVIDE(left, numLeft, leftType, leftOriginType, right, numRight, rightType, rightOriginType, \ + _output, _order) \ + do { \ + TYPE_CONVERT_DOUBLE_RES(left, right, _output, leftOriginType, rightOriginType, double); \ + ARRAY_LIST_DIV(pLeft, pRight, leftType, rightType, numLeft, numRight, pOutput, _order); \ + } while (0) + +#define DO_VECTOR_REMAINDER(left, numLeft, leftType, leftOriginType, right, numRight, rightType, rightOriginType, \ + _output, _order) \ + do { \ + TYPE_CONVERT_DOUBLE_RES(left, right, _output, leftOriginType, rightOriginType, double); \ + ARRAY_LIST_REM(pLeft, pRight, leftType, rightType, numLeft, numRight, pOutput, _order); \ + } while (0) + +void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; int32_t *pRight = (int32_t *)right; double * pOutput = (double *)output; @@ -139,168 +171,2568 @@ void calc_fn_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRi } } -void calc_fn_i32_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void vectorAdd(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, int32_t rightType, + void *output, int32_t order) { + switch(leftType) { + case TSDB_DATA_TYPE_TINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, int8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, uint8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, int16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, uint16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_INT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, int32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, uint32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_BIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, int64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, uint64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_FLOAT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, float, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_ADD(left, numLeft, leftType, double, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + default:; + } +} + +void vectorSub(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, int32_t rightType, + void *output, int32_t order) { + switch(leftType) { + case TSDB_DATA_TYPE_TINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, int8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, uint8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, int16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, uint16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_INT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, int32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, uint32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_BIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, int64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, uint64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_FLOAT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, float, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_SUB(left, numLeft, leftType, double, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + default:; + } +} + +void vectorMultiply(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, int32_t rightType, + void *output, int32_t order) { + switch(leftType) { + case TSDB_DATA_TYPE_TINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_INT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_BIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, int64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, uint64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_FLOAT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, float, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_MULTIPLY(left, numLeft, leftType, double, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + default:; + } +} + +void vectorDivide(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, int32_t rightType, + void *output, int32_t order) { + switch(leftType) { + case TSDB_DATA_TYPE_TINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_INT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_BIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, int64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, uint64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_FLOAT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, float, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_DIVIDE(left, numLeft, leftType, double, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + default:; + } +} + +void vectorRemainder(void *left, int32_t numLeft, int32_t leftType, void *right, int32_t numRight, int32_t rightType, + void *output, int32_t order) { + switch(leftType) { + case TSDB_DATA_TYPE_TINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint8_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint16_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_INT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint32_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_BIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, int64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, uint64_t, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_FLOAT: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, float, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + switch (rightType) { + case TSDB_DATA_TYPE_TINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, int8_t, output, order); + break; + } + case TSDB_DATA_TYPE_UTINYINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, uint8_t, output, order); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, int16_t, output, order); + break; + } + case TSDB_DATA_TYPE_USMALLINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, uint16_t, output, order); + break; + } + case TSDB_DATA_TYPE_INT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, int32_t, output, order); + break; + } + case TSDB_DATA_TYPE_UINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, uint32_t, output, order); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, int64_t, output, order); + break; + } + case TSDB_DATA_TYPE_UBIGINT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, uint64_t, output, order); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, float, output, order); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + DO_VECTOR_REMAINDER(left, numLeft, leftType, double, right, numRight, rightType, double, output, order); + break; + } + default: + assert(0); + } + break; + } + default:; + } +} + +/* +void calc_i32_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int8_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int16_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int64_t); ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, float) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int8_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_u8_u8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + TYPE_CONVERT(left, right, output, uint8_t, uint8_t) + ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_UTINYINT, numLeft, numRight, pOutput, order); +} + +void calc_i8_u8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + TYPE_CONVERT(left, right, output, int8_t, uint8_t) + ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_UTINYINT, numLeft, numRight, pOutput, order); +} + +void calc_u8_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_u8_add(right, left, numRight, numLeft, output, order); +} + +void calc_i8_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int16_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i8_add(right, left, numRight, numLeft, output, order); +void calc_i8_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i8_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i8_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int64_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, float) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_i16_add(right, left, numRight, numLeft, output, order); +void calc_i16_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_i16_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i16_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int16_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i16_add(right, left, numRight, numLeft, output, order); +void calc_i16_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i16_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i16_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int64_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, float) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_i64_add(right, left, numRight, numLeft, output, order); +void calc_i64_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_i64_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_i64_add(right, left, numRight, numLeft, output, order); +void calc_i64_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_i64_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i64_add(right, left, numRight, numLeft, output, order); +void calc_i64_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i64_add(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int64_t) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, float) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_f_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_f_add(right, left, numRight, numLeft, output, order); +void calc_f_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_f_add(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_f_add(right, left, numRight, numLeft, output, order); +void calc_f_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_f_add(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_f_add(right, left, numRight, numLeft, output, order); +void calc_f_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_f_add(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i64_f_add(right, left, numRight, numLeft, output, order); +void calc_f_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i64_f_add(right, left, numRight, numLeft, output, order); } -void calc_fn_f_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, float) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_f_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_d_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_d_add(right, left, numRight, numLeft, output, order); +void calc_d_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_d_add(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_d_add(right, left, numRight, numLeft, output, order); +void calc_d_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_d_add(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_d_add(right, left, numRight, numLeft, output, order); +void calc_d_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_d_add(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i64_d_add(right, left, numRight, numLeft, output, order); +void calc_d_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i64_d_add(right, left, numRight, numLeft, output, order); } -void calc_fn_d_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_f_d_add(right, left, numRight, numLeft, output, order); +void calc_d_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_f_d_add(right, left, numRight, numLeft, output, order); } -void calc_fn_d_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, double) ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } ///////////////////////////////////////////////////////////////////////////////////////////////////////// -void calc_fn_i32_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; int32_t *pRight = (int32_t *)right; double * pOutput = (double *)output; @@ -335,183 +2767,183 @@ void calc_fn_i32_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRi } } -void calc_fn_i32_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int32_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int32_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int32_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_f_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int32_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_f_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_d_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int8_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int16_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int32_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int64_t) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, float) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_d_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, double) ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } ///////////////////////////////////////////////////////////////////////////////////////////////////////// -void calc_fn_i32_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; int32_t *pRight = (int32_t *)right; double * pOutput = (double *)output; @@ -548,168 +2980,168 @@ void calc_fn_i32_i32_multi(void *left, void *right, int32_t numLeft, int32_t num } } -void calc_fn_i32_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int8_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int16_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int64_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, float) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int8_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int16_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i8_multi(right, left, numRight, numLeft, output, order); +void calc_i8_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i8_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i8_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int64_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, float) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_i16_multi(right, left, numRight, numLeft, output, order); +void calc_i16_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_i16_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i16_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int16_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i16_multi(right, left, numRight, numLeft, output, order); +void calc_i16_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i16_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i16_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int64_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, float) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_i64_multi(right, left, numRight, numLeft, output, order); +void calc_i64_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_i64_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_i64_multi(right, left, numRight, numLeft, output, order); +void calc_i64_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_i64_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_i64_multi(right, left, numRight, numLeft, output, order); +void calc_i64_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_i64_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_i64_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int64_t) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, float) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_f_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_f_multi(right, left, numRight, numLeft, output, order); +void calc_f_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_f_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_f_multi(right, left, numRight, numLeft, output, order); +void calc_f_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_f_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_f_multi(right, left, numRight, numLeft, output, order); +void calc_f_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_f_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_f_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i64_f_multi(right, left, numRight, numLeft, output, order); +void calc_f_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i64_f_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_f_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, float) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_f_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_d_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i8_d_multi(right, left, numRight, numLeft, output, order); +void calc_d_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i8_d_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i16_d_multi(right, left, numRight, numLeft, output, order); +void calc_d_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i16_d_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i32_d_multi(right, left, numRight, numLeft, output, order); +void calc_d_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i32_d_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_d_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_i64_d_multi(right, left, numRight, numLeft, output, order); +void calc_d_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_i64_d_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_d_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { - calc_fn_f_d_multi(right, left, numRight, numLeft, output, order); +void calc_d_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { + calc_f_d_multi(right, left, numRight, numLeft, output, order); } -void calc_fn_d_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, double) ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } //////////////////////////////////////////////////////////////////////////////////////////////////////////// -void calc_fn_i32_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; int32_t *pRight = (int32_t *)right; double * pOutput = (double *)output; @@ -746,184 +3178,184 @@ void calc_fn_i32_i32_div(void *left, void *right, int32_t numLeft, int32_t numRi } } -void calc_fn_i32_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int32_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int32_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int32_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_f_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int32_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_f_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_d_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int8_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int16_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int32_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int64_t) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, float) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_d_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, double) ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } //////////////////////////////////////////////////////////////////////////////////////////////////////////// -void calc_fn_i32_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; int32_t *pRight = (int32_t *)right; double * pOutput = (double *)output; @@ -961,27 +3393,27 @@ void calc_fn_i32_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRi } } -void calc_fn_i32_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int32_t, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i32_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i32_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { int32_t *pLeft = (int32_t *)left; double * pRight = (double *)right; double * pOutput = (double *)output; @@ -1019,238 +3451,241 @@ void calc_fn_i32_d_rem(void *left, void *right, int32_t numLeft, int32_t numRigh } } -void calc_fn_i8_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int32_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i8_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i8_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int8_t, double) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int32_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i16_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i16_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int16_t, double) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int32_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_i64_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_i64_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, int64_t, double) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_f_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int32_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_f_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_f_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_f_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_f_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, float, double) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -void calc_fn_d_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int8_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int16_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int32_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order); } -void calc_fn_d_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, int64_t) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order); } -void calc_fn_d_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, float) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order); } -void calc_fn_d_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { +void calc_d_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) { TYPE_CONVERT(left, right, output, double, double) ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order); } -/* +* * the following are two-dimensional array list of callback function . */ -_bi_consumer_fn_t add_function_arraylist[8][10] = { - /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, - {NULL, NULL, calc_fn_i8_i8_add, calc_fn_i8_i16_add, calc_fn_i8_i32_add, calc_fn_i8_i64_add, calc_fn_i8_f_add, calc_fn_i8_d_add, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT - {NULL, NULL, calc_fn_i16_i8_add, calc_fn_i16_i16_add, calc_fn_i16_i32_add, calc_fn_i16_i64_add, calc_fn_i16_f_add, calc_fn_i16_d_add, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT - {NULL, NULL, calc_fn_i32_i8_add, calc_fn_i32_i16_add, calc_fn_i32_i32_add, calc_fn_i32_i64_add, calc_fn_i32_f_add, calc_fn_i32_d_add, NULL, NULL}, // TSDB_DATA_TYPE_INT - {NULL, NULL, calc_fn_i64_i8_add, calc_fn_i64_i16_add, calc_fn_i64_i32_add, calc_fn_i64_i64_add, calc_fn_i64_f_add, calc_fn_i64_d_add, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT - {NULL, NULL, calc_fn_f_i8_add, calc_fn_f_i16_add, calc_fn_f_i32_add, calc_fn_f_i64_add, calc_fn_f_f_add, calc_fn_f_d_add, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT - {NULL, NULL, calc_fn_d_i8_add, calc_fn_d_i16_add, calc_fn_d_i32_add, calc_fn_d_i64_add, calc_fn_d_f_add, calc_fn_d_d_add, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE -}; - -_bi_consumer_fn_t sub_function_arraylist[8][10] = { - /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, - {NULL, NULL, calc_fn_i8_i8_sub, calc_fn_i8_i16_sub, calc_fn_i8_i32_sub, calc_fn_i8_i64_sub, calc_fn_i8_f_sub, calc_fn_i8_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT - {NULL, NULL, calc_fn_i16_i8_sub, calc_fn_i16_i16_sub, calc_fn_i16_i32_sub, calc_fn_i16_i64_sub, calc_fn_i16_f_sub, calc_fn_i16_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT - {NULL, NULL, calc_fn_i32_i8_sub, calc_fn_i32_i16_sub, calc_fn_i32_i32_sub, calc_fn_i32_i64_sub, calc_fn_i32_f_sub, calc_fn_i32_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_INT - {NULL, NULL, calc_fn_i64_i8_sub, calc_fn_i64_i16_sub, calc_fn_i64_i32_sub, calc_fn_i64_i64_sub, calc_fn_i64_f_sub, calc_fn_i64_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT - {NULL, NULL, calc_fn_f_i8_sub, calc_fn_f_i16_sub, calc_fn_f_i32_sub, calc_fn_f_i64_sub, calc_fn_f_f_sub, calc_fn_f_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT - {NULL, NULL, calc_fn_d_i8_sub, calc_fn_d_i16_sub, calc_fn_d_i32_sub, calc_fn_d_i64_sub, calc_fn_d_f_sub, calc_fn_d_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE -}; - -_bi_consumer_fn_t multi_function_arraylist[][10] = { - /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, - {NULL, NULL, calc_fn_i8_i8_multi, calc_fn_i8_i16_multi, calc_fn_i8_i32_multi, calc_fn_i8_i64_multi, calc_fn_i8_f_multi, calc_fn_i8_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT - {NULL, NULL, calc_fn_i16_i8_multi, calc_fn_i16_i16_multi, calc_fn_i16_i32_multi, calc_fn_i16_i64_multi, calc_fn_i16_f_multi, calc_fn_i16_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT - {NULL, NULL, calc_fn_i32_i8_multi, calc_fn_i32_i16_multi, calc_fn_i32_i32_multi, calc_fn_i32_i64_multi, calc_fn_i32_f_multi, calc_fn_i32_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_INT - {NULL, NULL, calc_fn_i64_i8_multi, calc_fn_i64_i16_multi, calc_fn_i64_i32_multi, calc_fn_i64_i64_multi, calc_fn_i64_f_multi, calc_fn_i64_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT - {NULL, NULL, calc_fn_f_i8_multi, calc_fn_f_i16_multi, calc_fn_f_i32_multi, calc_fn_f_i64_multi, calc_fn_f_f_multi, calc_fn_f_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT - {NULL, NULL, calc_fn_d_i8_multi, calc_fn_d_i16_multi, calc_fn_d_i32_multi, calc_fn_d_i64_multi, calc_fn_d_f_multi, calc_fn_d_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE -}; - -_bi_consumer_fn_t div_function_arraylist[8][10] = { - /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, - {NULL, NULL, calc_fn_i8_i8_div, calc_fn_i8_i16_div, calc_fn_i8_i32_div, calc_fn_i8_i64_div, calc_fn_i8_f_div, calc_fn_i8_d_div, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT - {NULL, NULL, calc_fn_i16_i8_div, calc_fn_i16_i16_div, calc_fn_i16_i32_div, calc_fn_i16_i64_div, calc_fn_i16_f_div, calc_fn_i16_d_div, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT - {NULL, NULL, calc_fn_i32_i8_div, calc_fn_i32_i16_div, calc_fn_i32_i32_div, calc_fn_i32_i64_div, calc_fn_i32_f_div, calc_fn_i32_d_div, NULL, NULL}, // TSDB_DATA_TYPE_INT - {NULL, NULL, calc_fn_i64_i8_div, calc_fn_i64_i16_div, calc_fn_i64_i32_div, calc_fn_i64_i64_div, calc_fn_i64_f_div, calc_fn_i64_d_div, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT - {NULL, NULL, calc_fn_f_i8_div, calc_fn_f_i16_div, calc_fn_f_i32_div, calc_fn_f_i64_div, calc_fn_f_f_div, calc_fn_f_d_div, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT - {NULL, NULL, calc_fn_d_i8_div, calc_fn_d_i16_div, calc_fn_d_i32_div, calc_fn_d_i64_div, calc_fn_d_f_div, calc_fn_d_d_div, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE -}; - -_bi_consumer_fn_t rem_function_arraylist[8][10] = { - /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, - {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, - {NULL, NULL, calc_fn_i8_i8_rem, calc_fn_i8_i16_rem, calc_fn_i8_i32_rem, calc_fn_i8_i64_rem, calc_fn_i8_f_rem, calc_fn_i8_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT - {NULL, NULL, calc_fn_i16_i8_rem, calc_fn_i16_i16_rem, calc_fn_i16_i32_rem, calc_fn_i16_i64_rem, calc_fn_i16_f_rem, calc_fn_i16_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT - {NULL, NULL, calc_fn_i32_i8_rem, calc_fn_i32_i16_rem, calc_fn_i32_i32_rem, calc_fn_i32_i64_rem, calc_fn_i32_f_rem, calc_fn_i32_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_INT - {NULL, NULL, calc_fn_i64_i8_rem, calc_fn_i64_i16_rem, calc_fn_i64_i32_rem, calc_fn_i64_i64_rem, calc_fn_i64_f_rem, calc_fn_i64_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT - {NULL, NULL, calc_fn_f_i8_rem, calc_fn_f_i16_rem, calc_fn_f_i32_rem, calc_fn_f_i64_rem, calc_fn_f_f_rem, calc_fn_f_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT - {NULL, NULL, calc_fn_d_i8_rem, calc_fn_d_i16_rem, calc_fn_d_i32_rem, calc_fn_d_i64_rem, calc_fn_d_f_rem, calc_fn_d_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE -}; +//_arithmetic_operator_fn_t add_function_arraylist[15][15] = { +// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ +// {0}, // EMPTY, +// {0}, // TSDB_DATA_TYPE_BOOL, +// {NULL, NULL, calc_i8_i8_add, calc_i8_i16_add, calc_i8_i32_add, calc_i8_i64_add, calc_i8_f_add, calc_i8_d_add, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT +// {NULL, NULL, calc_i16_i8_add, calc_i16_i16_add, calc_i16_i32_add, calc_i16_i64_add, calc_i16_f_add, calc_i16_d_add, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT +// {NULL, NULL, calc_i32_i8_add, calc_i32_i16_add, calc_i32_i32_add, calc_i32_i64_add, calc_i32_f_add, calc_i32_d_add, NULL, NULL}, // TSDB_DATA_TYPE_INT +// {NULL, NULL, calc_i64_i8_add, calc_i64_i16_add, calc_i64_i32_add, calc_i64_i64_add, calc_i64_f_add, calc_i64_d_add, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT +// {NULL, NULL, calc_f_i8_add, calc_f_i16_add, calc_f_i32_add, calc_f_i64_add, calc_f_f_add, calc_f_d_add, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT +// {NULL, NULL, calc_d_i8_add, calc_d_i16_add, calc_d_i32_add, calc_d_i64_add, calc_d_f_add, calc_d_d_add, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE +// {0}, // TSDB_DATA_TYPE_BINARY, +// {0}, // TSDB_DATA_TYPE_NCHAR, +// {NULL, NULL, calc_u8_i8_add, calc_u8_i16_add, calc_u8_i32_add, calc_u8_i64_add, calc_u8_f_add, calc_u8_d_add, NULL, NULL, calc_u8_u8_add, calc_u8_u16_add, calc_u8_u32_add, calc_u8_u64_add, NULL}, // TSDB_DATA_TYPE_UTINYINT, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_USMALLINT, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_UINT, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_UBIGINT, +// +//}; +// +//_arithmetic_operator_fn_t sub_function_arraylist[8][15] = { +// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ +// {0}, // EMPTY, +// {0}, // TSDB_DATA_TYPE_BOOL, +// {NULL, NULL, calc_i8_i8_sub, calc_i8_i16_sub, calc_i8_i32_sub, calc_i8_i64_sub, calc_i8_f_sub, calc_i8_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT +// {NULL, NULL, calc_i16_i8_sub, calc_i16_i16_sub, calc_i16_i32_sub, calc_i16_i64_sub, calc_i16_f_sub, calc_i16_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT +// {NULL, NULL, calc_i32_i8_sub, calc_i32_i16_sub, calc_i32_i32_sub, calc_i32_i64_sub, calc_i32_f_sub, calc_i32_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_INT +// {NULL, NULL, calc_i64_i8_sub, calc_i64_i16_sub, calc_i64_i32_sub, calc_i64_i64_sub, calc_i64_f_sub, calc_i64_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT +// {NULL, NULL, calc_f_i8_sub, calc_f_i16_sub, calc_f_i32_sub, calc_f_i64_sub, calc_f_f_sub, calc_f_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT +// {NULL, NULL, calc_d_i8_sub, calc_d_i16_sub, calc_d_i32_sub, calc_d_i64_sub, calc_d_f_sub, calc_d_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE +//}; +// +//_arithmetic_operator_fn_t multi_function_arraylist[][15] = { +// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, +// {NULL, NULL, calc_i8_i8_multi, calc_i8_i16_multi, calc_i8_i32_multi, calc_i8_i64_multi, calc_i8_f_multi, calc_i8_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT +// {NULL, NULL, calc_i16_i8_multi, calc_i16_i16_multi, calc_i16_i32_multi, calc_i16_i64_multi, calc_i16_f_multi, calc_i16_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT +// {NULL, NULL, calc_i32_i8_multi, calc_i32_i16_multi, calc_i32_i32_multi, calc_i32_i64_multi, calc_i32_f_multi, calc_i32_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_INT +// {NULL, NULL, calc_i64_i8_multi, calc_i64_i16_multi, calc_i64_i32_multi, calc_i64_i64_multi, calc_i64_f_multi, calc_i64_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT +// {NULL, NULL, calc_f_i8_multi, calc_f_i16_multi, calc_f_i32_multi, calc_f_i64_multi, calc_f_f_multi, calc_f_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT +// {NULL, NULL, calc_d_i8_multi, calc_d_i16_multi, calc_d_i32_multi, calc_d_i64_multi, calc_d_f_multi, calc_d_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE +//}; +// +//_arithmetic_operator_fn_t div_function_arraylist[8][15] = { +// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/ +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, +// {NULL, NULL, calc_i8_i8_div, calc_i8_i16_div, calc_i8_i32_div, calc_i8_i64_div, calc_i8_f_div, calc_i8_d_div, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT +// {NULL, NULL, calc_i16_i8_div, calc_i16_i16_div, calc_i16_i32_div, calc_i16_i64_div, calc_i16_f_div, calc_i16_d_div, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT +// {NULL, NULL, calc_i32_i8_div, calc_i32_i16_div, calc_i32_i32_div, calc_i32_i64_div, calc_i32_f_div, calc_i32_d_div, NULL, NULL}, // TSDB_DATA_TYPE_INT +// {NULL, NULL, calc_i64_i8_div, calc_i64_i16_div, calc_i64_i32_div, calc_i64_i64_div, calc_i64_f_div, calc_i64_d_div, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT +// {NULL, NULL, calc_f_i8_div, calc_f_i16_div, calc_f_i32_div, calc_f_i64_div, calc_f_f_div, calc_f_d_div, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT +// {NULL, NULL, calc_d_i8_div, calc_d_i16_div, calc_d_i32_div, calc_d_i64_div, calc_d_f_div, calc_d_d_div, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE +//}; +// +//_arithmetic_operator_fn_t rem_function_arraylist[8][15] = { +// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary, nchar, unsigned tinyint, unsigned smallint, unsigned int, unsigned bigint*/ +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY, +// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL, +// {NULL, NULL, calc_i8_i8_rem, calc_i8_i16_rem, calc_i8_i32_rem, calc_i8_i64_rem, calc_i8_f_rem, calc_i8_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT +// {NULL, NULL, calc_i16_i8_rem, calc_i16_i16_rem, calc_i16_i32_rem, calc_i16_i64_rem, calc_i16_f_rem, calc_i16_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT +// {NULL, NULL, calc_i32_i8_rem, calc_i32_i16_rem, calc_i32_i32_rem, calc_i32_i64_rem, calc_i32_f_rem, calc_i32_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_INT +// {NULL, NULL, calc_i64_i8_rem, calc_i64_i16_rem, calc_i64_i32_rem, calc_i64_i64_rem, calc_i64_f_rem, calc_i64_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT +// {NULL, NULL, calc_f_i8_rem, calc_f_i16_rem, calc_f_i32_rem, calc_f_i64_rem, calc_f_f_rem, calc_f_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT +// {NULL, NULL, calc_d_i8_rem, calc_d_i16_rem, calc_d_i32_rem, calc_d_i64_rem, calc_d_f_rem, calc_d_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE +//}; //////////////////////////////////////////////////////////////////////////////////////////////////////////// -_bi_consumer_fn_t getArithmeticOperatorFn(int32_t leftType, int32_t rightType, int32_t optr) { - switch (optr) { +_arithmetic_operator_fn_t getArithmeticOperatorFn(int32_t arithmeticOptr) { + switch (arithmeticOptr) { case TSDB_BINARY_OP_ADD: - return add_function_arraylist[leftType][rightType]; + return vectorAdd; case TSDB_BINARY_OP_SUBTRACT: - return sub_function_arraylist[leftType][rightType]; + return vectorSub; case TSDB_BINARY_OP_MULTIPLY: - return multi_function_arraylist[leftType][rightType]; + return vectorMultiply; case TSDB_BINARY_OP_DIVIDE: - return div_function_arraylist[leftType][rightType]; + return vectorDivide; case TSDB_BINARY_OP_REMAINDER: - return rem_function_arraylist[leftType][rightType]; + return vectorRemainder; default: - assert(0); return NULL; } - - assert(0); - return NULL; } diff --git a/src/query/src/qAst.c b/src/query/src/qAst.c index c23a794196..1e6dbe8e3d 100644 --- a/src/query/src/qAst.c +++ b/src/query/src/qAst.c @@ -197,76 +197,76 @@ void arithmeticTreeTraverse(tExprNode *pExprs, int32_t numOfRows, char *pOutput, * exprLeft + exprRight * the type of returned value of one expression is always double float precious */ - _bi_consumer_fn_t fp = getArithmeticOperatorFn(TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, pExprs->_node.optr); - fp(pLeftOutput, pRightOutput, numOfRows, numOfRows, pOutput, TSDB_ORDER_ASC); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); + OperatorFn(pLeftOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pRightOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pOutput, TSDB_ORDER_ASC); } else if (pRight->nodeType == TSQL_NODE_COL) { // exprLeft + columnRight - _bi_consumer_fn_t fp = getArithmeticOperatorFn(TSDB_DATA_TYPE_DOUBLE, pRight->pSchema->type, pExprs->_node.optr); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); // set input buffer char *pInputData = getSourceDataBlock(param, pRight->pSchema->name, pRight->pSchema->colId); if (order == TSDB_ORDER_DESC) { reverseCopy(pdata, pInputData, pRight->pSchema->type, numOfRows); - fp(pLeftOutput, pdata, numOfRows, numOfRows, pOutput, TSDB_ORDER_ASC); + OperatorFn(pLeftOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pdata, numOfRows, pRight->pSchema->type, pOutput, TSDB_ORDER_ASC); } else { - fp(pLeftOutput, pInputData, numOfRows, numOfRows, pOutput, TSDB_ORDER_ASC); + OperatorFn(pLeftOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pInputData, numOfRows, pRight->pSchema->type, pOutput, TSDB_ORDER_ASC); } } else if (pRight->nodeType == TSQL_NODE_VALUE) { // exprLeft + 12 - _bi_consumer_fn_t fp = getArithmeticOperatorFn(TSDB_DATA_TYPE_DOUBLE, pRight->pVal->nType, pExprs->_node.optr); - fp(pLeftOutput, &pRight->pVal->i64Key, numOfRows, 1, pOutput, TSDB_ORDER_ASC); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); + OperatorFn(pLeftOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, &pRight->pVal->i64, 1, pRight->pVal->nType, pOutput, TSDB_ORDER_ASC); } } else if (pLeft->nodeType == TSQL_NODE_COL) { // column data specified on left-hand-side char *pLeftInputData = getSourceDataBlock(param, pLeft->pSchema->name, pLeft->pSchema->colId); if (pRight->nodeType == TSQL_NODE_EXPR) { // columnLeft + expr2 - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pSchema->type, TSDB_DATA_TYPE_DOUBLE, pExprs->_node.optr); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); if (order == TSDB_ORDER_DESC) { reverseCopy(pdata, pLeftInputData, pLeft->pSchema->type, numOfRows); - fp(pdata, pRightOutput, numOfRows, numOfRows, pOutput, TSDB_ORDER_ASC); + OperatorFn(pdata, numOfRows, pLeft->pSchema->type, pRightOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pOutput, TSDB_ORDER_ASC); } else { - fp(pLeftInputData, pRightOutput, numOfRows, numOfRows, pOutput, TSDB_ORDER_ASC); + OperatorFn(pLeftInputData, numOfRows, pLeft->pSchema->type, pRightOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pOutput, TSDB_ORDER_ASC); } } else if (pRight->nodeType == TSQL_NODE_COL) { // columnLeft + columnRight // column data specified on right-hand-side char *pRightInputData = getSourceDataBlock(param, pRight->pSchema->name, pRight->pSchema->colId); - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pSchema->type, pRight->pSchema->type, pExprs->_node.optr); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); // both columns are descending order, do not reverse the source data - fp(pLeftInputData, pRightInputData, numOfRows, numOfRows, pOutput, order); + OperatorFn(pLeftInputData, numOfRows, pLeft->pSchema->type, pRightInputData, numOfRows, pRight->pSchema->type, pOutput, order); } else if (pRight->nodeType == TSQL_NODE_VALUE) { // columnLeft + 12 - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pSchema->type, pRight->pVal->nType, pExprs->_node.optr); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); if (order == TSDB_ORDER_DESC) { reverseCopy(pdata, pLeftInputData, pLeft->pSchema->type, numOfRows); - fp(pdata, &pRight->pVal->i64Key, numOfRows, 1, pOutput, TSDB_ORDER_ASC); + OperatorFn(pdata, numOfRows, pLeft->pSchema->type, &pRight->pVal->i64, 1, pRight->pVal->nType, pOutput, TSDB_ORDER_ASC); } else { - fp(pLeftInputData, &pRight->pVal->i64Key, numOfRows, 1, pOutput, TSDB_ORDER_ASC); + OperatorFn(pLeftInputData, numOfRows, pLeft->pSchema->type, &pRight->pVal->i64, 1, pRight->pVal->nType, pOutput, TSDB_ORDER_ASC); } } } else { // column data specified on left-hand-side if (pRight->nodeType == TSQL_NODE_EXPR) { // 12 + expr2 - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pVal->nType, TSDB_DATA_TYPE_DOUBLE, pExprs->_node.optr); - fp(&pLeft->pVal->i64Key, pRightOutput, 1, numOfRows, pOutput, TSDB_ORDER_ASC); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); + OperatorFn(&pLeft->pVal->i64, 1, pLeft->pVal->nType, pRightOutput, numOfRows, TSDB_DATA_TYPE_DOUBLE, pOutput, TSDB_ORDER_ASC); } else if (pRight->nodeType == TSQL_NODE_COL) { // 12 + columnRight // column data specified on right-hand-side char *pRightInputData = getSourceDataBlock(param, pRight->pSchema->name, pRight->pSchema->colId); - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pVal->nType, pRight->pSchema->type, pExprs->_node.optr); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); if (order == TSDB_ORDER_DESC) { reverseCopy(pdata, pRightInputData, pRight->pSchema->type, numOfRows); - fp(&pLeft->pVal->i64Key, pdata, numOfRows, 1, pOutput, TSDB_ORDER_ASC); + OperatorFn(&pLeft->pVal->i64, 1, pLeft->pVal->nType, pdata, numOfRows, pRight->pSchema->type, pOutput, TSDB_ORDER_ASC); } else { - fp(&pLeft->pVal->i64Key, pRightInputData, 1, numOfRows, pOutput, TSDB_ORDER_ASC); + OperatorFn(&pLeft->pVal->i64, 1, pLeft->pVal->nType, pRightInputData, numOfRows, pRight->pSchema->type, pOutput, TSDB_ORDER_ASC); } } else if (pRight->nodeType == TSQL_NODE_VALUE) { // 12 + 12 - _bi_consumer_fn_t fp = getArithmeticOperatorFn(pLeft->pVal->nType, pRight->pVal->nType, pExprs->_node.optr); - fp(&pLeft->pVal->i64Key, &pRight->pVal->i64Key, 1, 1, pOutput, TSDB_ORDER_ASC); + _arithmetic_operator_fn_t OperatorFn = getArithmeticOperatorFn(pExprs->_node.optr); + OperatorFn(&pLeft->pVal->i64, 1, pLeft->pVal->nType, &pRight->pVal->i64, 1, pRight->pVal->nType, pOutput, TSDB_ORDER_ASC); } } @@ -285,7 +285,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) { tbufWriteInt32(bw, pVal->nLen); tbufWrite(bw, pVal->pz, pVal->nLen); } else { - tbufWriteInt64(bw, pVal->i64Key); + tbufWriteInt64(bw, pVal->i64); } } else if (expr->nodeType == TSQL_NODE_COL) { @@ -355,7 +355,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) { pVal->pz = calloc(1, pVal->nLen + 1); tbufReadToBuffer(br, pVal->pz, pVal->nLen); } else { - pVal->i64Key = tbufReadInt64(br); + pVal->i64 = tbufReadInt64(br); } } else if (pExpr->nodeType == TSQL_NODE_COL) { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 7b544040bf..04885efbfa 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1372,7 +1372,7 @@ static int32_t doTSJoinFilter(SQueryRuntimeEnv *pRuntimeEnv, int32_t offset) { #if defined(_DEBUG_VIEW) printf("elem in comp ts file:%" PRId64 ", key:%" PRId64 ", tag:%"PRIu64", query order:%d, ts order:%d, traverse:%d, index:%d\n", - elem.ts, key, elem.tag.i64Key, pQuery->order.order, pRuntimeEnv->pTsBuf->tsOrder, + elem.ts, key, elem.tag.i64, pQuery->order.order, pRuntimeEnv->pTsBuf->tsOrder, pRuntimeEnv->pTsBuf->cur.order, pRuntimeEnv->pTsBuf->cur.tsIndex); #endif @@ -1412,7 +1412,7 @@ static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx // denote the order type if ((functionId == TSDB_FUNC_LAST_DST || functionId == TSDB_FUNC_LAST)) { - return pCtx->param[0].i64Key == pQuery->order.order; + return pCtx->param[0].i64 == pQuery->order.order; } // in the supplementary scan, only the following functions need to be executed @@ -1781,9 +1781,9 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY * top/bottom values emerge, so does diff function */ if (functionId == TSDB_FUNC_TWA) { - pCtx->param[1].i64Key = pQuery->window.skey; + pCtx->param[1].i64 = pQuery->window.skey; pCtx->param[1].nType = TSDB_DATA_TYPE_BIGINT; - pCtx->param[2].i64Key = pQuery->window.ekey; + pCtx->param[2].i64 = pQuery->window.ekey; pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT; } @@ -1813,7 +1813,7 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY } } } else if (functionId == TSDB_FUNC_TS_COMP) { - pCtx->param[0].i64Key = vgId; + pCtx->param[0].i64 = vgId; pCtx->param[0].nType = TSDB_DATA_TYPE_BIGINT; } @@ -1952,12 +1952,12 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order int32_t f = pQuery->pExpr1[0].base.functionId; assert(f == TSDB_FUNC_TS || f == TSDB_FUNC_TS_DUMMY); - pCtx->param[2].i64Key = order; + pCtx->param[2].i64 = order; pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT; - pCtx->param[3].i64Key = functionId; + pCtx->param[3].i64 = functionId; pCtx->param[3].nType = TSDB_DATA_TYPE_BIGINT; - pCtx->param[1].i64Key = pQuery->order.orderColId; + pCtx->param[1].i64 = pQuery->order.orderColId; } if (functionId == TSDB_FUNC_ARITHM) { @@ -2966,7 +2966,7 @@ void setTagVal(SQueryRuntimeEnv *pRuntimeEnv, void *pTable, void *tsdb) { pExprInfo->base.arg->argValue.i64, pRuntimeEnv->pCtx[0].tag.pz); } else { qDebug("QInfo:%p set tag value for join comparison, colId:%" PRId64 ", val:%" PRId64, pQInfo, - pExprInfo->base.arg->argValue.i64, pRuntimeEnv->pCtx[0].tag.i64Key); + pExprInfo->base.arg->argValue.i64, pRuntimeEnv->pCtx[0].tag.i64); } } } @@ -3946,7 +3946,7 @@ int32_t setAdditionalInfo(SQInfo *pQInfo, void* pTable, STableQueryInfo *pTableQ if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qError("QInfo:%p failed to find tag:%s in ts_comp", pQInfo, pTag->pz); } else { - qError("QInfo:%p failed to find tag:%" PRId64 " in ts_comp", pQInfo, pTag->i64Key); + qError("QInfo:%p failed to find tag:%" PRId64 " in ts_comp", pQInfo, pTag->i64); } return false; @@ -3957,7 +3957,7 @@ int32_t setAdditionalInfo(SQInfo *pQInfo, void* pTable, STableQueryInfo *pTableQ if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); } else { - qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64Key, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); + qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); } } else { @@ -3966,7 +3966,7 @@ int32_t setAdditionalInfo(SQInfo *pQInfo, void* pTable, STableQueryInfo *pTableQ if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->pz, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); } else { - qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64Key, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); + qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64, pTableQueryInfo->cur.blockIndex, pTableQueryInfo->cur.tsIndex); } } } @@ -4930,7 +4930,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) { if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qError("QInfo:%p failed to find tag:%s in ts_comp", pQInfo, pTag->pz); } else { - qError("QInfo:%p failed to find tag:%"PRId64" in ts_comp", pQInfo, pTag->i64Key); + qError("QInfo:%p failed to find tag:%"PRId64" in ts_comp", pQInfo, pTag->i64); } return false; @@ -4941,7 +4941,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) { qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->pz, cur.blockIndex, cur.tsIndex); } else { - qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64Key, + qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64, cur.blockIndex, cur.tsIndex); } } @@ -4955,7 +4955,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) { if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qError("QInfo:%p failed to find tag:%s in ts_comp", pQInfo, pTag->pz); } else { - qError("QInfo:%p failed to find tag:%"PRId64" in ts_comp", pQInfo, pTag->i64Key); + qError("QInfo:%p failed to find tag:%"PRId64" in ts_comp", pQInfo, pTag->i64); } return false; @@ -4964,7 +4964,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) { if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qDebug("QInfo:%p find tag:%s start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->pz, cur.blockIndex, cur.tsIndex); } else { - qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64Key, cur.blockIndex, cur.tsIndex); + qDebug("QInfo:%p find tag:%"PRId64" start pos in ts_comp, blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64, cur.blockIndex, cur.tsIndex); } } @@ -4974,7 +4974,7 @@ static bool multiTableMultioutputHelper(SQInfo *pQInfo, int32_t index) { if (pTag->nType == TSDB_DATA_TYPE_BINARY || pTag->nType == TSDB_DATA_TYPE_NCHAR) { qDebug("QInfo:%p continue scan ts_comp file, tag:%s blockIndex:%d, tsIndex:%d", pQInfo, pTag->pz, cur.blockIndex, cur.tsIndex); } else { - qDebug("QInfo:%p continue scan ts_comp file, tag:%"PRId64" blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64Key, cur.blockIndex, cur.tsIndex); + qDebug("QInfo:%p continue scan ts_comp file, tag:%"PRId64" blockIndex:%d, tsIndex:%d", pQInfo, pTag->i64, cur.blockIndex, cur.tsIndex); } } } @@ -6025,7 +6025,11 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, pColInfo->bytes = htons(pColInfo->bytes); pColInfo->numOfFilters = htons(pColInfo->numOfFilters); - assert(pColInfo->type >= TSDB_DATA_TYPE_BOOL && pColInfo->type <= TSDB_DATA_TYPE_NCHAR); + if (!isValidDataType(pColInfo->type)) { + qDebug("qmsg:%p, invalid data type in source column, index:%d, type:%d", pQueryMsg, col, pColInfo->type); + code = TSDB_CODE_QRY_INVALID_MSG; + goto _cleanup; + } int32_t numOfFilters = pColInfo->numOfFilters; if (numOfFilters > 0) { diff --git a/src/query/src/qHistogram.c b/src/query/src/qHistogram.c index 98b825c11f..bdc071060c 100644 --- a/src/query/src/qHistogram.c +++ b/src/query/src/qHistogram.c @@ -174,11 +174,11 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) { if ((*pHisto)->numOfElems >= 1 && idx < (*pHisto)->numOfEntries) { if (idx > 0) { assert((*pHisto)->elems[idx - 1].val <= val); + } else { + assert((*pHisto)->elems[idx].val > val); } - - assert((*pHisto)->elems[idx].val > val); } else if ((*pHisto)->numOfElems > 0) { - assert((*pHisto)->elems[(*pHisto)->numOfEntries].val < val); + assert((*pHisto)->elems[(*pHisto)->numOfEntries].val <= val); } histogramCreateBin(*pHisto, idx, val); diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index 4b3a56e4ee..d311cb3557 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -129,11 +129,11 @@ tSQLExpr *tSqlExprIdValueCreate(SStrToken *pToken, int32_t optrType) { pSqlExpr->nSQLOptr = optrType; } else if (optrType == TK_NOW) { // use microsecond by default - pSqlExpr->val.i64Key = taosGetTimestamp(TSDB_TIME_PRECISION_MICRO); + pSqlExpr->val.i64 = taosGetTimestamp(TSDB_TIME_PRECISION_MICRO); pSqlExpr->val.nType = TSDB_DATA_TYPE_BIGINT; pSqlExpr->nSQLOptr = TK_TIMESTAMP; // TK_TIMESTAMP used to denote the time value is in microsecond } else if (optrType == TK_VARIABLE) { - int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->val.i64Key); + int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->val.i64); if (ret != TSDB_CODE_SUCCESS) { terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR; } @@ -200,25 +200,25 @@ tSQLExpr *tSqlExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) { switch (optrType) { case TK_PLUS: { - pExpr->val.i64Key = pLeft->val.i64Key + pRight->val.i64Key; + pExpr->val.i64 = pLeft->val.i64 + pRight->val.i64; break; } case TK_MINUS: { - pExpr->val.i64Key = pLeft->val.i64Key - pRight->val.i64Key; + pExpr->val.i64 = pLeft->val.i64 - pRight->val.i64; break; } case TK_STAR: { - pExpr->val.i64Key = pLeft->val.i64Key * pRight->val.i64Key; + pExpr->val.i64 = pLeft->val.i64 * pRight->val.i64; break; } case TK_DIVIDE: { pExpr->nSQLOptr = TK_FLOAT; pExpr->val.nType = TSDB_DATA_TYPE_DOUBLE; - pExpr->val.dKey = (double)pLeft->val.i64Key / pRight->val.i64Key; + pExpr->val.dKey = (double)pLeft->val.i64 / pRight->val.i64; break; } case TK_REM: { - pExpr->val.i64Key = pLeft->val.i64Key % pRight->val.i64Key; + pExpr->val.i64 = pLeft->val.i64 % pRight->val.i64; break; } } @@ -231,8 +231,8 @@ tSQLExpr *tSqlExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) { pExpr->val.nType = TSDB_DATA_TYPE_DOUBLE; pExpr->nSQLOptr = TK_FLOAT; - double left = (pLeft->val.nType == TSDB_DATA_TYPE_DOUBLE) ? pLeft->val.dKey : pLeft->val.i64Key; - double right = (pRight->val.nType == TSDB_DATA_TYPE_DOUBLE) ? pRight->val.dKey : pRight->val.i64Key; + double left = (pLeft->val.nType == TSDB_DATA_TYPE_DOUBLE) ? pLeft->val.dKey : pLeft->val.i64; + double right = (pRight->val.nType == TSDB_DATA_TYPE_DOUBLE) ? pRight->val.dKey : pRight->val.i64; switch (optrType) { case TK_PLUS: { @@ -384,7 +384,7 @@ void tSqlSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType) pField->name[pName->n] = 0; pField->type = pType->type; - if(pField->type < TSDB_DATA_TYPE_BOOL || pField->type > TSDB_DATA_TYPE_NCHAR){ + if(!isValidDataType(pField->type)){ pField->bytes = 0; } else { pField->bytes = pType->bytes; @@ -393,50 +393,60 @@ void tSqlSetColumnInfo(TAOS_FIELD *pField, SStrToken *pName, TAOS_FIELD *pType) } void tSqlSetColumnType(TAOS_FIELD *pField, SStrToken *type) { + // set the field type invalid pField->type = -1; + pField->name[0] = 0; - for (int32_t i = 0; i < tListLen(tDataTypeDesc); ++i) { - if ((strncasecmp(type->z, tDataTypeDesc[i].aName, tDataTypeDesc[i].nameLen) == 0) && - (type->n == tDataTypeDesc[i].nameLen)) { - pField->type = i; - pField->bytes = tDataTypeDesc[i].nSize; - - if (i == TSDB_DATA_TYPE_NCHAR) { - /* - * for nchar, the TOKENTYPE is the number of character, so the length is the - * number of bytes in UCS-4 format, which is 4 times larger than the - * number of characters - */ - if (type->type == 0) { - pField->bytes = 0; - } else { - int32_t bytes = -(int32_t)(type->type); - if (bytes > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { - // we have to postpone reporting the error because it cannot be done here - // as pField->bytes is int16_t, use 'TSDB_MAX_NCHAR_LEN + 1' to avoid overflow - bytes = TSDB_MAX_NCHAR_LEN + 1; - } else { - bytes = bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; - } - pField->bytes = (int16_t)bytes; - } - } else if (i == TSDB_DATA_TYPE_BINARY) { - /* for binary, the TOKENTYPE is the length of binary */ - if (type->type == 0) { - pField->bytes = 0; - } else { - int32_t bytes = -(int32_t)(type->type); - if (bytes > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { - // refer comment for NCHAR above - bytes = TSDB_MAX_BINARY_LEN + 1; - } else { - bytes += VARSTR_HEADER_SIZE; - } - pField->bytes = (int16_t)bytes; - } - } + int32_t i = 0; + while (i < tListLen(tDataTypeDesc)) { + if ((type->n == tDataTypeDesc[i].nameLen) && + (strncasecmp(type->z, tDataTypeDesc[i].aName, tDataTypeDesc[i].nameLen) == 0)) { break; } + + i += 1; + } + + if (i == tListLen(tDataTypeDesc)) { + return; + } + + pField->type = i; + pField->bytes = tDataTypeDesc[i].nSize; + + if (i == TSDB_DATA_TYPE_NCHAR) { + /* + * for nchar, the TOKENTYPE is the number of character, so the length is the + * number of bytes in UCS-4 format, which is 4 times larger than the number of characters + */ + if (type->type == 0) { + pField->bytes = 0; + } else { + int32_t bytes = -(int32_t)(type->type); + if (bytes > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { + // we have to postpone reporting the error because it cannot be done here + // as pField->bytes is int16_t, use 'TSDB_MAX_NCHAR_LEN + 1' to avoid overflow + bytes = TSDB_MAX_NCHAR_LEN + 1; + } else { + bytes = bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; + } + pField->bytes = (int16_t)bytes; + } + } else if (i == TSDB_DATA_TYPE_BINARY) { + /* for binary, the TOKENTYPE is the length of binary */ + if (type->type == 0) { + pField->bytes = 0; + } else { + int32_t bytes = -(int32_t)(type->type); + if (bytes > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + // refer comment for NCHAR above + bytes = TSDB_MAX_BINARY_LEN + 1; + } else { + bytes += VARSTR_HEADER_SIZE; + } + + pField->bytes = (int16_t)bytes; + } } } diff --git a/src/query/src/qTokenizer.c b/src/query/src/qTokenizer.c index e243637333..48d2f5d505 100644 --- a/src/query/src/qTokenizer.c +++ b/src/query/src/qTokenizer.c @@ -129,6 +129,7 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"LP", TK_LP}, {"RP", TK_RP}, + {"UNSIGNED", TK_UNSIGNED}, {"TAGS", TK_TAGS}, {"USING", TK_USING}, {"AS", TK_AS}, diff --git a/src/query/src/qTsbuf.c b/src/query/src/qTsbuf.c index a5d4690a8e..a53f8935ee 100644 --- a/src/query/src/qTsbuf.c +++ b/src/query/src/qTsbuf.c @@ -268,7 +268,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) { metaLen += (int32_t)fwrite(pBlock->tag.pz, 1, (size_t)pBlock->tag.nLen, pTSBuf->f); } else if (pBlock->tag.nType != TSDB_DATA_TYPE_NULL) { metaLen += (int32_t)fwrite(&pBlock->tag.nLen, 1, sizeof(pBlock->tag.nLen), pTSBuf->f); - metaLen += (int32_t)fwrite(&pBlock->tag.i64Key, 1, (size_t) pBlock->tag.nLen, pTSBuf->f); + metaLen += (int32_t)fwrite(&pBlock->tag.i64, 1, (size_t) pBlock->tag.nLen, pTSBuf->f); } else { trueLen = 0; metaLen += (int32_t)fwrite(&trueLen, 1, sizeof(pBlock->tag.nLen), pTSBuf->f); @@ -351,7 +351,7 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) { sz = fread(pBlock->tag.pz, (size_t)pBlock->tag.nLen, 1, pTSBuf->f); UNUSED(sz); } else if (pBlock->tag.nType != TSDB_DATA_TYPE_NULL) { //TODO check the return value - sz = fread(&pBlock->tag.i64Key, (size_t) pBlock->tag.nLen, 1, pTSBuf->f); + sz = fread(&pBlock->tag.i64, (size_t) pBlock->tag.nLen, 1, pTSBuf->f); UNUSED(sz); } @@ -955,7 +955,7 @@ void tsBufDisplay(STSBuf* pTSBuf) { while (tsBufNextPos(pTSBuf)) { STSElem elem = tsBufGetElem(pTSBuf); if (elem.tag->nType == TSDB_DATA_TYPE_BIGINT) { - printf("%d-%" PRId64 "-%" PRId64 "\n", elem.id, elem.tag->i64Key, elem.ts); + printf("%d-%" PRId64 "-%" PRId64 "\n", elem.id, elem.tag->i64, elem.ts); } } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 7c10a4ce6b..6c59a51074 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -97,27 +97,27 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 278 +#define YYNOCODE 279 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SQuerySQL* yy4; - SSubclauseInfo* yy13; - int yy70; - SCreatedTableInfo yy84; - SIntervalVal yy222; - TAOS_FIELD yy363; - tSQLExprList* yy382; - int64_t yy387; - SArray* yy403; - SLimitVal yy404; - SCreateTableSQL* yy436; - SCreateAcctSQL yy463; - SCreateDBInfo yy478; - tVariant yy488; - tSQLExpr* yy522; + SCreateTableSQL* yy38; + SCreateAcctSQL yy71; + tSQLExpr* yy78; + int yy96; + SQuerySQL* yy148; + SCreatedTableInfo yy152; + SSubclauseInfo* yy153; + tSQLExprList* yy166; + SLimitVal yy167; + TAOS_FIELD yy183; + SCreateDBInfo yy234; + int64_t yy325; + SIntervalVal yy400; + SArray* yy421; + tVariant yy430; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -128,16 +128,16 @@ typedef union { #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 #define YYNSTATE 258 -#define YYNRULE 239 -#define YYNTOKEN 208 +#define YYNRULE 240 +#define YYNTOKEN 209 #define YY_MAX_SHIFT 257 -#define YY_MIN_SHIFTREDUCE 430 -#define YY_MAX_SHIFTREDUCE 668 -#define YY_ERROR_ACTION 669 -#define YY_ACCEPT_ACTION 670 -#define YY_NO_ACTION 671 -#define YY_MIN_REDUCE 672 -#define YY_MAX_REDUCE 910 +#define YY_MIN_SHIFTREDUCE 431 +#define YY_MAX_SHIFTREDUCE 670 +#define YY_ERROR_ACTION 671 +#define YY_ACCEPT_ACTION 672 +#define YY_NO_ACTION 673 +#define YY_MIN_REDUCE 674 +#define YY_MAX_REDUCE 913 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -203,228 +203,228 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (585) +#define YY_ACTTAB_COUNT (586) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 143, 473, 143, 23, 670, 257, 165, 545, 824, 474, - /* 10 */ 897, 168, 898, 37, 38, 12, 39, 40, 813, 23, - /* 20 */ 173, 31, 473, 473, 209, 43, 41, 45, 42, 802, - /* 30 */ 474, 474, 163, 36, 35, 231, 230, 34, 33, 32, - /* 40 */ 37, 38, 798, 39, 40, 813, 105, 173, 31, 162, - /* 50 */ 255, 209, 43, 41, 45, 42, 176, 178, 799, 194, - /* 60 */ 36, 35, 233, 821, 34, 33, 32, 431, 432, 433, - /* 70 */ 434, 435, 436, 437, 438, 439, 440, 441, 442, 256, - /* 80 */ 802, 143, 184, 63, 179, 37, 38, 224, 39, 40, - /* 90 */ 167, 898, 173, 31, 800, 29, 209, 43, 41, 45, - /* 100 */ 42, 110, 197, 791, 57, 36, 35, 251, 210, 34, - /* 110 */ 33, 32, 110, 17, 222, 250, 249, 221, 220, 219, - /* 120 */ 248, 218, 247, 246, 245, 217, 244, 243, 622, 772, - /* 130 */ 802, 760, 761, 762, 763, 764, 765, 766, 767, 768, - /* 140 */ 769, 770, 771, 773, 774, 242, 38, 180, 39, 40, - /* 150 */ 228, 227, 173, 31, 110, 18, 209, 43, 41, 45, - /* 160 */ 42, 851, 28, 204, 110, 36, 35, 23, 187, 34, - /* 170 */ 33, 32, 850, 39, 40, 191, 190, 173, 31, 224, - /* 180 */ 624, 209, 43, 41, 45, 42, 34, 33, 32, 9, - /* 190 */ 36, 35, 65, 120, 34, 33, 32, 172, 635, 638, - /* 200 */ 66, 626, 104, 629, 177, 632, 799, 172, 635, 28, - /* 210 */ 13, 626, 206, 629, 61, 632, 625, 172, 635, 142, - /* 220 */ 572, 626, 23, 629, 62, 632, 155, 196, 147, 169, - /* 230 */ 170, 793, 156, 208, 603, 604, 92, 91, 150, 169, - /* 240 */ 170, 894, 713, 580, 17, 133, 250, 249, 893, 169, - /* 250 */ 170, 248, 64, 247, 246, 245, 892, 244, 243, 229, - /* 260 */ 778, 799, 80, 776, 777, 590, 18, 242, 779, 107, - /* 270 */ 781, 782, 780, 28, 783, 784, 43, 41, 45, 42, - /* 280 */ 159, 790, 22, 792, 36, 35, 160, 171, 34, 33, - /* 290 */ 32, 722, 564, 193, 133, 561, 44, 562, 52, 563, - /* 300 */ 158, 254, 253, 98, 36, 35, 44, 634, 34, 33, - /* 310 */ 32, 23, 145, 3, 124, 53, 44, 634, 146, 72, - /* 320 */ 68, 71, 633, 181, 182, 148, 714, 634, 4, 133, - /* 330 */ 78, 82, 633, 137, 135, 149, 87, 90, 81, 95, - /* 340 */ 94, 93, 633, 153, 84, 594, 577, 154, 234, 48, - /* 350 */ 799, 19, 49, 152, 595, 654, 636, 141, 15, 14, - /* 360 */ 14, 628, 627, 631, 630, 553, 212, 151, 554, 24, - /* 370 */ 24, 50, 48, 77, 76, 11, 10, 568, 566, 569, - /* 380 */ 567, 89, 88, 103, 101, 907, 144, 801, 861, 860, - /* 390 */ 174, 857, 856, 175, 823, 232, 565, 828, 830, 106, - /* 400 */ 843, 815, 842, 121, 122, 28, 119, 123, 195, 724, - /* 410 */ 216, 139, 26, 225, 721, 226, 906, 74, 102, 905, - /* 420 */ 903, 125, 742, 27, 25, 140, 711, 83, 589, 709, - /* 430 */ 85, 86, 707, 706, 183, 134, 704, 703, 702, 701, - /* 440 */ 198, 700, 136, 698, 696, 694, 692, 690, 138, 164, - /* 450 */ 58, 54, 59, 202, 51, 844, 46, 812, 207, 205, - /* 460 */ 203, 201, 199, 30, 79, 235, 236, 237, 238, 239, - /* 470 */ 240, 161, 214, 241, 252, 215, 668, 186, 185, 157, - /* 480 */ 69, 667, 188, 189, 666, 659, 192, 196, 166, 574, - /* 490 */ 705, 591, 56, 96, 132, 743, 126, 128, 127, 129, - /* 500 */ 130, 699, 111, 131, 1, 97, 116, 112, 113, 114, - /* 510 */ 691, 797, 60, 117, 115, 118, 2, 20, 108, 200, - /* 520 */ 6, 596, 109, 5, 7, 637, 21, 8, 211, 16, - /* 530 */ 213, 639, 67, 65, 514, 510, 508, 507, 506, 503, - /* 540 */ 477, 223, 70, 47, 73, 75, 24, 547, 546, 544, - /* 550 */ 55, 498, 496, 488, 494, 490, 492, 486, 484, 516, - /* 560 */ 515, 513, 512, 511, 509, 505, 504, 48, 475, 446, - /* 570 */ 444, 672, 671, 671, 671, 671, 671, 671, 671, 671, - /* 580 */ 671, 671, 671, 99, 100, + /* 0 */ 143, 474, 143, 23, 672, 257, 165, 547, 827, 475, + /* 10 */ 900, 168, 901, 37, 38, 12, 39, 40, 816, 23, + /* 20 */ 173, 31, 474, 474, 210, 43, 41, 45, 42, 805, + /* 30 */ 475, 475, 163, 36, 35, 232, 231, 34, 33, 32, + /* 40 */ 37, 38, 801, 39, 40, 816, 110, 173, 31, 162, + /* 50 */ 255, 210, 43, 41, 45, 42, 176, 66, 802, 195, + /* 60 */ 36, 35, 178, 824, 34, 33, 32, 432, 433, 434, + /* 70 */ 435, 436, 437, 438, 439, 440, 441, 442, 443, 256, + /* 80 */ 179, 225, 185, 37, 38, 805, 39, 40, 796, 242, + /* 90 */ 173, 31, 143, 180, 210, 43, 41, 45, 42, 110, + /* 100 */ 110, 167, 901, 36, 35, 57, 853, 34, 33, 32, + /* 110 */ 17, 223, 250, 249, 222, 221, 220, 248, 219, 247, + /* 120 */ 246, 245, 218, 244, 243, 803, 142, 774, 624, 762, + /* 130 */ 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, + /* 140 */ 773, 775, 776, 38, 181, 39, 40, 229, 228, 173, + /* 150 */ 31, 605, 606, 210, 43, 41, 45, 42, 207, 854, + /* 160 */ 61, 205, 36, 35, 23, 110, 34, 33, 32, 188, + /* 170 */ 39, 40, 23, 251, 173, 31, 192, 191, 210, 43, + /* 180 */ 41, 45, 42, 34, 33, 32, 105, 36, 35, 104, + /* 190 */ 147, 34, 33, 32, 172, 637, 805, 28, 628, 897, + /* 200 */ 631, 177, 634, 802, 172, 637, 896, 13, 628, 230, + /* 210 */ 631, 802, 634, 18, 172, 637, 794, 895, 628, 63, + /* 220 */ 631, 28, 634, 155, 574, 62, 169, 170, 23, 156, + /* 230 */ 209, 29, 197, 92, 91, 150, 169, 170, 77, 76, + /* 240 */ 582, 17, 198, 250, 249, 159, 169, 170, 248, 626, + /* 250 */ 247, 246, 245, 715, 244, 243, 133, 211, 780, 80, + /* 260 */ 160, 778, 779, 18, 242, 234, 781, 802, 783, 784, + /* 270 */ 782, 28, 785, 786, 43, 41, 45, 42, 724, 579, + /* 280 */ 64, 133, 36, 35, 19, 627, 34, 33, 32, 3, + /* 290 */ 124, 194, 225, 44, 910, 72, 68, 71, 158, 11, + /* 300 */ 10, 566, 592, 44, 563, 636, 564, 107, 565, 793, + /* 310 */ 22, 795, 630, 44, 633, 636, 716, 36, 35, 133, + /* 320 */ 635, 34, 33, 32, 171, 636, 596, 49, 78, 82, + /* 330 */ 635, 48, 182, 183, 87, 90, 81, 137, 135, 629, + /* 340 */ 635, 632, 84, 95, 94, 93, 50, 9, 145, 640, + /* 350 */ 52, 65, 120, 254, 253, 98, 597, 656, 638, 555, + /* 360 */ 146, 15, 14, 14, 24, 4, 55, 53, 546, 213, + /* 370 */ 556, 570, 148, 571, 24, 48, 568, 149, 569, 89, + /* 380 */ 88, 103, 101, 153, 154, 152, 141, 151, 144, 804, + /* 390 */ 864, 863, 818, 174, 860, 859, 175, 233, 826, 846, + /* 400 */ 831, 833, 106, 121, 845, 122, 567, 119, 123, 726, + /* 410 */ 217, 139, 26, 226, 102, 723, 28, 227, 909, 74, + /* 420 */ 908, 906, 125, 744, 27, 25, 196, 140, 713, 591, + /* 430 */ 83, 711, 85, 86, 199, 709, 708, 184, 54, 134, + /* 440 */ 706, 164, 705, 704, 703, 702, 136, 700, 698, 696, + /* 450 */ 694, 692, 138, 203, 58, 59, 51, 847, 815, 46, + /* 460 */ 208, 206, 204, 202, 200, 30, 79, 235, 236, 237, + /* 470 */ 238, 239, 240, 241, 161, 215, 216, 252, 670, 187, + /* 480 */ 186, 669, 69, 189, 157, 190, 668, 193, 661, 707, + /* 490 */ 197, 576, 60, 56, 593, 96, 128, 97, 127, 745, + /* 500 */ 126, 130, 129, 131, 132, 701, 693, 113, 111, 118, + /* 510 */ 116, 114, 112, 115, 800, 1, 117, 2, 166, 20, + /* 520 */ 108, 201, 6, 598, 109, 7, 639, 5, 8, 21, + /* 530 */ 16, 67, 212, 641, 214, 515, 65, 511, 509, 508, + /* 540 */ 507, 504, 478, 224, 70, 47, 73, 75, 24, 549, + /* 550 */ 548, 545, 499, 497, 489, 495, 491, 493, 487, 485, + /* 560 */ 517, 516, 514, 513, 512, 510, 506, 505, 48, 476, + /* 570 */ 447, 445, 674, 673, 673, 673, 673, 673, 673, 673, + /* 580 */ 673, 673, 673, 673, 99, 100, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 266, 1, 266, 212, 209, 210, 229, 5, 212, 9, - /* 10 */ 276, 275, 276, 13, 14, 266, 16, 17, 250, 212, - /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 252, - /* 30 */ 9, 9, 264, 33, 34, 33, 34, 37, 38, 39, - /* 40 */ 13, 14, 251, 16, 17, 250, 212, 20, 21, 211, - /* 50 */ 212, 24, 25, 26, 27, 28, 249, 229, 251, 264, - /* 60 */ 33, 34, 212, 267, 37, 38, 39, 45, 46, 47, + /* 0 */ 267, 1, 267, 213, 210, 211, 230, 5, 213, 9, + /* 10 */ 277, 276, 277, 13, 14, 267, 16, 17, 251, 213, + /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 253, + /* 30 */ 9, 9, 265, 33, 34, 33, 34, 37, 38, 39, + /* 40 */ 13, 14, 252, 16, 17, 251, 213, 20, 21, 212, + /* 50 */ 213, 24, 25, 26, 27, 28, 250, 218, 252, 265, + /* 60 */ 33, 34, 230, 268, 37, 38, 39, 45, 46, 47, /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 252, 266, 60, 253, 66, 13, 14, 76, 16, 17, - /* 90 */ 275, 276, 20, 21, 244, 265, 24, 25, 26, 27, - /* 100 */ 28, 212, 268, 0, 104, 33, 34, 229, 15, 37, - /* 110 */ 38, 39, 212, 85, 86, 87, 88, 89, 90, 91, - /* 120 */ 92, 93, 94, 95, 96, 97, 98, 99, 101, 228, - /* 130 */ 252, 230, 231, 232, 233, 234, 235, 236, 237, 238, - /* 140 */ 239, 240, 241, 242, 243, 78, 14, 129, 16, 17, - /* 150 */ 132, 133, 20, 21, 212, 100, 24, 25, 26, 27, - /* 160 */ 28, 272, 107, 274, 212, 33, 34, 212, 128, 37, - /* 170 */ 38, 39, 272, 16, 17, 135, 136, 20, 21, 76, - /* 180 */ 1, 24, 25, 26, 27, 28, 37, 38, 39, 100, - /* 190 */ 33, 34, 103, 104, 37, 38, 39, 1, 2, 106, - /* 200 */ 217, 5, 100, 7, 249, 9, 251, 1, 2, 107, - /* 210 */ 44, 5, 270, 7, 272, 9, 37, 1, 2, 266, - /* 220 */ 101, 5, 212, 7, 272, 9, 60, 108, 266, 33, - /* 230 */ 34, 248, 66, 37, 117, 118, 70, 71, 72, 33, - /* 240 */ 34, 266, 216, 37, 85, 219, 87, 88, 266, 33, - /* 250 */ 34, 92, 217, 94, 95, 96, 266, 98, 99, 249, - /* 260 */ 228, 251, 73, 231, 232, 101, 100, 78, 236, 105, - /* 270 */ 238, 239, 240, 107, 242, 243, 25, 26, 27, 28, - /* 280 */ 266, 246, 247, 248, 33, 34, 266, 59, 37, 38, - /* 290 */ 39, 216, 2, 127, 219, 5, 100, 7, 105, 9, - /* 300 */ 134, 63, 64, 65, 33, 34, 100, 111, 37, 38, - /* 310 */ 39, 212, 266, 61, 62, 122, 100, 111, 266, 67, - /* 320 */ 68, 69, 126, 33, 34, 266, 216, 111, 100, 219, - /* 330 */ 61, 62, 126, 61, 62, 266, 67, 68, 69, 67, - /* 340 */ 68, 69, 126, 266, 75, 101, 105, 266, 249, 105, - /* 350 */ 251, 110, 105, 266, 101, 101, 101, 266, 105, 105, - /* 360 */ 105, 5, 5, 7, 7, 101, 101, 266, 101, 105, - /* 370 */ 105, 124, 105, 130, 131, 130, 131, 5, 5, 7, - /* 380 */ 7, 73, 74, 61, 62, 252, 266, 252, 245, 245, - /* 390 */ 245, 245, 245, 245, 212, 245, 106, 212, 212, 212, - /* 400 */ 273, 250, 273, 212, 212, 107, 254, 212, 250, 212, - /* 410 */ 212, 212, 212, 212, 212, 212, 212, 212, 59, 212, - /* 420 */ 212, 212, 212, 212, 212, 212, 212, 212, 111, 212, - /* 430 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, - /* 440 */ 269, 212, 212, 212, 212, 212, 212, 212, 212, 269, - /* 450 */ 213, 121, 213, 269, 123, 213, 120, 263, 115, 119, - /* 460 */ 114, 113, 112, 125, 84, 83, 49, 80, 82, 53, - /* 470 */ 81, 213, 213, 79, 76, 213, 5, 5, 137, 213, - /* 480 */ 217, 5, 137, 5, 5, 86, 128, 108, 1, 101, - /* 490 */ 213, 101, 109, 214, 220, 227, 226, 221, 225, 224, - /* 500 */ 222, 213, 262, 223, 218, 214, 257, 261, 260, 259, - /* 510 */ 213, 250, 105, 256, 258, 255, 215, 105, 100, 100, - /* 520 */ 116, 101, 100, 100, 116, 101, 105, 100, 102, 100, - /* 530 */ 102, 106, 73, 103, 9, 5, 5, 5, 5, 5, - /* 540 */ 77, 15, 73, 16, 131, 131, 105, 5, 5, 101, - /* 550 */ 100, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 560 */ 5, 5, 5, 5, 5, 5, 5, 105, 77, 59, - /* 570 */ 58, 0, 277, 277, 277, 277, 277, 277, 277, 277, - /* 580 */ 277, 277, 277, 21, 21, 277, 277, 277, 277, 277, - /* 590 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 600 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 610 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 620 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 630 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 640 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 650 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 660 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 670 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 680 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 690 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 700 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 710 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 720 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 730 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 740 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 750 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 760 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 770 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 780 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 790 */ 277, 277, 277, + /* 80 */ 66, 76, 60, 13, 14, 253, 16, 17, 249, 78, + /* 90 */ 20, 21, 267, 213, 24, 25, 26, 27, 28, 213, + /* 100 */ 213, 276, 277, 33, 34, 105, 273, 37, 38, 39, + /* 110 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + /* 120 */ 95, 96, 97, 98, 99, 245, 267, 229, 101, 231, + /* 130 */ 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + /* 140 */ 242, 243, 244, 14, 130, 16, 17, 133, 134, 20, + /* 150 */ 21, 118, 119, 24, 25, 26, 27, 28, 271, 273, + /* 160 */ 273, 275, 33, 34, 213, 213, 37, 38, 39, 129, + /* 170 */ 16, 17, 213, 230, 20, 21, 136, 137, 24, 25, + /* 180 */ 26, 27, 28, 37, 38, 39, 213, 33, 34, 100, + /* 190 */ 267, 37, 38, 39, 1, 2, 253, 108, 5, 267, + /* 200 */ 7, 250, 9, 252, 1, 2, 267, 44, 5, 250, + /* 210 */ 7, 252, 9, 100, 1, 2, 0, 267, 5, 254, + /* 220 */ 7, 108, 9, 60, 101, 273, 33, 34, 213, 66, + /* 230 */ 37, 266, 109, 70, 71, 72, 33, 34, 131, 132, + /* 240 */ 37, 85, 269, 87, 88, 267, 33, 34, 92, 1, + /* 250 */ 94, 95, 96, 217, 98, 99, 220, 15, 229, 73, + /* 260 */ 267, 232, 233, 100, 78, 250, 237, 252, 239, 240, + /* 270 */ 241, 108, 243, 244, 25, 26, 27, 28, 217, 106, + /* 280 */ 218, 220, 33, 34, 111, 37, 37, 38, 39, 61, + /* 290 */ 62, 128, 76, 100, 253, 67, 68, 69, 135, 131, + /* 300 */ 132, 2, 101, 100, 5, 112, 7, 106, 9, 247, + /* 310 */ 248, 249, 5, 100, 7, 112, 217, 33, 34, 220, + /* 320 */ 127, 37, 38, 39, 59, 112, 101, 106, 61, 62, + /* 330 */ 127, 106, 33, 34, 67, 68, 69, 61, 62, 5, + /* 340 */ 127, 7, 75, 67, 68, 69, 125, 100, 267, 107, + /* 350 */ 106, 104, 105, 63, 64, 65, 101, 101, 101, 101, + /* 360 */ 267, 106, 106, 106, 106, 100, 100, 123, 102, 101, + /* 370 */ 101, 5, 267, 7, 106, 106, 5, 267, 7, 73, + /* 380 */ 74, 61, 62, 267, 267, 267, 267, 267, 267, 253, + /* 390 */ 246, 246, 251, 246, 246, 246, 246, 246, 213, 274, + /* 400 */ 213, 213, 213, 213, 274, 213, 107, 255, 213, 213, + /* 410 */ 213, 213, 213, 213, 59, 213, 108, 213, 213, 213, + /* 420 */ 213, 213, 213, 213, 213, 213, 251, 213, 213, 112, + /* 430 */ 213, 213, 213, 213, 270, 213, 213, 213, 122, 213, + /* 440 */ 213, 270, 213, 213, 213, 213, 213, 213, 213, 213, + /* 450 */ 213, 213, 213, 270, 214, 214, 124, 214, 264, 121, + /* 460 */ 116, 120, 115, 114, 113, 126, 84, 83, 49, 80, + /* 470 */ 82, 53, 81, 79, 214, 214, 214, 76, 5, 5, + /* 480 */ 138, 5, 218, 138, 214, 5, 5, 129, 86, 214, + /* 490 */ 109, 101, 106, 110, 101, 215, 222, 215, 226, 228, + /* 500 */ 227, 223, 225, 224, 221, 214, 214, 261, 263, 256, + /* 510 */ 258, 260, 262, 259, 251, 219, 257, 216, 1, 106, + /* 520 */ 100, 100, 117, 101, 100, 117, 101, 100, 100, 106, + /* 530 */ 100, 73, 103, 107, 103, 9, 104, 5, 5, 5, + /* 540 */ 5, 5, 77, 15, 73, 16, 132, 132, 106, 5, + /* 550 */ 5, 101, 5, 5, 5, 5, 5, 5, 5, 5, + /* 560 */ 5, 5, 5, 5, 5, 5, 5, 5, 106, 77, + /* 570 */ 59, 58, 0, 278, 278, 278, 278, 278, 278, 278, + /* 580 */ 278, 278, 278, 278, 21, 21, 278, 278, 278, 278, + /* 590 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 600 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 610 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 620 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 630 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 640 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 650 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 660 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 670 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 680 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 690 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 700 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 710 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 720 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 730 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 740 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 750 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 770 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 790 */ 278, 278, 278, 278, 278, }; #define YY_SHIFT_COUNT (257) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (571) +#define YY_SHIFT_MAX (572) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 166, 28, 159, 11, 196, 216, 21, 21, 21, 21, - /* 10 */ 21, 21, 0, 22, 216, 290, 290, 290, 55, 21, - /* 20 */ 21, 21, 103, 21, 21, 189, 67, 67, 585, 206, - /* 30 */ 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - /* 40 */ 216, 216, 216, 216, 216, 216, 216, 290, 290, 2, - /* 50 */ 2, 2, 2, 2, 2, 2, 102, 21, 21, 21, - /* 60 */ 21, 117, 117, 241, 21, 21, 21, 21, 21, 21, + /* 0 */ 163, 25, 156, 5, 193, 213, 21, 21, 21, 21, + /* 10 */ 21, 21, 0, 22, 213, 299, 299, 299, 113, 21, + /* 20 */ 21, 21, 216, 21, 21, 186, 11, 11, 586, 203, + /* 30 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, + /* 40 */ 213, 213, 213, 213, 213, 213, 213, 299, 299, 2, + /* 50 */ 2, 2, 2, 2, 2, 2, 89, 21, 21, 21, + /* 60 */ 21, 33, 33, 173, 21, 21, 21, 21, 21, 21, /* 70 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 90 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - /* 100 */ 21, 21, 21, 21, 298, 359, 359, 317, 317, 317, - /* 110 */ 359, 330, 331, 336, 343, 340, 346, 348, 350, 338, - /* 120 */ 298, 359, 359, 359, 11, 359, 380, 382, 417, 387, - /* 130 */ 386, 416, 389, 394, 359, 398, 359, 398, 359, 585, - /* 140 */ 585, 27, 72, 72, 72, 132, 157, 251, 251, 251, - /* 150 */ 269, 271, 271, 271, 271, 252, 272, 18, 40, 149, - /* 160 */ 149, 89, 238, 119, 164, 244, 253, 254, 255, 356, - /* 170 */ 357, 179, 228, 93, 247, 193, 264, 265, 267, 243, - /* 180 */ 245, 372, 373, 308, 322, 471, 341, 472, 476, 345, - /* 190 */ 478, 479, 399, 358, 379, 388, 383, 407, 390, 418, - /* 200 */ 487, 419, 420, 422, 412, 404, 421, 408, 424, 423, - /* 210 */ 425, 427, 426, 429, 428, 430, 459, 525, 530, 531, - /* 220 */ 532, 533, 534, 463, 526, 469, 527, 413, 414, 441, - /* 230 */ 542, 543, 448, 450, 441, 546, 547, 548, 549, 550, - /* 240 */ 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, - /* 250 */ 561, 462, 491, 562, 563, 510, 512, 571, + /* 100 */ 21, 21, 21, 21, 308, 355, 355, 317, 317, 317, + /* 110 */ 355, 316, 332, 338, 344, 341, 347, 349, 351, 339, + /* 120 */ 308, 355, 355, 355, 5, 355, 382, 384, 419, 389, + /* 130 */ 388, 418, 391, 394, 355, 401, 355, 401, 355, 586, + /* 140 */ 586, 27, 70, 70, 70, 129, 154, 249, 249, 249, + /* 150 */ 267, 284, 284, 284, 284, 228, 276, 14, 40, 146, + /* 160 */ 146, 247, 290, 123, 201, 225, 255, 256, 257, 307, + /* 170 */ 334, 248, 265, 242, 221, 244, 258, 268, 269, 107, + /* 180 */ 266, 168, 366, 371, 306, 320, 473, 342, 474, 476, + /* 190 */ 345, 480, 481, 402, 358, 381, 390, 383, 386, 393, + /* 200 */ 420, 517, 421, 422, 424, 413, 405, 423, 408, 425, + /* 210 */ 427, 426, 428, 429, 430, 431, 432, 458, 526, 532, + /* 220 */ 533, 534, 535, 536, 465, 528, 471, 529, 414, 415, + /* 230 */ 442, 544, 545, 450, 442, 547, 548, 549, 550, 551, + /* 240 */ 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, + /* 250 */ 562, 462, 492, 563, 564, 511, 513, 572, }; #define YY_REDUCE_COUNT (140) -#define YY_REDUCE_MIN (-266) +#define YY_REDUCE_MIN (-267) #define YY_REDUCE_MAX (301) static const short yy_reduce_ofst[] = { - /* 0 */ -205, -99, 32, 35, -264, -185, -111, -58, -193, -45, - /* 10 */ 10, 99, -204, -162, -266, -223, -172, -122, -232, -166, - /* 20 */ -100, -48, -17, -150, -209, 26, 75, 110, -170, -251, - /* 30 */ -47, -38, -25, -18, -10, 14, 20, 46, 52, 59, - /* 40 */ 69, 77, 81, 87, 91, 101, 120, 133, 135, 143, - /* 50 */ 144, 145, 146, 147, 148, 150, 151, 182, 185, 186, - /* 60 */ 187, 127, 129, 152, 191, 192, 195, 197, 198, 199, - /* 70 */ 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, - /* 80 */ 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, - /* 90 */ 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, - /* 100 */ 233, 234, 235, 236, 158, 237, 239, 171, 180, 184, - /* 110 */ 242, 194, 240, 246, 248, 250, 256, 249, 257, 260, - /* 120 */ 261, 258, 259, 262, 263, 266, 268, 270, 273, 276, - /* 130 */ 275, 278, 280, 274, 277, 279, 288, 291, 297, 286, + /* 0 */ -206, -102, 29, 62, -265, -175, -114, -113, -194, -49, + /* 10 */ -41, 15, -205, -163, -267, -224, -168, -57, -233, -27, + /* 20 */ -167, -48, -161, -120, -210, 36, 61, 99, -35, -252, + /* 30 */ -141, -77, -68, -61, -50, -22, -7, 81, 93, 105, + /* 40 */ 110, 116, 117, 118, 119, 120, 121, 41, 136, 144, + /* 50 */ 145, 147, 148, 149, 150, 151, 141, 185, 187, 188, + /* 60 */ 189, 125, 130, 152, 190, 192, 195, 196, 197, 198, + /* 70 */ 199, 200, 202, 204, 205, 206, 207, 208, 209, 210, + /* 80 */ 211, 212, 214, 215, 217, 218, 219, 220, 222, 223, + /* 90 */ 224, 226, 227, 229, 230, 231, 232, 233, 234, 235, + /* 100 */ 236, 237, 238, 239, 175, 240, 241, 164, 171, 183, + /* 110 */ 243, 194, 245, 250, 246, 251, 254, 252, 259, 253, + /* 120 */ 263, 260, 261, 262, 264, 270, 271, 273, 272, 274, + /* 130 */ 277, 278, 279, 283, 275, 280, 291, 282, 292, 296, /* 140 */ 301, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 669, 723, 712, 720, 900, 900, 669, 669, 669, 669, - /* 10 */ 669, 669, 825, 687, 900, 669, 669, 669, 669, 669, - /* 20 */ 669, 669, 720, 669, 669, 725, 725, 725, 820, 669, - /* 30 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 40 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 50 */ 669, 669, 669, 669, 669, 669, 669, 669, 827, 829, - /* 60 */ 669, 847, 847, 818, 669, 669, 669, 669, 669, 669, - /* 70 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 80 */ 669, 669, 669, 710, 669, 708, 669, 669, 669, 669, - /* 90 */ 669, 669, 669, 669, 669, 669, 669, 669, 697, 669, - /* 100 */ 669, 669, 669, 669, 669, 689, 689, 669, 669, 669, - /* 110 */ 689, 854, 858, 852, 840, 848, 839, 835, 834, 862, - /* 120 */ 669, 689, 689, 689, 720, 689, 741, 739, 737, 729, - /* 130 */ 735, 731, 733, 727, 689, 718, 689, 718, 689, 759, - /* 140 */ 775, 669, 863, 899, 853, 889, 888, 895, 887, 886, - /* 150 */ 669, 882, 883, 885, 884, 669, 669, 669, 669, 891, - /* 160 */ 890, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 170 */ 669, 669, 865, 669, 859, 855, 669, 669, 669, 669, - /* 180 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 190 */ 669, 669, 669, 669, 817, 669, 669, 826, 669, 669, - /* 200 */ 669, 669, 669, 669, 849, 669, 841, 669, 669, 669, - /* 210 */ 669, 669, 794, 669, 669, 669, 669, 669, 669, 669, - /* 220 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 904, - /* 230 */ 669, 669, 669, 785, 902, 669, 669, 669, 669, 669, - /* 240 */ 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, - /* 250 */ 669, 744, 669, 695, 693, 669, 685, 669, + /* 0 */ 671, 725, 714, 722, 903, 903, 671, 671, 671, 671, + /* 10 */ 671, 671, 828, 689, 903, 671, 671, 671, 671, 671, + /* 20 */ 671, 671, 722, 671, 671, 727, 727, 727, 823, 671, + /* 30 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 40 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 50 */ 671, 671, 671, 671, 671, 671, 671, 671, 830, 832, + /* 60 */ 671, 850, 850, 821, 671, 671, 671, 671, 671, 671, + /* 70 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 80 */ 671, 671, 671, 712, 671, 710, 671, 671, 671, 671, + /* 90 */ 671, 671, 671, 671, 671, 671, 671, 671, 699, 671, + /* 100 */ 671, 671, 671, 671, 671, 691, 691, 671, 671, 671, + /* 110 */ 691, 857, 861, 855, 843, 851, 842, 838, 837, 865, + /* 120 */ 671, 691, 691, 691, 722, 691, 743, 741, 739, 731, + /* 130 */ 737, 733, 735, 729, 691, 720, 691, 720, 691, 761, + /* 140 */ 777, 671, 866, 902, 856, 892, 891, 898, 890, 889, + /* 150 */ 671, 885, 886, 888, 887, 671, 671, 671, 671, 894, + /* 160 */ 893, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 170 */ 671, 671, 868, 671, 862, 858, 671, 671, 671, 671, + /* 180 */ 787, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 190 */ 671, 671, 671, 671, 671, 820, 671, 671, 829, 671, + /* 200 */ 671, 671, 671, 671, 671, 852, 671, 844, 671, 671, + /* 210 */ 671, 671, 671, 797, 671, 671, 671, 671, 671, 671, + /* 220 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 230 */ 907, 671, 671, 671, 905, 671, 671, 671, 671, 671, + /* 240 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 250 */ 671, 746, 671, 697, 695, 671, 687, 671, }; /********** End of lemon-generated parsing tables *****************************/ @@ -546,6 +546,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* CACHELAST => nothing */ 0, /* LP => nothing */ 0, /* RP => nothing */ + 0, /* UNSIGNED => nothing */ 0, /* TAGS => nothing */ 0, /* USING => nothing */ 0, /* AS => nothing */ @@ -840,181 +841,182 @@ static const char *const yyTokenName[] = { /* 99 */ "CACHELAST", /* 100 */ "LP", /* 101 */ "RP", - /* 102 */ "TAGS", - /* 103 */ "USING", - /* 104 */ "AS", - /* 105 */ "COMMA", - /* 106 */ "NULL", - /* 107 */ "SELECT", - /* 108 */ "UNION", - /* 109 */ "ALL", - /* 110 */ "FROM", - /* 111 */ "VARIABLE", - /* 112 */ "INTERVAL", - /* 113 */ "FILL", - /* 114 */ "SLIDING", - /* 115 */ "ORDER", - /* 116 */ "BY", - /* 117 */ "ASC", - /* 118 */ "DESC", - /* 119 */ "GROUP", - /* 120 */ "HAVING", - /* 121 */ "LIMIT", - /* 122 */ "OFFSET", - /* 123 */ "SLIMIT", - /* 124 */ "SOFFSET", - /* 125 */ "WHERE", - /* 126 */ "NOW", - /* 127 */ "RESET", - /* 128 */ "QUERY", - /* 129 */ "ADD", - /* 130 */ "COLUMN", - /* 131 */ "TAG", - /* 132 */ "CHANGE", - /* 133 */ "SET", - /* 134 */ "KILL", - /* 135 */ "CONNECTION", - /* 136 */ "STREAM", - /* 137 */ "COLON", - /* 138 */ "ABORT", - /* 139 */ "AFTER", - /* 140 */ "ATTACH", - /* 141 */ "BEFORE", - /* 142 */ "BEGIN", - /* 143 */ "CASCADE", - /* 144 */ "CLUSTER", - /* 145 */ "CONFLICT", - /* 146 */ "COPY", - /* 147 */ "DEFERRED", - /* 148 */ "DELIMITERS", - /* 149 */ "DETACH", - /* 150 */ "EACH", - /* 151 */ "END", - /* 152 */ "EXPLAIN", - /* 153 */ "FAIL", - /* 154 */ "FOR", - /* 155 */ "IGNORE", - /* 156 */ "IMMEDIATE", - /* 157 */ "INITIALLY", - /* 158 */ "INSTEAD", - /* 159 */ "MATCH", - /* 160 */ "KEY", - /* 161 */ "OF", - /* 162 */ "RAISE", - /* 163 */ "REPLACE", - /* 164 */ "RESTRICT", - /* 165 */ "ROW", - /* 166 */ "STATEMENT", - /* 167 */ "TRIGGER", - /* 168 */ "VIEW", - /* 169 */ "COUNT", - /* 170 */ "SUM", - /* 171 */ "AVG", - /* 172 */ "MIN", - /* 173 */ "MAX", - /* 174 */ "FIRST", - /* 175 */ "LAST", - /* 176 */ "TOP", - /* 177 */ "BOTTOM", - /* 178 */ "STDDEV", - /* 179 */ "PERCENTILE", - /* 180 */ "APERCENTILE", - /* 181 */ "LEASTSQUARES", - /* 182 */ "HISTOGRAM", - /* 183 */ "DIFF", - /* 184 */ "SPREAD", - /* 185 */ "TWA", - /* 186 */ "INTERP", - /* 187 */ "LAST_ROW", - /* 188 */ "RATE", - /* 189 */ "IRATE", - /* 190 */ "SUM_RATE", - /* 191 */ "SUM_IRATE", - /* 192 */ "AVG_RATE", - /* 193 */ "AVG_IRATE", - /* 194 */ "TBID", - /* 195 */ "SEMI", - /* 196 */ "NONE", - /* 197 */ "PREV", - /* 198 */ "LINEAR", - /* 199 */ "IMPORT", - /* 200 */ "METRIC", - /* 201 */ "TBNAME", - /* 202 */ "JOIN", - /* 203 */ "METRICS", - /* 204 */ "STABLE", - /* 205 */ "INSERT", - /* 206 */ "INTO", - /* 207 */ "VALUES", - /* 208 */ "error", - /* 209 */ "program", - /* 210 */ "cmd", - /* 211 */ "dbPrefix", - /* 212 */ "ids", - /* 213 */ "cpxName", - /* 214 */ "ifexists", - /* 215 */ "alter_db_optr", - /* 216 */ "acct_optr", - /* 217 */ "ifnotexists", - /* 218 */ "db_optr", - /* 219 */ "pps", - /* 220 */ "tseries", - /* 221 */ "dbs", - /* 222 */ "streams", - /* 223 */ "storage", - /* 224 */ "qtime", - /* 225 */ "users", - /* 226 */ "conns", - /* 227 */ "state", - /* 228 */ "keep", - /* 229 */ "tagitemlist", - /* 230 */ "cache", - /* 231 */ "replica", - /* 232 */ "quorum", - /* 233 */ "days", - /* 234 */ "minrows", - /* 235 */ "maxrows", - /* 236 */ "blocks", - /* 237 */ "ctime", - /* 238 */ "wal", - /* 239 */ "fsync", - /* 240 */ "comp", - /* 241 */ "prec", - /* 242 */ "update", - /* 243 */ "cachelast", - /* 244 */ "typename", - /* 245 */ "signed", - /* 246 */ "create_table_args", - /* 247 */ "create_table_list", - /* 248 */ "create_from_stable", - /* 249 */ "columnlist", - /* 250 */ "select", - /* 251 */ "column", - /* 252 */ "tagitem", - /* 253 */ "selcollist", - /* 254 */ "from", - /* 255 */ "where_opt", - /* 256 */ "interval_opt", - /* 257 */ "fill_opt", - /* 258 */ "sliding_opt", - /* 259 */ "groupby_opt", - /* 260 */ "orderby_opt", - /* 261 */ "having_opt", - /* 262 */ "slimit_opt", - /* 263 */ "limit_opt", - /* 264 */ "union", - /* 265 */ "sclp", - /* 266 */ "expr", - /* 267 */ "as", - /* 268 */ "tablelist", - /* 269 */ "tmvar", - /* 270 */ "sortlist", - /* 271 */ "sortitem", - /* 272 */ "item", - /* 273 */ "sortorder", - /* 274 */ "grouplist", - /* 275 */ "exprlist", - /* 276 */ "expritem", + /* 102 */ "UNSIGNED", + /* 103 */ "TAGS", + /* 104 */ "USING", + /* 105 */ "AS", + /* 106 */ "COMMA", + /* 107 */ "NULL", + /* 108 */ "SELECT", + /* 109 */ "UNION", + /* 110 */ "ALL", + /* 111 */ "FROM", + /* 112 */ "VARIABLE", + /* 113 */ "INTERVAL", + /* 114 */ "FILL", + /* 115 */ "SLIDING", + /* 116 */ "ORDER", + /* 117 */ "BY", + /* 118 */ "ASC", + /* 119 */ "DESC", + /* 120 */ "GROUP", + /* 121 */ "HAVING", + /* 122 */ "LIMIT", + /* 123 */ "OFFSET", + /* 124 */ "SLIMIT", + /* 125 */ "SOFFSET", + /* 126 */ "WHERE", + /* 127 */ "NOW", + /* 128 */ "RESET", + /* 129 */ "QUERY", + /* 130 */ "ADD", + /* 131 */ "COLUMN", + /* 132 */ "TAG", + /* 133 */ "CHANGE", + /* 134 */ "SET", + /* 135 */ "KILL", + /* 136 */ "CONNECTION", + /* 137 */ "STREAM", + /* 138 */ "COLON", + /* 139 */ "ABORT", + /* 140 */ "AFTER", + /* 141 */ "ATTACH", + /* 142 */ "BEFORE", + /* 143 */ "BEGIN", + /* 144 */ "CASCADE", + /* 145 */ "CLUSTER", + /* 146 */ "CONFLICT", + /* 147 */ "COPY", + /* 148 */ "DEFERRED", + /* 149 */ "DELIMITERS", + /* 150 */ "DETACH", + /* 151 */ "EACH", + /* 152 */ "END", + /* 153 */ "EXPLAIN", + /* 154 */ "FAIL", + /* 155 */ "FOR", + /* 156 */ "IGNORE", + /* 157 */ "IMMEDIATE", + /* 158 */ "INITIALLY", + /* 159 */ "INSTEAD", + /* 160 */ "MATCH", + /* 161 */ "KEY", + /* 162 */ "OF", + /* 163 */ "RAISE", + /* 164 */ "REPLACE", + /* 165 */ "RESTRICT", + /* 166 */ "ROW", + /* 167 */ "STATEMENT", + /* 168 */ "TRIGGER", + /* 169 */ "VIEW", + /* 170 */ "COUNT", + /* 171 */ "SUM", + /* 172 */ "AVG", + /* 173 */ "MIN", + /* 174 */ "MAX", + /* 175 */ "FIRST", + /* 176 */ "LAST", + /* 177 */ "TOP", + /* 178 */ "BOTTOM", + /* 179 */ "STDDEV", + /* 180 */ "PERCENTILE", + /* 181 */ "APERCENTILE", + /* 182 */ "LEASTSQUARES", + /* 183 */ "HISTOGRAM", + /* 184 */ "DIFF", + /* 185 */ "SPREAD", + /* 186 */ "TWA", + /* 187 */ "INTERP", + /* 188 */ "LAST_ROW", + /* 189 */ "RATE", + /* 190 */ "IRATE", + /* 191 */ "SUM_RATE", + /* 192 */ "SUM_IRATE", + /* 193 */ "AVG_RATE", + /* 194 */ "AVG_IRATE", + /* 195 */ "TBID", + /* 196 */ "SEMI", + /* 197 */ "NONE", + /* 198 */ "PREV", + /* 199 */ "LINEAR", + /* 200 */ "IMPORT", + /* 201 */ "METRIC", + /* 202 */ "TBNAME", + /* 203 */ "JOIN", + /* 204 */ "METRICS", + /* 205 */ "STABLE", + /* 206 */ "INSERT", + /* 207 */ "INTO", + /* 208 */ "VALUES", + /* 209 */ "error", + /* 210 */ "program", + /* 211 */ "cmd", + /* 212 */ "dbPrefix", + /* 213 */ "ids", + /* 214 */ "cpxName", + /* 215 */ "ifexists", + /* 216 */ "alter_db_optr", + /* 217 */ "acct_optr", + /* 218 */ "ifnotexists", + /* 219 */ "db_optr", + /* 220 */ "pps", + /* 221 */ "tseries", + /* 222 */ "dbs", + /* 223 */ "streams", + /* 224 */ "storage", + /* 225 */ "qtime", + /* 226 */ "users", + /* 227 */ "conns", + /* 228 */ "state", + /* 229 */ "keep", + /* 230 */ "tagitemlist", + /* 231 */ "cache", + /* 232 */ "replica", + /* 233 */ "quorum", + /* 234 */ "days", + /* 235 */ "minrows", + /* 236 */ "maxrows", + /* 237 */ "blocks", + /* 238 */ "ctime", + /* 239 */ "wal", + /* 240 */ "fsync", + /* 241 */ "comp", + /* 242 */ "prec", + /* 243 */ "update", + /* 244 */ "cachelast", + /* 245 */ "typename", + /* 246 */ "signed", + /* 247 */ "create_table_args", + /* 248 */ "create_table_list", + /* 249 */ "create_from_stable", + /* 250 */ "columnlist", + /* 251 */ "select", + /* 252 */ "column", + /* 253 */ "tagitem", + /* 254 */ "selcollist", + /* 255 */ "from", + /* 256 */ "where_opt", + /* 257 */ "interval_opt", + /* 258 */ "fill_opt", + /* 259 */ "sliding_opt", + /* 260 */ "groupby_opt", + /* 261 */ "orderby_opt", + /* 262 */ "having_opt", + /* 263 */ "slimit_opt", + /* 264 */ "limit_opt", + /* 265 */ "union", + /* 266 */ "sclp", + /* 267 */ "expr", + /* 268 */ "as", + /* 269 */ "tablelist", + /* 270 */ "tmvar", + /* 271 */ "sortlist", + /* 272 */ "sortitem", + /* 273 */ "item", + /* 274 */ "sortorder", + /* 275 */ "grouplist", + /* 276 */ "exprlist", + /* 277 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1137,130 +1139,131 @@ static const char *const yyRuleName[] = { /* 112 */ "alter_db_optr ::= alter_db_optr cachelast", /* 113 */ "typename ::= ids", /* 114 */ "typename ::= ids LP signed RP", - /* 115 */ "signed ::= INTEGER", - /* 116 */ "signed ::= PLUS INTEGER", - /* 117 */ "signed ::= MINUS INTEGER", - /* 118 */ "cmd ::= CREATE TABLE create_table_args", - /* 119 */ "cmd ::= CREATE TABLE create_table_list", - /* 120 */ "create_table_list ::= create_from_stable", - /* 121 */ "create_table_list ::= create_table_list create_from_stable", - /* 122 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", - /* 123 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", - /* 124 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", - /* 125 */ "create_table_args ::= ifnotexists ids cpxName AS select", - /* 126 */ "columnlist ::= columnlist COMMA column", - /* 127 */ "columnlist ::= column", - /* 128 */ "column ::= ids typename", - /* 129 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 130 */ "tagitemlist ::= tagitem", - /* 131 */ "tagitem ::= INTEGER", - /* 132 */ "tagitem ::= FLOAT", - /* 133 */ "tagitem ::= STRING", - /* 134 */ "tagitem ::= BOOL", - /* 135 */ "tagitem ::= NULL", - /* 136 */ "tagitem ::= MINUS INTEGER", - /* 137 */ "tagitem ::= MINUS FLOAT", - /* 138 */ "tagitem ::= PLUS INTEGER", - /* 139 */ "tagitem ::= PLUS FLOAT", - /* 140 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", - /* 141 */ "union ::= select", - /* 142 */ "union ::= LP union RP", - /* 143 */ "union ::= union UNION ALL select", - /* 144 */ "union ::= union UNION ALL LP select RP", - /* 145 */ "cmd ::= union", - /* 146 */ "select ::= SELECT selcollist", - /* 147 */ "sclp ::= selcollist COMMA", - /* 148 */ "sclp ::=", - /* 149 */ "selcollist ::= sclp expr as", - /* 150 */ "selcollist ::= sclp STAR", - /* 151 */ "as ::= AS ids", - /* 152 */ "as ::= ids", - /* 153 */ "as ::=", - /* 154 */ "from ::= FROM tablelist", - /* 155 */ "tablelist ::= ids cpxName", - /* 156 */ "tablelist ::= ids cpxName ids", - /* 157 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 158 */ "tablelist ::= tablelist COMMA ids cpxName ids", - /* 159 */ "tmvar ::= VARIABLE", - /* 160 */ "interval_opt ::= INTERVAL LP tmvar RP", - /* 161 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", - /* 162 */ "interval_opt ::=", - /* 163 */ "fill_opt ::=", - /* 164 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 165 */ "fill_opt ::= FILL LP ID RP", - /* 166 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 167 */ "sliding_opt ::=", - /* 168 */ "orderby_opt ::=", - /* 169 */ "orderby_opt ::= ORDER BY sortlist", - /* 170 */ "sortlist ::= sortlist COMMA item sortorder", - /* 171 */ "sortlist ::= item sortorder", - /* 172 */ "item ::= ids cpxName", - /* 173 */ "sortorder ::= ASC", - /* 174 */ "sortorder ::= DESC", - /* 175 */ "sortorder ::=", - /* 176 */ "groupby_opt ::=", - /* 177 */ "groupby_opt ::= GROUP BY grouplist", - /* 178 */ "grouplist ::= grouplist COMMA item", - /* 179 */ "grouplist ::= item", - /* 180 */ "having_opt ::=", - /* 181 */ "having_opt ::= HAVING expr", - /* 182 */ "limit_opt ::=", - /* 183 */ "limit_opt ::= LIMIT signed", - /* 184 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 185 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 186 */ "slimit_opt ::=", - /* 187 */ "slimit_opt ::= SLIMIT signed", - /* 188 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 189 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 190 */ "where_opt ::=", - /* 191 */ "where_opt ::= WHERE expr", - /* 192 */ "expr ::= LP expr RP", - /* 193 */ "expr ::= ID", - /* 194 */ "expr ::= ID DOT ID", - /* 195 */ "expr ::= ID DOT STAR", - /* 196 */ "expr ::= INTEGER", - /* 197 */ "expr ::= MINUS INTEGER", - /* 198 */ "expr ::= PLUS INTEGER", - /* 199 */ "expr ::= FLOAT", - /* 200 */ "expr ::= MINUS FLOAT", - /* 201 */ "expr ::= PLUS FLOAT", - /* 202 */ "expr ::= STRING", - /* 203 */ "expr ::= NOW", - /* 204 */ "expr ::= VARIABLE", - /* 205 */ "expr ::= BOOL", - /* 206 */ "expr ::= ID LP exprlist RP", - /* 207 */ "expr ::= ID LP STAR RP", - /* 208 */ "expr ::= expr IS NULL", - /* 209 */ "expr ::= expr IS NOT NULL", - /* 210 */ "expr ::= expr LT expr", - /* 211 */ "expr ::= expr GT expr", - /* 212 */ "expr ::= expr LE expr", - /* 213 */ "expr ::= expr GE expr", - /* 214 */ "expr ::= expr NE expr", - /* 215 */ "expr ::= expr EQ expr", - /* 216 */ "expr ::= expr AND expr", - /* 217 */ "expr ::= expr OR expr", - /* 218 */ "expr ::= expr PLUS expr", - /* 219 */ "expr ::= expr MINUS expr", - /* 220 */ "expr ::= expr STAR expr", - /* 221 */ "expr ::= expr SLASH expr", - /* 222 */ "expr ::= expr REM expr", - /* 223 */ "expr ::= expr LIKE expr", - /* 224 */ "expr ::= expr IN LP exprlist RP", - /* 225 */ "exprlist ::= exprlist COMMA expritem", - /* 226 */ "exprlist ::= expritem", - /* 227 */ "expritem ::= expr", - /* 228 */ "expritem ::=", - /* 229 */ "cmd ::= RESET QUERY CACHE", - /* 230 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 231 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 232 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 233 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 234 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 235 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 236 */ "cmd ::= KILL CONNECTION INTEGER", - /* 237 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 238 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 115 */ "typename ::= ids UNSIGNED", + /* 116 */ "signed ::= INTEGER", + /* 117 */ "signed ::= PLUS INTEGER", + /* 118 */ "signed ::= MINUS INTEGER", + /* 119 */ "cmd ::= CREATE TABLE create_table_args", + /* 120 */ "cmd ::= CREATE TABLE create_table_list", + /* 121 */ "create_table_list ::= create_from_stable", + /* 122 */ "create_table_list ::= create_table_list create_from_stable", + /* 123 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", + /* 124 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", + /* 125 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP", + /* 126 */ "create_table_args ::= ifnotexists ids cpxName AS select", + /* 127 */ "columnlist ::= columnlist COMMA column", + /* 128 */ "columnlist ::= column", + /* 129 */ "column ::= ids typename", + /* 130 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 131 */ "tagitemlist ::= tagitem", + /* 132 */ "tagitem ::= INTEGER", + /* 133 */ "tagitem ::= FLOAT", + /* 134 */ "tagitem ::= STRING", + /* 135 */ "tagitem ::= BOOL", + /* 136 */ "tagitem ::= NULL", + /* 137 */ "tagitem ::= MINUS INTEGER", + /* 138 */ "tagitem ::= MINUS FLOAT", + /* 139 */ "tagitem ::= PLUS INTEGER", + /* 140 */ "tagitem ::= PLUS FLOAT", + /* 141 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", + /* 142 */ "union ::= select", + /* 143 */ "union ::= LP union RP", + /* 144 */ "union ::= union UNION ALL select", + /* 145 */ "union ::= union UNION ALL LP select RP", + /* 146 */ "cmd ::= union", + /* 147 */ "select ::= SELECT selcollist", + /* 148 */ "sclp ::= selcollist COMMA", + /* 149 */ "sclp ::=", + /* 150 */ "selcollist ::= sclp expr as", + /* 151 */ "selcollist ::= sclp STAR", + /* 152 */ "as ::= AS ids", + /* 153 */ "as ::= ids", + /* 154 */ "as ::=", + /* 155 */ "from ::= FROM tablelist", + /* 156 */ "tablelist ::= ids cpxName", + /* 157 */ "tablelist ::= ids cpxName ids", + /* 158 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 159 */ "tablelist ::= tablelist COMMA ids cpxName ids", + /* 160 */ "tmvar ::= VARIABLE", + /* 161 */ "interval_opt ::= INTERVAL LP tmvar RP", + /* 162 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP", + /* 163 */ "interval_opt ::=", + /* 164 */ "fill_opt ::=", + /* 165 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 166 */ "fill_opt ::= FILL LP ID RP", + /* 167 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 168 */ "sliding_opt ::=", + /* 169 */ "orderby_opt ::=", + /* 170 */ "orderby_opt ::= ORDER BY sortlist", + /* 171 */ "sortlist ::= sortlist COMMA item sortorder", + /* 172 */ "sortlist ::= item sortorder", + /* 173 */ "item ::= ids cpxName", + /* 174 */ "sortorder ::= ASC", + /* 175 */ "sortorder ::= DESC", + /* 176 */ "sortorder ::=", + /* 177 */ "groupby_opt ::=", + /* 178 */ "groupby_opt ::= GROUP BY grouplist", + /* 179 */ "grouplist ::= grouplist COMMA item", + /* 180 */ "grouplist ::= item", + /* 181 */ "having_opt ::=", + /* 182 */ "having_opt ::= HAVING expr", + /* 183 */ "limit_opt ::=", + /* 184 */ "limit_opt ::= LIMIT signed", + /* 185 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 186 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 187 */ "slimit_opt ::=", + /* 188 */ "slimit_opt ::= SLIMIT signed", + /* 189 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 190 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 191 */ "where_opt ::=", + /* 192 */ "where_opt ::= WHERE expr", + /* 193 */ "expr ::= LP expr RP", + /* 194 */ "expr ::= ID", + /* 195 */ "expr ::= ID DOT ID", + /* 196 */ "expr ::= ID DOT STAR", + /* 197 */ "expr ::= INTEGER", + /* 198 */ "expr ::= MINUS INTEGER", + /* 199 */ "expr ::= PLUS INTEGER", + /* 200 */ "expr ::= FLOAT", + /* 201 */ "expr ::= MINUS FLOAT", + /* 202 */ "expr ::= PLUS FLOAT", + /* 203 */ "expr ::= STRING", + /* 204 */ "expr ::= NOW", + /* 205 */ "expr ::= VARIABLE", + /* 206 */ "expr ::= BOOL", + /* 207 */ "expr ::= ID LP exprlist RP", + /* 208 */ "expr ::= ID LP STAR RP", + /* 209 */ "expr ::= expr IS NULL", + /* 210 */ "expr ::= expr IS NOT NULL", + /* 211 */ "expr ::= expr LT expr", + /* 212 */ "expr ::= expr GT expr", + /* 213 */ "expr ::= expr LE expr", + /* 214 */ "expr ::= expr GE expr", + /* 215 */ "expr ::= expr NE expr", + /* 216 */ "expr ::= expr EQ expr", + /* 217 */ "expr ::= expr AND expr", + /* 218 */ "expr ::= expr OR expr", + /* 219 */ "expr ::= expr PLUS expr", + /* 220 */ "expr ::= expr MINUS expr", + /* 221 */ "expr ::= expr STAR expr", + /* 222 */ "expr ::= expr SLASH expr", + /* 223 */ "expr ::= expr REM expr", + /* 224 */ "expr ::= expr LIKE expr", + /* 225 */ "expr ::= expr IN LP exprlist RP", + /* 226 */ "exprlist ::= exprlist COMMA expritem", + /* 227 */ "exprlist ::= expritem", + /* 228 */ "expritem ::= expr", + /* 229 */ "expritem ::=", + /* 230 */ "cmd ::= RESET QUERY CACHE", + /* 231 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 232 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 233 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 234 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 235 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 236 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 237 */ "cmd ::= KILL CONNECTION INTEGER", + /* 238 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 239 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1381,51 +1384,51 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 228: /* keep */ - case 229: /* tagitemlist */ - case 249: /* columnlist */ - case 257: /* fill_opt */ - case 259: /* groupby_opt */ - case 260: /* orderby_opt */ - case 270: /* sortlist */ - case 274: /* grouplist */ + case 229: /* keep */ + case 230: /* tagitemlist */ + case 250: /* columnlist */ + case 258: /* fill_opt */ + case 260: /* groupby_opt */ + case 261: /* orderby_opt */ + case 271: /* sortlist */ + case 275: /* grouplist */ { -taosArrayDestroy((yypminor->yy403)); +taosArrayDestroy((yypminor->yy421)); } break; - case 247: /* create_table_list */ + case 248: /* create_table_list */ { -destroyCreateTableSql((yypminor->yy436)); +destroyCreateTableSql((yypminor->yy38)); } break; - case 250: /* select */ + case 251: /* select */ { -doDestroyQuerySql((yypminor->yy4)); +doDestroyQuerySql((yypminor->yy148)); } break; - case 253: /* selcollist */ - case 265: /* sclp */ - case 275: /* exprlist */ + case 254: /* selcollist */ + case 266: /* sclp */ + case 276: /* exprlist */ { -tSqlExprListDestroy((yypminor->yy382)); +tSqlExprListDestroy((yypminor->yy166)); } break; - case 255: /* where_opt */ - case 261: /* having_opt */ - case 266: /* expr */ - case 276: /* expritem */ + case 256: /* where_opt */ + case 262: /* having_opt */ + case 267: /* expr */ + case 277: /* expritem */ { -tSqlExprDestroy((yypminor->yy522)); +tSqlExprDestroy((yypminor->yy78)); } break; - case 264: /* union */ + case 265: /* union */ { -destroyAllSelectClause((yypminor->yy13)); +destroyAllSelectClause((yypminor->yy153)); } break; - case 271: /* sortitem */ + case 272: /* sortitem */ { -tVariantDestroy(&(yypminor->yy488)); +tVariantDestroy(&(yypminor->yy430)); } break; /********* End destructor definitions *****************************************/ @@ -1719,245 +1722,246 @@ 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[] = { - { 209, -1 }, /* (0) program ::= cmd */ - { 210, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 210, -2 }, /* (2) cmd ::= SHOW MNODES */ - { 210, -2 }, /* (3) cmd ::= SHOW DNODES */ - { 210, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ - { 210, -2 }, /* (5) cmd ::= SHOW USERS */ - { 210, -2 }, /* (6) cmd ::= SHOW MODULES */ - { 210, -2 }, /* (7) cmd ::= SHOW QUERIES */ - { 210, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ - { 210, -2 }, /* (9) cmd ::= SHOW STREAMS */ - { 210, -2 }, /* (10) cmd ::= SHOW VARIABLES */ - { 210, -2 }, /* (11) cmd ::= SHOW SCORES */ - { 210, -2 }, /* (12) cmd ::= SHOW GRANTS */ - { 210, -2 }, /* (13) cmd ::= SHOW VNODES */ - { 210, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - { 211, 0 }, /* (15) dbPrefix ::= */ - { 211, -2 }, /* (16) dbPrefix ::= ids DOT */ - { 213, 0 }, /* (17) cpxName ::= */ - { 213, -2 }, /* (18) cpxName ::= DOT ids */ - { 210, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ - { 210, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ - { 210, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ - { 210, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 210, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ - { 210, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 210, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ - { 210, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 210, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ - { 210, -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */ - { 210, -3 }, /* (29) cmd ::= DROP DNODE ids */ - { 210, -3 }, /* (30) cmd ::= DROP USER ids */ - { 210, -3 }, /* (31) cmd ::= DROP ACCOUNT ids */ - { 210, -2 }, /* (32) cmd ::= USE ids */ - { 210, -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */ - { 210, -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */ - { 210, -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 210, -4 }, /* (36) cmd ::= ALTER DNODE ids ids */ - { 210, -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */ - { 210, -3 }, /* (38) cmd ::= ALTER LOCAL ids */ - { 210, -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */ - { 210, -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 210, -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 210, -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 212, -1 }, /* (43) ids ::= ID */ - { 212, -1 }, /* (44) ids ::= STRING */ - { 214, -2 }, /* (45) ifexists ::= IF EXISTS */ - { 214, 0 }, /* (46) ifexists ::= */ - { 217, -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */ - { 217, 0 }, /* (48) ifnotexists ::= */ - { 210, -3 }, /* (49) cmd ::= CREATE DNODE ids */ - { 210, -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 210, -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 210, -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */ - { 219, 0 }, /* (53) pps ::= */ - { 219, -2 }, /* (54) pps ::= PPS INTEGER */ - { 220, 0 }, /* (55) tseries ::= */ - { 220, -2 }, /* (56) tseries ::= TSERIES INTEGER */ - { 221, 0 }, /* (57) dbs ::= */ - { 221, -2 }, /* (58) dbs ::= DBS INTEGER */ - { 222, 0 }, /* (59) streams ::= */ - { 222, -2 }, /* (60) streams ::= STREAMS INTEGER */ - { 223, 0 }, /* (61) storage ::= */ - { 223, -2 }, /* (62) storage ::= STORAGE INTEGER */ - { 224, 0 }, /* (63) qtime ::= */ - { 224, -2 }, /* (64) qtime ::= QTIME INTEGER */ - { 225, 0 }, /* (65) users ::= */ - { 225, -2 }, /* (66) users ::= USERS INTEGER */ - { 226, 0 }, /* (67) conns ::= */ - { 226, -2 }, /* (68) conns ::= CONNS INTEGER */ - { 227, 0 }, /* (69) state ::= */ - { 227, -2 }, /* (70) state ::= STATE ids */ - { 216, -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 228, -2 }, /* (72) keep ::= KEEP tagitemlist */ - { 230, -2 }, /* (73) cache ::= CACHE INTEGER */ - { 231, -2 }, /* (74) replica ::= REPLICA INTEGER */ - { 232, -2 }, /* (75) quorum ::= QUORUM INTEGER */ - { 233, -2 }, /* (76) days ::= DAYS INTEGER */ - { 234, -2 }, /* (77) minrows ::= MINROWS INTEGER */ - { 235, -2 }, /* (78) maxrows ::= MAXROWS INTEGER */ - { 236, -2 }, /* (79) blocks ::= BLOCKS INTEGER */ - { 237, -2 }, /* (80) ctime ::= CTIME INTEGER */ - { 238, -2 }, /* (81) wal ::= WAL INTEGER */ - { 239, -2 }, /* (82) fsync ::= FSYNC INTEGER */ - { 240, -2 }, /* (83) comp ::= COMP INTEGER */ - { 241, -2 }, /* (84) prec ::= PRECISION STRING */ - { 242, -2 }, /* (85) update ::= UPDATE INTEGER */ - { 243, -2 }, /* (86) cachelast ::= CACHELAST INTEGER */ - { 218, 0 }, /* (87) db_optr ::= */ - { 218, -2 }, /* (88) db_optr ::= db_optr cache */ - { 218, -2 }, /* (89) db_optr ::= db_optr replica */ - { 218, -2 }, /* (90) db_optr ::= db_optr quorum */ - { 218, -2 }, /* (91) db_optr ::= db_optr days */ - { 218, -2 }, /* (92) db_optr ::= db_optr minrows */ - { 218, -2 }, /* (93) db_optr ::= db_optr maxrows */ - { 218, -2 }, /* (94) db_optr ::= db_optr blocks */ - { 218, -2 }, /* (95) db_optr ::= db_optr ctime */ - { 218, -2 }, /* (96) db_optr ::= db_optr wal */ - { 218, -2 }, /* (97) db_optr ::= db_optr fsync */ - { 218, -2 }, /* (98) db_optr ::= db_optr comp */ - { 218, -2 }, /* (99) db_optr ::= db_optr prec */ - { 218, -2 }, /* (100) db_optr ::= db_optr keep */ - { 218, -2 }, /* (101) db_optr ::= db_optr update */ - { 218, -2 }, /* (102) db_optr ::= db_optr cachelast */ - { 215, 0 }, /* (103) alter_db_optr ::= */ - { 215, -2 }, /* (104) alter_db_optr ::= alter_db_optr replica */ - { 215, -2 }, /* (105) alter_db_optr ::= alter_db_optr quorum */ - { 215, -2 }, /* (106) alter_db_optr ::= alter_db_optr keep */ - { 215, -2 }, /* (107) alter_db_optr ::= alter_db_optr blocks */ - { 215, -2 }, /* (108) alter_db_optr ::= alter_db_optr comp */ - { 215, -2 }, /* (109) alter_db_optr ::= alter_db_optr wal */ - { 215, -2 }, /* (110) alter_db_optr ::= alter_db_optr fsync */ - { 215, -2 }, /* (111) alter_db_optr ::= alter_db_optr update */ - { 215, -2 }, /* (112) alter_db_optr ::= alter_db_optr cachelast */ - { 244, -1 }, /* (113) typename ::= ids */ - { 244, -4 }, /* (114) typename ::= ids LP signed RP */ - { 245, -1 }, /* (115) signed ::= INTEGER */ - { 245, -2 }, /* (116) signed ::= PLUS INTEGER */ - { 245, -2 }, /* (117) signed ::= MINUS INTEGER */ - { 210, -3 }, /* (118) cmd ::= CREATE TABLE create_table_args */ - { 210, -3 }, /* (119) cmd ::= CREATE TABLE create_table_list */ - { 247, -1 }, /* (120) create_table_list ::= create_from_stable */ - { 247, -2 }, /* (121) create_table_list ::= create_table_list create_from_stable */ - { 246, -6 }, /* (122) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - { 246, -10 }, /* (123) create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - { 248, -10 }, /* (124) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - { 246, -5 }, /* (125) create_table_args ::= ifnotexists ids cpxName AS select */ - { 249, -3 }, /* (126) columnlist ::= columnlist COMMA column */ - { 249, -1 }, /* (127) columnlist ::= column */ - { 251, -2 }, /* (128) column ::= ids typename */ - { 229, -3 }, /* (129) tagitemlist ::= tagitemlist COMMA tagitem */ - { 229, -1 }, /* (130) tagitemlist ::= tagitem */ - { 252, -1 }, /* (131) tagitem ::= INTEGER */ - { 252, -1 }, /* (132) tagitem ::= FLOAT */ - { 252, -1 }, /* (133) tagitem ::= STRING */ - { 252, -1 }, /* (134) tagitem ::= BOOL */ - { 252, -1 }, /* (135) tagitem ::= NULL */ - { 252, -2 }, /* (136) tagitem ::= MINUS INTEGER */ - { 252, -2 }, /* (137) tagitem ::= MINUS FLOAT */ - { 252, -2 }, /* (138) tagitem ::= PLUS INTEGER */ - { 252, -2 }, /* (139) tagitem ::= PLUS FLOAT */ - { 250, -12 }, /* (140) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 264, -1 }, /* (141) union ::= select */ - { 264, -3 }, /* (142) union ::= LP union RP */ - { 264, -4 }, /* (143) union ::= union UNION ALL select */ - { 264, -6 }, /* (144) union ::= union UNION ALL LP select RP */ - { 210, -1 }, /* (145) cmd ::= union */ - { 250, -2 }, /* (146) select ::= SELECT selcollist */ - { 265, -2 }, /* (147) sclp ::= selcollist COMMA */ - { 265, 0 }, /* (148) sclp ::= */ - { 253, -3 }, /* (149) selcollist ::= sclp expr as */ - { 253, -2 }, /* (150) selcollist ::= sclp STAR */ - { 267, -2 }, /* (151) as ::= AS ids */ - { 267, -1 }, /* (152) as ::= ids */ - { 267, 0 }, /* (153) as ::= */ - { 254, -2 }, /* (154) from ::= FROM tablelist */ - { 268, -2 }, /* (155) tablelist ::= ids cpxName */ - { 268, -3 }, /* (156) tablelist ::= ids cpxName ids */ - { 268, -4 }, /* (157) tablelist ::= tablelist COMMA ids cpxName */ - { 268, -5 }, /* (158) tablelist ::= tablelist COMMA ids cpxName ids */ - { 269, -1 }, /* (159) tmvar ::= VARIABLE */ - { 256, -4 }, /* (160) interval_opt ::= INTERVAL LP tmvar RP */ - { 256, -6 }, /* (161) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - { 256, 0 }, /* (162) interval_opt ::= */ - { 257, 0 }, /* (163) fill_opt ::= */ - { 257, -6 }, /* (164) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 257, -4 }, /* (165) fill_opt ::= FILL LP ID RP */ - { 258, -4 }, /* (166) sliding_opt ::= SLIDING LP tmvar RP */ - { 258, 0 }, /* (167) sliding_opt ::= */ - { 260, 0 }, /* (168) orderby_opt ::= */ - { 260, -3 }, /* (169) orderby_opt ::= ORDER BY sortlist */ - { 270, -4 }, /* (170) sortlist ::= sortlist COMMA item sortorder */ - { 270, -2 }, /* (171) sortlist ::= item sortorder */ - { 272, -2 }, /* (172) item ::= ids cpxName */ - { 273, -1 }, /* (173) sortorder ::= ASC */ - { 273, -1 }, /* (174) sortorder ::= DESC */ - { 273, 0 }, /* (175) sortorder ::= */ - { 259, 0 }, /* (176) groupby_opt ::= */ - { 259, -3 }, /* (177) groupby_opt ::= GROUP BY grouplist */ - { 274, -3 }, /* (178) grouplist ::= grouplist COMMA item */ - { 274, -1 }, /* (179) grouplist ::= item */ - { 261, 0 }, /* (180) having_opt ::= */ - { 261, -2 }, /* (181) having_opt ::= HAVING expr */ - { 263, 0 }, /* (182) limit_opt ::= */ - { 263, -2 }, /* (183) limit_opt ::= LIMIT signed */ - { 263, -4 }, /* (184) limit_opt ::= LIMIT signed OFFSET signed */ - { 263, -4 }, /* (185) limit_opt ::= LIMIT signed COMMA signed */ - { 262, 0 }, /* (186) slimit_opt ::= */ - { 262, -2 }, /* (187) slimit_opt ::= SLIMIT signed */ - { 262, -4 }, /* (188) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 262, -4 }, /* (189) slimit_opt ::= SLIMIT signed COMMA signed */ - { 255, 0 }, /* (190) where_opt ::= */ - { 255, -2 }, /* (191) where_opt ::= WHERE expr */ - { 266, -3 }, /* (192) expr ::= LP expr RP */ - { 266, -1 }, /* (193) expr ::= ID */ - { 266, -3 }, /* (194) expr ::= ID DOT ID */ - { 266, -3 }, /* (195) expr ::= ID DOT STAR */ - { 266, -1 }, /* (196) expr ::= INTEGER */ - { 266, -2 }, /* (197) expr ::= MINUS INTEGER */ - { 266, -2 }, /* (198) expr ::= PLUS INTEGER */ - { 266, -1 }, /* (199) expr ::= FLOAT */ - { 266, -2 }, /* (200) expr ::= MINUS FLOAT */ - { 266, -2 }, /* (201) expr ::= PLUS FLOAT */ - { 266, -1 }, /* (202) expr ::= STRING */ - { 266, -1 }, /* (203) expr ::= NOW */ - { 266, -1 }, /* (204) expr ::= VARIABLE */ - { 266, -1 }, /* (205) expr ::= BOOL */ - { 266, -4 }, /* (206) expr ::= ID LP exprlist RP */ - { 266, -4 }, /* (207) expr ::= ID LP STAR RP */ - { 266, -3 }, /* (208) expr ::= expr IS NULL */ - { 266, -4 }, /* (209) expr ::= expr IS NOT NULL */ - { 266, -3 }, /* (210) expr ::= expr LT expr */ - { 266, -3 }, /* (211) expr ::= expr GT expr */ - { 266, -3 }, /* (212) expr ::= expr LE expr */ - { 266, -3 }, /* (213) expr ::= expr GE expr */ - { 266, -3 }, /* (214) expr ::= expr NE expr */ - { 266, -3 }, /* (215) expr ::= expr EQ expr */ - { 266, -3 }, /* (216) expr ::= expr AND expr */ - { 266, -3 }, /* (217) expr ::= expr OR expr */ - { 266, -3 }, /* (218) expr ::= expr PLUS expr */ - { 266, -3 }, /* (219) expr ::= expr MINUS expr */ - { 266, -3 }, /* (220) expr ::= expr STAR expr */ - { 266, -3 }, /* (221) expr ::= expr SLASH expr */ - { 266, -3 }, /* (222) expr ::= expr REM expr */ - { 266, -3 }, /* (223) expr ::= expr LIKE expr */ - { 266, -5 }, /* (224) expr ::= expr IN LP exprlist RP */ - { 275, -3 }, /* (225) exprlist ::= exprlist COMMA expritem */ - { 275, -1 }, /* (226) exprlist ::= expritem */ - { 276, -1 }, /* (227) expritem ::= expr */ - { 276, 0 }, /* (228) expritem ::= */ - { 210, -3 }, /* (229) cmd ::= RESET QUERY CACHE */ - { 210, -7 }, /* (230) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 210, -7 }, /* (231) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 210, -7 }, /* (232) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 210, -7 }, /* (233) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 210, -8 }, /* (234) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 210, -9 }, /* (235) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 210, -3 }, /* (236) cmd ::= KILL CONNECTION INTEGER */ - { 210, -5 }, /* (237) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 210, -5 }, /* (238) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 210, -1 }, /* (0) program ::= cmd */ + { 211, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 211, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 211, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 211, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 211, -2 }, /* (5) cmd ::= SHOW USERS */ + { 211, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 211, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 211, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 211, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 211, -2 }, /* (10) cmd ::= SHOW VARIABLES */ + { 211, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 211, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 211, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 211, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 212, 0 }, /* (15) dbPrefix ::= */ + { 212, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 214, 0 }, /* (17) cpxName ::= */ + { 214, -2 }, /* (18) cpxName ::= DOT ids */ + { 211, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 211, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ + { 211, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ + { 211, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 211, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ + { 211, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 211, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ + { 211, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 211, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ + { 211, -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */ + { 211, -3 }, /* (29) cmd ::= DROP DNODE ids */ + { 211, -3 }, /* (30) cmd ::= DROP USER ids */ + { 211, -3 }, /* (31) cmd ::= DROP ACCOUNT ids */ + { 211, -2 }, /* (32) cmd ::= USE ids */ + { 211, -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */ + { 211, -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */ + { 211, -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 211, -4 }, /* (36) cmd ::= ALTER DNODE ids ids */ + { 211, -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */ + { 211, -3 }, /* (38) cmd ::= ALTER LOCAL ids */ + { 211, -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */ + { 211, -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 211, -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 211, -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 213, -1 }, /* (43) ids ::= ID */ + { 213, -1 }, /* (44) ids ::= STRING */ + { 215, -2 }, /* (45) ifexists ::= IF EXISTS */ + { 215, 0 }, /* (46) ifexists ::= */ + { 218, -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */ + { 218, 0 }, /* (48) ifnotexists ::= */ + { 211, -3 }, /* (49) cmd ::= CREATE DNODE ids */ + { 211, -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 211, -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 211, -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */ + { 220, 0 }, /* (53) pps ::= */ + { 220, -2 }, /* (54) pps ::= PPS INTEGER */ + { 221, 0 }, /* (55) tseries ::= */ + { 221, -2 }, /* (56) tseries ::= TSERIES INTEGER */ + { 222, 0 }, /* (57) dbs ::= */ + { 222, -2 }, /* (58) dbs ::= DBS INTEGER */ + { 223, 0 }, /* (59) streams ::= */ + { 223, -2 }, /* (60) streams ::= STREAMS INTEGER */ + { 224, 0 }, /* (61) storage ::= */ + { 224, -2 }, /* (62) storage ::= STORAGE INTEGER */ + { 225, 0 }, /* (63) qtime ::= */ + { 225, -2 }, /* (64) qtime ::= QTIME INTEGER */ + { 226, 0 }, /* (65) users ::= */ + { 226, -2 }, /* (66) users ::= USERS INTEGER */ + { 227, 0 }, /* (67) conns ::= */ + { 227, -2 }, /* (68) conns ::= CONNS INTEGER */ + { 228, 0 }, /* (69) state ::= */ + { 228, -2 }, /* (70) state ::= STATE ids */ + { 217, -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 229, -2 }, /* (72) keep ::= KEEP tagitemlist */ + { 231, -2 }, /* (73) cache ::= CACHE INTEGER */ + { 232, -2 }, /* (74) replica ::= REPLICA INTEGER */ + { 233, -2 }, /* (75) quorum ::= QUORUM INTEGER */ + { 234, -2 }, /* (76) days ::= DAYS INTEGER */ + { 235, -2 }, /* (77) minrows ::= MINROWS INTEGER */ + { 236, -2 }, /* (78) maxrows ::= MAXROWS INTEGER */ + { 237, -2 }, /* (79) blocks ::= BLOCKS INTEGER */ + { 238, -2 }, /* (80) ctime ::= CTIME INTEGER */ + { 239, -2 }, /* (81) wal ::= WAL INTEGER */ + { 240, -2 }, /* (82) fsync ::= FSYNC INTEGER */ + { 241, -2 }, /* (83) comp ::= COMP INTEGER */ + { 242, -2 }, /* (84) prec ::= PRECISION STRING */ + { 243, -2 }, /* (85) update ::= UPDATE INTEGER */ + { 244, -2 }, /* (86) cachelast ::= CACHELAST INTEGER */ + { 219, 0 }, /* (87) db_optr ::= */ + { 219, -2 }, /* (88) db_optr ::= db_optr cache */ + { 219, -2 }, /* (89) db_optr ::= db_optr replica */ + { 219, -2 }, /* (90) db_optr ::= db_optr quorum */ + { 219, -2 }, /* (91) db_optr ::= db_optr days */ + { 219, -2 }, /* (92) db_optr ::= db_optr minrows */ + { 219, -2 }, /* (93) db_optr ::= db_optr maxrows */ + { 219, -2 }, /* (94) db_optr ::= db_optr blocks */ + { 219, -2 }, /* (95) db_optr ::= db_optr ctime */ + { 219, -2 }, /* (96) db_optr ::= db_optr wal */ + { 219, -2 }, /* (97) db_optr ::= db_optr fsync */ + { 219, -2 }, /* (98) db_optr ::= db_optr comp */ + { 219, -2 }, /* (99) db_optr ::= db_optr prec */ + { 219, -2 }, /* (100) db_optr ::= db_optr keep */ + { 219, -2 }, /* (101) db_optr ::= db_optr update */ + { 219, -2 }, /* (102) db_optr ::= db_optr cachelast */ + { 216, 0 }, /* (103) alter_db_optr ::= */ + { 216, -2 }, /* (104) alter_db_optr ::= alter_db_optr replica */ + { 216, -2 }, /* (105) alter_db_optr ::= alter_db_optr quorum */ + { 216, -2 }, /* (106) alter_db_optr ::= alter_db_optr keep */ + { 216, -2 }, /* (107) alter_db_optr ::= alter_db_optr blocks */ + { 216, -2 }, /* (108) alter_db_optr ::= alter_db_optr comp */ + { 216, -2 }, /* (109) alter_db_optr ::= alter_db_optr wal */ + { 216, -2 }, /* (110) alter_db_optr ::= alter_db_optr fsync */ + { 216, -2 }, /* (111) alter_db_optr ::= alter_db_optr update */ + { 216, -2 }, /* (112) alter_db_optr ::= alter_db_optr cachelast */ + { 245, -1 }, /* (113) typename ::= ids */ + { 245, -4 }, /* (114) typename ::= ids LP signed RP */ + { 245, -2 }, /* (115) typename ::= ids UNSIGNED */ + { 246, -1 }, /* (116) signed ::= INTEGER */ + { 246, -2 }, /* (117) signed ::= PLUS INTEGER */ + { 246, -2 }, /* (118) signed ::= MINUS INTEGER */ + { 211, -3 }, /* (119) cmd ::= CREATE TABLE create_table_args */ + { 211, -3 }, /* (120) cmd ::= CREATE TABLE create_table_list */ + { 248, -1 }, /* (121) create_table_list ::= create_from_stable */ + { 248, -2 }, /* (122) create_table_list ::= create_table_list create_from_stable */ + { 247, -6 }, /* (123) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 247, -10 }, /* (124) create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 249, -10 }, /* (125) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + { 247, -5 }, /* (126) create_table_args ::= ifnotexists ids cpxName AS select */ + { 250, -3 }, /* (127) columnlist ::= columnlist COMMA column */ + { 250, -1 }, /* (128) columnlist ::= column */ + { 252, -2 }, /* (129) column ::= ids typename */ + { 230, -3 }, /* (130) tagitemlist ::= tagitemlist COMMA tagitem */ + { 230, -1 }, /* (131) tagitemlist ::= tagitem */ + { 253, -1 }, /* (132) tagitem ::= INTEGER */ + { 253, -1 }, /* (133) tagitem ::= FLOAT */ + { 253, -1 }, /* (134) tagitem ::= STRING */ + { 253, -1 }, /* (135) tagitem ::= BOOL */ + { 253, -1 }, /* (136) tagitem ::= NULL */ + { 253, -2 }, /* (137) tagitem ::= MINUS INTEGER */ + { 253, -2 }, /* (138) tagitem ::= MINUS FLOAT */ + { 253, -2 }, /* (139) tagitem ::= PLUS INTEGER */ + { 253, -2 }, /* (140) tagitem ::= PLUS FLOAT */ + { 251, -12 }, /* (141) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 265, -1 }, /* (142) union ::= select */ + { 265, -3 }, /* (143) union ::= LP union RP */ + { 265, -4 }, /* (144) union ::= union UNION ALL select */ + { 265, -6 }, /* (145) union ::= union UNION ALL LP select RP */ + { 211, -1 }, /* (146) cmd ::= union */ + { 251, -2 }, /* (147) select ::= SELECT selcollist */ + { 266, -2 }, /* (148) sclp ::= selcollist COMMA */ + { 266, 0 }, /* (149) sclp ::= */ + { 254, -3 }, /* (150) selcollist ::= sclp expr as */ + { 254, -2 }, /* (151) selcollist ::= sclp STAR */ + { 268, -2 }, /* (152) as ::= AS ids */ + { 268, -1 }, /* (153) as ::= ids */ + { 268, 0 }, /* (154) as ::= */ + { 255, -2 }, /* (155) from ::= FROM tablelist */ + { 269, -2 }, /* (156) tablelist ::= ids cpxName */ + { 269, -3 }, /* (157) tablelist ::= ids cpxName ids */ + { 269, -4 }, /* (158) tablelist ::= tablelist COMMA ids cpxName */ + { 269, -5 }, /* (159) tablelist ::= tablelist COMMA ids cpxName ids */ + { 270, -1 }, /* (160) tmvar ::= VARIABLE */ + { 257, -4 }, /* (161) interval_opt ::= INTERVAL LP tmvar RP */ + { 257, -6 }, /* (162) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 257, 0 }, /* (163) interval_opt ::= */ + { 258, 0 }, /* (164) fill_opt ::= */ + { 258, -6 }, /* (165) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 258, -4 }, /* (166) fill_opt ::= FILL LP ID RP */ + { 259, -4 }, /* (167) sliding_opt ::= SLIDING LP tmvar RP */ + { 259, 0 }, /* (168) sliding_opt ::= */ + { 261, 0 }, /* (169) orderby_opt ::= */ + { 261, -3 }, /* (170) orderby_opt ::= ORDER BY sortlist */ + { 271, -4 }, /* (171) sortlist ::= sortlist COMMA item sortorder */ + { 271, -2 }, /* (172) sortlist ::= item sortorder */ + { 273, -2 }, /* (173) item ::= ids cpxName */ + { 274, -1 }, /* (174) sortorder ::= ASC */ + { 274, -1 }, /* (175) sortorder ::= DESC */ + { 274, 0 }, /* (176) sortorder ::= */ + { 260, 0 }, /* (177) groupby_opt ::= */ + { 260, -3 }, /* (178) groupby_opt ::= GROUP BY grouplist */ + { 275, -3 }, /* (179) grouplist ::= grouplist COMMA item */ + { 275, -1 }, /* (180) grouplist ::= item */ + { 262, 0 }, /* (181) having_opt ::= */ + { 262, -2 }, /* (182) having_opt ::= HAVING expr */ + { 264, 0 }, /* (183) limit_opt ::= */ + { 264, -2 }, /* (184) limit_opt ::= LIMIT signed */ + { 264, -4 }, /* (185) limit_opt ::= LIMIT signed OFFSET signed */ + { 264, -4 }, /* (186) limit_opt ::= LIMIT signed COMMA signed */ + { 263, 0 }, /* (187) slimit_opt ::= */ + { 263, -2 }, /* (188) slimit_opt ::= SLIMIT signed */ + { 263, -4 }, /* (189) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 263, -4 }, /* (190) slimit_opt ::= SLIMIT signed COMMA signed */ + { 256, 0 }, /* (191) where_opt ::= */ + { 256, -2 }, /* (192) where_opt ::= WHERE expr */ + { 267, -3 }, /* (193) expr ::= LP expr RP */ + { 267, -1 }, /* (194) expr ::= ID */ + { 267, -3 }, /* (195) expr ::= ID DOT ID */ + { 267, -3 }, /* (196) expr ::= ID DOT STAR */ + { 267, -1 }, /* (197) expr ::= INTEGER */ + { 267, -2 }, /* (198) expr ::= MINUS INTEGER */ + { 267, -2 }, /* (199) expr ::= PLUS INTEGER */ + { 267, -1 }, /* (200) expr ::= FLOAT */ + { 267, -2 }, /* (201) expr ::= MINUS FLOAT */ + { 267, -2 }, /* (202) expr ::= PLUS FLOAT */ + { 267, -1 }, /* (203) expr ::= STRING */ + { 267, -1 }, /* (204) expr ::= NOW */ + { 267, -1 }, /* (205) expr ::= VARIABLE */ + { 267, -1 }, /* (206) expr ::= BOOL */ + { 267, -4 }, /* (207) expr ::= ID LP exprlist RP */ + { 267, -4 }, /* (208) expr ::= ID LP STAR RP */ + { 267, -3 }, /* (209) expr ::= expr IS NULL */ + { 267, -4 }, /* (210) expr ::= expr IS NOT NULL */ + { 267, -3 }, /* (211) expr ::= expr LT expr */ + { 267, -3 }, /* (212) expr ::= expr GT expr */ + { 267, -3 }, /* (213) expr ::= expr LE expr */ + { 267, -3 }, /* (214) expr ::= expr GE expr */ + { 267, -3 }, /* (215) expr ::= expr NE expr */ + { 267, -3 }, /* (216) expr ::= expr EQ expr */ + { 267, -3 }, /* (217) expr ::= expr AND expr */ + { 267, -3 }, /* (218) expr ::= expr OR expr */ + { 267, -3 }, /* (219) expr ::= expr PLUS expr */ + { 267, -3 }, /* (220) expr ::= expr MINUS expr */ + { 267, -3 }, /* (221) expr ::= expr STAR expr */ + { 267, -3 }, /* (222) expr ::= expr SLASH expr */ + { 267, -3 }, /* (223) expr ::= expr REM expr */ + { 267, -3 }, /* (224) expr ::= expr LIKE expr */ + { 267, -5 }, /* (225) expr ::= expr IN LP exprlist RP */ + { 276, -3 }, /* (226) exprlist ::= exprlist COMMA expritem */ + { 276, -1 }, /* (227) exprlist ::= expritem */ + { 277, -1 }, /* (228) expritem ::= expr */ + { 277, 0 }, /* (229) expritem ::= */ + { 211, -3 }, /* (230) cmd ::= RESET QUERY CACHE */ + { 211, -7 }, /* (231) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 211, -7 }, /* (232) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 211, -7 }, /* (233) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 211, -7 }, /* (234) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 211, -8 }, /* (235) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 211, -9 }, /* (236) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 211, -3 }, /* (237) cmd ::= KILL CONNECTION INTEGER */ + { 211, -5 }, /* (238) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 211, -5 }, /* (239) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2038,7 +2042,7 @@ static void yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* program ::= cmd */ - case 118: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==118); + case 119: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==119); {} break; case 1: /* cmd ::= SHOW DATABASES */ @@ -2189,13 +2193,13 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 40: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &t);} +{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &t);} break; case 41: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy463);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy71);} break; case 42: /* 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.yy463);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);} break; case 43: /* ids ::= ID */ case 44: /* ids ::= STRING */ yytestcase(yyruleno==44); @@ -2216,10 +2220,10 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 50: /* 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.yy463);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);} break; case 51: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy478, &yymsp[-2].minor.yy0);} +{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &yymsp[-2].minor.yy0);} break; case 52: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2248,20 +2252,20 @@ static void yy_reduce( break; case 71: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy463.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy463.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy463.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy463.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy463.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy463.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy463.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy463.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy463.stat = yymsp[0].minor.yy0; + yylhsminor.yy71.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy71.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy71.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy71.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy71.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy71.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy71.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy71.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy71.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy463 = yylhsminor.yy463; + yymsp[-8].minor.yy71 = yylhsminor.yy71; break; case 72: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy403 = yymsp[0].minor.yy403; } +{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; } break; case 73: /* cache ::= CACHE INTEGER */ case 74: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==74); @@ -2280,584 +2284,592 @@ static void yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 87: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy478);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy234);} break; case 88: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 89: /* db_optr ::= db_optr replica */ case 104: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==104); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 90: /* db_optr ::= db_optr quorum */ case 105: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==105); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 91: /* db_optr ::= db_optr days */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 92: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 93: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 94: /* db_optr ::= db_optr blocks */ case 107: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==107); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 95: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 96: /* db_optr ::= db_optr wal */ case 109: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==109); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 97: /* db_optr ::= db_optr fsync */ case 110: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==110); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 98: /* db_optr ::= db_optr comp */ case 108: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==108); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 99: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 100: /* db_optr ::= db_optr keep */ case 106: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==106); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.keep = yymsp[0].minor.yy403; } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.keep = yymsp[0].minor.yy421; } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 101: /* db_optr ::= db_optr update */ case 111: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==111); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 102: /* db_optr ::= db_optr cachelast */ case 112: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==112); -{ yylhsminor.yy478 = yymsp[-1].minor.yy478; yylhsminor.yy478.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy478 = yylhsminor.yy478; +{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy234 = yylhsminor.yy234; break; case 103: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy478);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy234);} break; case 113: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSqlSetColumnType (&yylhsminor.yy363, &yymsp[0].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy183, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy363 = yylhsminor.yy363; + yymsp[0].minor.yy183 = yylhsminor.yy183; break; case 114: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy387 <= 0) { + if (yymsp[-1].minor.yy325 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSqlSetColumnType(&yylhsminor.yy363, &yymsp[-3].minor.yy0); + tSqlSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy387; // negative value of name length - tSqlSetColumnType(&yylhsminor.yy363, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy325; // negative value of name length + tSqlSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy363 = yylhsminor.yy363; + yymsp[-3].minor.yy183 = yylhsminor.yy183; break; - case 115: /* signed ::= INTEGER */ -{ yylhsminor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy387 = yylhsminor.yy387; + case 115: /* typename ::= ids UNSIGNED */ +{ + yymsp[-1].minor.yy0.type = 0; + yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); + tSqlSetColumnType (&yylhsminor.yy183, &yymsp[-1].minor.yy0); +} + yymsp[-1].minor.yy183 = yylhsminor.yy183; break; - case 116: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy387 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 116: /* signed ::= INTEGER */ +{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy325 = yylhsminor.yy325; break; - case 117: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy387 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} + case 117: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 119: /* cmd ::= CREATE TABLE create_table_list */ -{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy436;} + case 118: /* signed ::= MINUS INTEGER */ +{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; - case 120: /* create_table_list ::= create_from_stable */ + case 120: /* cmd ::= CREATE TABLE create_table_list */ +{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy38;} + break; + case 121: /* create_table_list ::= create_from_stable */ { SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy84); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy152); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; - yylhsminor.yy436 = pCreateTable; + yylhsminor.yy38 = pCreateTable; } - yymsp[0].minor.yy436 = yylhsminor.yy436; + yymsp[0].minor.yy38 = yylhsminor.yy38; break; - case 121: /* create_table_list ::= create_table_list create_from_stable */ + case 122: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy436->childTableInfo, &yymsp[0].minor.yy84); - yylhsminor.yy436 = yymsp[-1].minor.yy436; + taosArrayPush(yymsp[-1].minor.yy38->childTableInfo, &yymsp[0].minor.yy152); + yylhsminor.yy38 = yymsp[-1].minor.yy38; } - yymsp[-1].minor.yy436 = yylhsminor.yy436; + yymsp[-1].minor.yy38 = yylhsminor.yy38; break; - case 122: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + case 123: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy436 = tSetCreateSqlElems(yymsp[-1].minor.yy403, NULL, NULL, TSQL_CREATE_TABLE); - setSqlInfo(pInfo, yylhsminor.yy436, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-1].minor.yy421, NULL, NULL, TSQL_CREATE_TABLE); + setSqlInfo(pInfo, yylhsminor.yy38, 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.yy436 = yylhsminor.yy436; + yymsp[-5].minor.yy38 = yylhsminor.yy38; break; - case 123: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + case 124: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy436 = tSetCreateSqlElems(yymsp[-5].minor.yy403, yymsp[-1].minor.yy403, NULL, TSQL_CREATE_STABLE); - setSqlInfo(pInfo, yylhsminor.yy436, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, TSQL_CREATE_STABLE); + setSqlInfo(pInfo, yylhsminor.yy38, 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.yy436 = yylhsminor.yy436; + yymsp[-9].minor.yy38 = yylhsminor.yy38; break; - case 124: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + case 125: /* 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.yy84 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy403, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy421, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy84 = yylhsminor.yy84; + yymsp[-9].minor.yy152 = yylhsminor.yy152; break; - case 125: /* create_table_args ::= ifnotexists ids cpxName AS select */ + case 126: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy436 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy4, TSQL_CREATE_STREAM); - setSqlInfo(pInfo, yylhsminor.yy436, NULL, TSDB_SQL_CREATE_TABLE); + yylhsminor.yy38 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy148, TSQL_CREATE_STREAM); + setSqlInfo(pInfo, yylhsminor.yy38, 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.yy436 = yylhsminor.yy436; + yymsp[-4].minor.yy38 = yylhsminor.yy38; break; - case 126: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy403, &yymsp[0].minor.yy363); yylhsminor.yy403 = yymsp[-2].minor.yy403; } - yymsp[-2].minor.yy403 = yylhsminor.yy403; + case 127: /* columnlist ::= columnlist COMMA column */ +{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy183); yylhsminor.yy421 = yymsp[-2].minor.yy421; } + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 127: /* columnlist ::= column */ -{yylhsminor.yy403 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy403, &yymsp[0].minor.yy363);} - yymsp[0].minor.yy403 = yylhsminor.yy403; + case 128: /* columnlist ::= column */ +{yylhsminor.yy421 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy183);} + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 128: /* column ::= ids typename */ + case 129: /* column ::= ids typename */ { - tSqlSetColumnInfo(&yylhsminor.yy363, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy363); + tSqlSetColumnInfo(&yylhsminor.yy183, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183); } - yymsp[-1].minor.yy363 = yylhsminor.yy363; + yymsp[-1].minor.yy183 = yylhsminor.yy183; break; - case 129: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1); } - yymsp[-2].minor.yy403 = yylhsminor.yy403; + case 130: /* tagitemlist ::= tagitemlist COMMA tagitem */ +{ yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); } + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 130: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); } - yymsp[0].minor.yy403 = yylhsminor.yy403; + case 131: /* tagitemlist ::= tagitem */ +{ yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); } + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 131: /* tagitem ::= INTEGER */ - case 132: /* tagitem ::= FLOAT */ yytestcase(yyruleno==132); - case 133: /* tagitem ::= STRING */ yytestcase(yyruleno==133); - case 134: /* tagitem ::= BOOL */ yytestcase(yyruleno==134); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 132: /* tagitem ::= INTEGER */ + case 133: /* tagitem ::= FLOAT */ yytestcase(yyruleno==133); + case 134: /* tagitem ::= STRING */ yytestcase(yyruleno==134); + case 135: /* tagitem ::= BOOL */ yytestcase(yyruleno==135); +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy430 = yylhsminor.yy430; break; - case 135: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy488, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 136: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy430 = yylhsminor.yy430; break; - case 136: /* tagitem ::= MINUS INTEGER */ - case 137: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==137); - case 138: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==138); - case 139: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==139); + case 137: /* tagitem ::= MINUS INTEGER */ + case 138: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==138); + case 139: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==139); + case 140: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==140); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy488, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; + yymsp[-1].minor.yy430 = yylhsminor.yy430; break; - case 140: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + case 141: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy4 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy382, yymsp[-9].minor.yy403, yymsp[-8].minor.yy522, yymsp[-4].minor.yy403, yymsp[-3].minor.yy403, &yymsp[-7].minor.yy222, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy403, &yymsp[0].minor.yy404, &yymsp[-1].minor.yy404); + yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy166, yymsp[-9].minor.yy421, yymsp[-8].minor.yy78, yymsp[-4].minor.yy421, yymsp[-3].minor.yy421, &yymsp[-7].minor.yy400, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy421, &yymsp[0].minor.yy167, &yymsp[-1].minor.yy167); } - yymsp[-11].minor.yy4 = yylhsminor.yy4; + yymsp[-11].minor.yy148 = yylhsminor.yy148; break; - case 141: /* union ::= select */ -{ yylhsminor.yy13 = setSubclause(NULL, yymsp[0].minor.yy4); } - yymsp[0].minor.yy13 = yylhsminor.yy13; + case 142: /* union ::= select */ +{ yylhsminor.yy153 = setSubclause(NULL, yymsp[0].minor.yy148); } + yymsp[0].minor.yy153 = yylhsminor.yy153; break; - case 142: /* union ::= LP union RP */ -{ yymsp[-2].minor.yy13 = yymsp[-1].minor.yy13; } + case 143: /* union ::= LP union RP */ +{ yymsp[-2].minor.yy153 = yymsp[-1].minor.yy153; } break; - case 143: /* union ::= union UNION ALL select */ -{ yylhsminor.yy13 = appendSelectClause(yymsp[-3].minor.yy13, yymsp[0].minor.yy4); } - yymsp[-3].minor.yy13 = yylhsminor.yy13; + case 144: /* union ::= union UNION ALL select */ +{ yylhsminor.yy153 = appendSelectClause(yymsp[-3].minor.yy153, yymsp[0].minor.yy148); } + yymsp[-3].minor.yy153 = yylhsminor.yy153; break; - case 144: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy13 = appendSelectClause(yymsp[-5].minor.yy13, yymsp[-1].minor.yy4); } - yymsp[-5].minor.yy13 = yylhsminor.yy13; + case 145: /* union ::= union UNION ALL LP select RP */ +{ yylhsminor.yy153 = appendSelectClause(yymsp[-5].minor.yy153, yymsp[-1].minor.yy148); } + yymsp[-5].minor.yy153 = yylhsminor.yy153; break; - case 145: /* cmd ::= union */ -{ setSqlInfo(pInfo, yymsp[0].minor.yy13, NULL, TSDB_SQL_SELECT); } + case 146: /* cmd ::= union */ +{ setSqlInfo(pInfo, yymsp[0].minor.yy153, NULL, TSDB_SQL_SELECT); } break; - case 146: /* select ::= SELECT selcollist */ + case 147: /* select ::= SELECT selcollist */ { - yylhsminor.yy4 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy382, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy166, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy4 = yylhsminor.yy4; + yymsp[-1].minor.yy148 = yylhsminor.yy148; break; - case 147: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy382 = yymsp[-1].minor.yy382;} - yymsp[-1].minor.yy382 = yylhsminor.yy382; + case 148: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy166 = yymsp[-1].minor.yy166;} + yymsp[-1].minor.yy166 = yylhsminor.yy166; break; - case 148: /* sclp ::= */ -{yymsp[1].minor.yy382 = 0;} + case 149: /* sclp ::= */ +{yymsp[1].minor.yy166 = 0;} break; - case 149: /* selcollist ::= sclp expr as */ + case 150: /* selcollist ::= sclp expr as */ { - yylhsminor.yy382 = tSqlExprListAppend(yymsp[-2].minor.yy382, yymsp[-1].minor.yy522, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166, yymsp[-1].minor.yy78, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-2].minor.yy382 = yylhsminor.yy382; + yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 150: /* selcollist ::= sclp STAR */ + case 151: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSqlExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy382 = tSqlExprListAppend(yymsp[-1].minor.yy382, pNode, 0); + yylhsminor.yy166 = tSqlExprListAppend(yymsp[-1].minor.yy166, pNode, 0); } - yymsp[-1].minor.yy382 = yylhsminor.yy382; + yymsp[-1].minor.yy166 = yylhsminor.yy166; break; - case 151: /* as ::= AS ids */ + case 152: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 152: /* as ::= ids */ + case 153: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 153: /* as ::= */ + case 154: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 154: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy403 = yymsp[0].minor.yy403;} + case 155: /* from ::= FROM tablelist */ +{yymsp[-1].minor.yy421 = yymsp[0].minor.yy421;} break; - case 155: /* tablelist ::= ids cpxName */ + case 156: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy403 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy403 = tVariantListAppendToken(yylhsminor.yy403, &yymsp[-1].minor.yy0, -1); // table alias name + yylhsminor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[-1].minor.yy0, -1); // table alias name } - yymsp[-1].minor.yy403 = yylhsminor.yy403; + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; - case 156: /* tablelist ::= ids cpxName ids */ + case 157: /* tablelist ::= ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy403 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy403 = tVariantListAppendToken(yylhsminor.yy403, &yymsp[0].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[0].minor.yy0, -1); } - yymsp[-2].minor.yy403 = yylhsminor.yy403; + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 157: /* tablelist ::= tablelist COMMA ids cpxName */ + case 158: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy403 = tVariantListAppendToken(yymsp[-3].minor.yy403, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy403 = tVariantListAppendToken(yylhsminor.yy403, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy403 = yylhsminor.yy403; + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; - case 158: /* tablelist ::= tablelist COMMA ids cpxName ids */ + case 159: /* tablelist ::= tablelist COMMA ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy403 = tVariantListAppendToken(yymsp[-4].minor.yy403, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy403 = tVariantListAppendToken(yylhsminor.yy403, &yymsp[0].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yymsp[-4].minor.yy421, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[0].minor.yy0, -1); } - yymsp[-4].minor.yy403 = yylhsminor.yy403; + yymsp[-4].minor.yy421 = yylhsminor.yy421; break; - case 159: /* tmvar ::= VARIABLE */ + case 160: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 160: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy222.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy222.offset.n = 0; yymsp[-3].minor.yy222.offset.z = NULL; yymsp[-3].minor.yy222.offset.type = 0;} + case 161: /* interval_opt ::= INTERVAL LP tmvar RP */ +{yymsp[-3].minor.yy400.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy400.offset.n = 0; yymsp[-3].minor.yy400.offset.z = NULL; yymsp[-3].minor.yy400.offset.type = 0;} break; - case 161: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy222.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy222.offset = yymsp[-1].minor.yy0;} + case 162: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ +{yymsp[-5].minor.yy400.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy400.offset = yymsp[-1].minor.yy0;} break; - case 162: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy222, 0, sizeof(yymsp[1].minor.yy222));} + case 163: /* interval_opt ::= */ +{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));} break; - case 163: /* fill_opt ::= */ -{yymsp[1].minor.yy403 = 0; } + case 164: /* fill_opt ::= */ +{yymsp[1].minor.yy421 = 0; } break; - case 164: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 165: /* 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.yy403, &A, -1, 0); - yymsp[-5].minor.yy403 = yymsp[-1].minor.yy403; + tVariantListInsert(yymsp[-1].minor.yy421, &A, -1, 0); + yymsp[-5].minor.yy421 = yymsp[-1].minor.yy421; } break; - case 165: /* fill_opt ::= FILL LP ID RP */ + case 166: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy403 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 166: /* sliding_opt ::= SLIDING LP tmvar RP */ + case 167: /* sliding_opt ::= SLIDING LP tmvar RP */ {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 167: /* sliding_opt ::= */ + case 168: /* sliding_opt ::= */ {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 168: /* orderby_opt ::= */ -{yymsp[1].minor.yy403 = 0;} + case 169: /* orderby_opt ::= */ +{yymsp[1].minor.yy421 = 0;} break; - case 169: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;} + case 170: /* orderby_opt ::= ORDER BY sortlist */ +{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} break; - case 170: /* sortlist ::= sortlist COMMA item sortorder */ + case 171: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy403 = tVariantListAppend(yymsp[-3].minor.yy403, &yymsp[-1].minor.yy488, yymsp[0].minor.yy70); + yylhsminor.yy421 = tVariantListAppend(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96); } - yymsp[-3].minor.yy403 = yylhsminor.yy403; + yymsp[-3].minor.yy421 = yylhsminor.yy421; break; - case 171: /* sortlist ::= item sortorder */ + case 172: /* sortlist ::= item sortorder */ { - yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[-1].minor.yy488, yymsp[0].minor.yy70); + yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96); } - yymsp[-1].minor.yy403 = yylhsminor.yy403; + yymsp[-1].minor.yy421 = yylhsminor.yy421; break; - case 172: /* item ::= ids cpxName */ + case 173: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy488, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; + yymsp[-1].minor.yy430 = yylhsminor.yy430; break; - case 173: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy70 = TSDB_ORDER_ASC; } + case 174: /* sortorder ::= ASC */ +{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; } break; - case 174: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy70 = TSDB_ORDER_DESC;} + case 175: /* sortorder ::= DESC */ +{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;} break; - case 175: /* sortorder ::= */ -{ yymsp[1].minor.yy70 = TSDB_ORDER_ASC; } + case 176: /* sortorder ::= */ +{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; } break; - case 176: /* groupby_opt ::= */ -{ yymsp[1].minor.yy403 = 0;} + case 177: /* groupby_opt ::= */ +{ yymsp[1].minor.yy421 = 0;} break; - case 177: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy403 = yymsp[0].minor.yy403;} + case 178: /* groupby_opt ::= GROUP BY grouplist */ +{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} break; - case 178: /* grouplist ::= grouplist COMMA item */ + case 179: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy403 = tVariantListAppend(yymsp[-2].minor.yy403, &yymsp[0].minor.yy488, -1); + yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); } - yymsp[-2].minor.yy403 = yylhsminor.yy403; + yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 179: /* grouplist ::= item */ + case 180: /* grouplist ::= item */ { - yylhsminor.yy403 = tVariantListAppend(NULL, &yymsp[0].minor.yy488, -1); + yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); } - yymsp[0].minor.yy403 = yylhsminor.yy403; + yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 180: /* having_opt ::= */ - case 190: /* where_opt ::= */ yytestcase(yyruleno==190); - case 228: /* expritem ::= */ yytestcase(yyruleno==228); -{yymsp[1].minor.yy522 = 0;} + case 181: /* having_opt ::= */ + case 191: /* where_opt ::= */ yytestcase(yyruleno==191); + case 229: /* expritem ::= */ yytestcase(yyruleno==229); +{yymsp[1].minor.yy78 = 0;} break; - case 181: /* having_opt ::= HAVING expr */ - case 191: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==191); -{yymsp[-1].minor.yy522 = yymsp[0].minor.yy522;} + case 182: /* having_opt ::= HAVING expr */ + case 192: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==192); +{yymsp[-1].minor.yy78 = yymsp[0].minor.yy78;} break; - case 182: /* limit_opt ::= */ - case 186: /* slimit_opt ::= */ yytestcase(yyruleno==186); -{yymsp[1].minor.yy404.limit = -1; yymsp[1].minor.yy404.offset = 0;} + case 183: /* limit_opt ::= */ + case 187: /* slimit_opt ::= */ yytestcase(yyruleno==187); +{yymsp[1].minor.yy167.limit = -1; yymsp[1].minor.yy167.offset = 0;} break; - case 183: /* limit_opt ::= LIMIT signed */ - case 187: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==187); -{yymsp[-1].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-1].minor.yy404.offset = 0;} + case 184: /* limit_opt ::= LIMIT signed */ + case 188: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==188); +{yymsp[-1].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy167.offset = 0;} break; - case 184: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;} + case 185: /* limit_opt ::= LIMIT signed OFFSET signed */ +{ yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;} break; - case 185: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;} + case 186: /* limit_opt ::= LIMIT signed COMMA signed */ +{ yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;} break; - case 188: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy404.limit = yymsp[-2].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[0].minor.yy387;} + case 189: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ +{yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;} break; - case 189: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy404.limit = yymsp[0].minor.yy387; yymsp[-3].minor.yy404.offset = yymsp[-2].minor.yy387;} + case 190: /* slimit_opt ::= SLIMIT signed COMMA signed */ +{yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;} break; - case 192: /* expr ::= LP expr RP */ -{yylhsminor.yy522 = yymsp[-1].minor.yy522; yylhsminor.yy522->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy522->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 193: /* expr ::= LP expr RP */ +{yylhsminor.yy78 = yymsp[-1].minor.yy78; yylhsminor.yy78->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy78->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 193: /* expr ::= ID */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 194: /* expr ::= ID */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 194: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 195: /* expr ::= ID DOT ID */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 195: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 196: /* expr ::= ID DOT STAR */ +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 196: /* expr ::= INTEGER */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 197: /* expr ::= INTEGER */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 197: /* expr ::= MINUS INTEGER */ - case 198: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==198); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy522 = yylhsminor.yy522; + case 198: /* expr ::= MINUS INTEGER */ + case 199: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==199); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy78 = yylhsminor.yy78; break; - case 199: /* expr ::= FLOAT */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 200: /* expr ::= FLOAT */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 200: /* expr ::= MINUS FLOAT */ - case 201: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==201); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy522 = yylhsminor.yy522; + case 201: /* expr ::= MINUS FLOAT */ + case 202: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==202); +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy78 = yylhsminor.yy78; break; - case 202: /* expr ::= STRING */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 203: /* expr ::= STRING */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 203: /* expr ::= NOW */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 204: /* expr ::= NOW */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 204: /* expr ::= VARIABLE */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 205: /* expr ::= VARIABLE */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 205: /* expr ::= BOOL */ -{ yylhsminor.yy522 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 206: /* expr ::= BOOL */ +{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 206: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy522 = tSqlExprCreateFunction(yymsp[-1].minor.yy382, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy522 = yylhsminor.yy522; + case 207: /* expr ::= ID LP exprlist RP */ +{ yylhsminor.yy78 = tSqlExprCreateFunction(yymsp[-1].minor.yy166, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy78 = yylhsminor.yy78; break; - case 207: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy522 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy522 = yylhsminor.yy522; + case 208: /* expr ::= ID LP STAR RP */ +{ yylhsminor.yy78 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy78 = yylhsminor.yy78; break; - case 208: /* expr ::= expr IS NULL */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, NULL, TK_ISNULL);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 209: /* expr ::= expr IS NULL */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, NULL, TK_ISNULL);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 209: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-3].minor.yy522, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy522 = yylhsminor.yy522; + case 210: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-3].minor.yy78, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy78 = yylhsminor.yy78; break; - case 210: /* expr ::= expr LT expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_LT);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 211: /* expr ::= expr LT expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LT);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 211: /* expr ::= expr GT expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_GT);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 212: /* expr ::= expr GT expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GT);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 212: /* expr ::= expr LE expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_LE);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 213: /* expr ::= expr LE expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LE);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 213: /* expr ::= expr GE expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_GE);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 214: /* expr ::= expr GE expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GE);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 214: /* expr ::= expr NE expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_NE);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 215: /* expr ::= expr NE expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_NE);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 215: /* expr ::= expr EQ expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_EQ);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 216: /* expr ::= expr EQ expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_EQ);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 216: /* expr ::= expr AND expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_AND);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 217: /* expr ::= expr AND expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_AND);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 217: /* expr ::= expr OR expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_OR); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 218: /* expr ::= expr OR expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_OR); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 218: /* expr ::= expr PLUS expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_PLUS); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 219: /* expr ::= expr PLUS expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_PLUS); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 219: /* expr ::= expr MINUS expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_MINUS); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 220: /* expr ::= expr MINUS expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_MINUS); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 220: /* expr ::= expr STAR expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_STAR); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 221: /* expr ::= expr STAR expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_STAR); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 221: /* expr ::= expr SLASH expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_DIVIDE);} - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 222: /* expr ::= expr SLASH expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_DIVIDE);} + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 222: /* expr ::= expr REM expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_REM); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 223: /* expr ::= expr REM expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_REM); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 223: /* expr ::= expr LIKE expr */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-2].minor.yy522, yymsp[0].minor.yy522, TK_LIKE); } - yymsp[-2].minor.yy522 = yylhsminor.yy522; + case 224: /* expr ::= expr LIKE expr */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LIKE); } + yymsp[-2].minor.yy78 = yylhsminor.yy78; break; - case 224: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy522 = tSqlExprCreate(yymsp[-4].minor.yy522, (tSQLExpr*)yymsp[-1].minor.yy382, TK_IN); } - yymsp[-4].minor.yy522 = yylhsminor.yy522; + case 225: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy78 = tSqlExprCreate(yymsp[-4].minor.yy78, (tSQLExpr*)yymsp[-1].minor.yy166, TK_IN); } + yymsp[-4].minor.yy78 = yylhsminor.yy78; break; - case 225: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy382 = tSqlExprListAppend(yymsp[-2].minor.yy382,yymsp[0].minor.yy522,0);} - yymsp[-2].minor.yy382 = yylhsminor.yy382; + case 226: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166,yymsp[0].minor.yy78,0);} + yymsp[-2].minor.yy166 = yylhsminor.yy166; break; - case 226: /* exprlist ::= expritem */ -{yylhsminor.yy382 = tSqlExprListAppend(0,yymsp[0].minor.yy522,0);} - yymsp[0].minor.yy382 = yylhsminor.yy382; + case 227: /* exprlist ::= expritem */ +{yylhsminor.yy166 = tSqlExprListAppend(0,yymsp[0].minor.yy78,0);} + yymsp[0].minor.yy166 = yylhsminor.yy166; break; - case 227: /* expritem ::= expr */ -{yylhsminor.yy522 = yymsp[0].minor.yy522;} - yymsp[0].minor.yy522 = yylhsminor.yy522; + case 228: /* expritem ::= expr */ +{yylhsminor.yy78 = yymsp[0].minor.yy78;} + yymsp[0].minor.yy78 = yylhsminor.yy78; break; - case 229: /* cmd ::= RESET QUERY CACHE */ + case 230: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 230: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 231: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy403, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 231: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 232: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2868,14 +2880,14 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 232: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 233: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy403, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 233: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 234: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2886,7 +2898,7 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 234: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 235: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -2900,25 +2912,25 @@ static void yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 235: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 236: /* 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.yy488, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy430, -1); SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 236: /* cmd ::= KILL CONNECTION INTEGER */ + case 237: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 237: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 238: /* 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 238: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 239: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/tsdb/src/tsdbRWHelper.c b/src/tsdb/src/tsdbRWHelper.c index 8e57066d27..b53b8ed5b4 100644 --- a/src/tsdb/src/tsdbRWHelper.c +++ b/src/tsdb/src/tsdbRWHelper.c @@ -753,8 +753,8 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa pCompCol->type = pDataCol->type; if (tDataTypeDesc[pDataCol->type].getStatisFunc) { (*tDataTypeDesc[pDataCol->type].getStatisFunc)( - (TSKEY *)(pDataCols->cols[0].pData), pDataCol->pData, rowsToWrite, &(pCompCol->min), &(pCompCol->max), - &(pCompCol->sum), &(pCompCol->minIndex), &(pCompCol->maxIndex), &(pCompCol->numOfNull)); + pDataCol->pData, rowsToWrite, &(pCompCol->min), &(pCompCol->max), &(pCompCol->sum), &(pCompCol->minIndex), + &(pCompCol->maxIndex), &(pCompCol->numOfNull)); } nColsNotAllNull++; } diff --git a/src/util/inc/tstoken.h b/src/util/inc/tstoken.h index e2654f21f4..b36d0017e8 100644 --- a/src/util/inc/tstoken.h +++ b/src/util/inc/tstoken.h @@ -76,7 +76,7 @@ bool isKeyWord(const char *z, int32_t len); * @param pToken * @return token type, if it is not a number, TK_ILLEGAL will return */ -static FORCE_INLINE int32_t isValidNumber(const SStrToken* pToken) { +static FORCE_INLINE int32_t tGetNumericStringType(const SStrToken* pToken) { const char* z = pToken->z; int32_t type = TK_ILLEGAL; @@ -111,7 +111,6 @@ static FORCE_INLINE int32_t isValidNumber(const SStrToken* pToken) { type = TK_FLOAT; goto _end; - break; } case '0': { diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index ff67b1f3ec..de6fbe7302 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -51,7 +51,22 @@ int32_t compareDoubleIntVal(const void *pLeft, const void *pRight) { } int32_t compareFloatVal(const void *pLeft, const void *pRight) { - float ret = GET_FLOAT_VAL(pLeft) - GET_FLOAT_VAL(pRight); + float p1 = GET_FLOAT_VAL(pLeft); + float p2 = GET_FLOAT_VAL(pRight); + + if (isnan(p1) && isnan(p2)) { + return 0; + } + + if (isnan(p1)) { + return -1; + } + + if (isnan(p2)) { + return 1; + } + + float ret = p1 - p2; if (fabs(ret) < FLT_EPSILON) { return 0; } else { @@ -60,7 +75,22 @@ int32_t compareFloatVal(const void *pLeft, const void *pRight) { } int32_t compareDoubleVal(const void *pLeft, const void *pRight) { - double ret = GET_DOUBLE_VAL(pLeft) - GET_DOUBLE_VAL(pRight); + double p1 = GET_DOUBLE_VAL(pLeft); + double p2 = GET_DOUBLE_VAL(pRight); + + if (isnan(p1) && isnan(p2)) { + return 0; + } + + if (isnan(p1)) { + return -1; + } + + if (isnan(p2)) { + return 1; + } + + double ret = p1 - p2; if (fabs(ret) < FLT_EPSILON) { return 0; } else {