From 838e5667ad1b0cfef8805de5181c4fc09f958214 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 22 Nov 2021 18:35:39 +0800 Subject: [PATCH] cast --- src/client/src/tscSQLParser.c | 17 +- src/common/inc/texpr.h | 10 +- src/common/src/texpr.c | 184 +++++- src/inc/ttokendef.h | 2 + src/inc/ttype.h | 36 + src/query/inc/qAggMain.h | 2 +- src/query/inc/qSqlparser.h | 3 + src/query/inc/sql.y | 3 + src/query/src/qAggMain.c | 4 +- src/query/src/qSqlParser.c | 27 + src/query/src/sql.c | 912 +++++++++++++------------- tests/script/general/compute/cast.sim | 479 ++++++++++++++ 12 files changed, 1209 insertions(+), 470 deletions(-) create mode 100644 tests/script/general/compute/cast.sim diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 2bbabbf8a5..75c2551b27 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1781,7 +1781,7 @@ static int32_t handleScalarTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32 } } - ret = exprTreeValidateTree(pNode); + ret = exprTreeValidateTree(tscGetErrorMsgPayload(pCmd), pNode); if (ret != TSDB_CODE_SUCCESS) { taosArrayDestroy(colList); tExprTreeDestroy(pNode, NULL); @@ -1845,7 +1845,7 @@ static int32_t handleAggTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), "invalid expression in select clause"); } - ret = exprTreeValidateTree(pExpr); + ret = exprTreeValidateTree(tscGetErrorMsgPayload(pCmd), pExpr); if (ret != TSDB_CODE_SUCCESS) { tExprTreeDestroy(pExpr, NULL); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); @@ -4455,6 +4455,11 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr, pList->ids[pList->num++] = index; *type = SQLEXPR_TYPE_SCALAR; + } else if (pExpr->type == SQL_NODE_DATA_TYPE) { + if (pExpr->dataType.type < 0 || pExpr->dataType.bytes <= 0) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + *type = SQLEXPR_TYPE_SCALAR; } else { if ((pExpr->tokenId == TK_FLOAT && (isnan(pExpr->value.dKey) || isinf(pExpr->value.dKey))) || pExpr->tokenId == TK_NULL) { @@ -9489,6 +9494,14 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS taosArrayPush(pCols, &colIndex); } + return TSDB_CODE_SUCCESS; + } else if (pSqlExpr->type == SQL_NODE_DATA_TYPE) { + *pExpr = calloc(1, sizeof(tExprNode)); + (*pExpr)->nodeType = TSQL_NODE_TYPE; + (*pExpr)->pType = calloc(1, sizeof(TAOS_FIELD)); + + *(*pExpr)->pType = pSqlExpr->dataType; + return TSDB_CODE_SUCCESS; } else if (pSqlExpr->tokenId == TK_SET) { int32_t colType = -1; diff --git a/src/common/inc/texpr.h b/src/common/inc/texpr.h index d7debbeecd..a669286f22 100644 --- a/src/common/inc/texpr.h +++ b/src/common/inc/texpr.h @@ -62,7 +62,8 @@ struct SSchema; #define TSDB_FUNC_SCALAR_ROUND (TSDB_FUNC_FLAG_SCALAR | 0x000C) #define TSDB_FUNC_SCALAR_CONCAT (TSDB_FUNC_FLAG_SCALAR | 0x000D) #define TSDB_FUNC_SCALAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x000E) -#define TSDB_FUNC_SCALAR_MAX_NUM 15 +#define TSDB_FUNC_SCALAR_CAST (TSDB_FUNC_FLAG_SCALAR | 0x000F) +#define TSDB_FUNC_SCALAR_MAX_NUM 16 #define TSDB_FUNC_SCALAR_NAME_MAX_LEN 16 @@ -95,7 +96,8 @@ enum { TSQL_NODE_EXPR = 0x1, TSQL_NODE_COL = 0x2, TSQL_NODE_VALUE = 0x4, - TSQL_NODE_FUNC = 0x8 + TSQL_NODE_FUNC = 0x8, + TSQL_NODE_TYPE = 0x10 }; /** @@ -129,6 +131,8 @@ typedef struct tExprNode { uint8_t numChildren; struct tExprNode **pChildren; } _func; + + TAOS_FIELD *pType; }; int16_t resultType; int16_t resultBytes; @@ -142,7 +146,7 @@ typedef struct SExprTraverseSupp { void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *)); -int32_t exprTreeValidateTree(tExprNode *pExpr); +int32_t exprTreeValidateTree(char* msgbuf, tExprNode *pExpr); void exprTreeToBinary(SBufferWriter* bw, tExprNode* pExprTree); tExprNode* exprTreeFromBinary(const void* data, size_t size); diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 5a301dbbea..713732f85d 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -31,8 +31,19 @@ static int32_t exprValidateMathNode(tExprNode *pExpr); static int32_t exprValidateStringConcatNode(tExprNode *pExpr); static int32_t exprValidateStringLengthNode(tExprNode *pExpr); +static int32_t exprValidateCastNode(char* msgbuf, tExprNode *pExpr); -int32_t exprTreeValidateFunctionNode(tExprNode *pExpr) { +static int32_t exprInvalidOperationMsg(char *msgbuf, const char *msg) { + const char* msgFormat = "invalid operation: %s"; + + sprintf(msgbuf, msgFormat, msg); + + return TSDB_CODE_TSC_INVALID_OPERATION; +} + + + +int32_t exprTreeValidateFunctionNode(char* msgbuf, tExprNode *pExpr) { int32_t code = TSDB_CODE_SUCCESS; //TODO: check childs for every function switch (pExpr->_func.functionId) { @@ -57,7 +68,9 @@ int32_t exprTreeValidateFunctionNode(tExprNode *pExpr) { case TSDB_FUNC_SCALAR_LENGTH: { return exprValidateStringLengthNode(pExpr); } - + case TSDB_FUNC_SCALAR_CAST: { + return exprValidateCastNode(msgbuf, pExpr); + } default: break; } @@ -81,7 +94,7 @@ int32_t exprTreeValidateExprNode(tExprNode *pExpr) { } } -int32_t exprTreeValidateTree(tExprNode *pExpr) { +int32_t exprTreeValidateTree(char* msgbuf, tExprNode *pExpr) { int32_t code = TSDB_CODE_SUCCESS; if (pExpr == NULL) { return TSDB_CODE_SUCCESS; @@ -101,11 +114,11 @@ int32_t exprTreeValidateTree(tExprNode *pExpr) { pExpr->resultBytes = tGetTbnameColumnSchema()->bytes; } } else if (pExpr->nodeType == TSQL_NODE_EXPR) { - code = exprTreeValidateTree(pExpr->_node.pLeft); + code = exprTreeValidateTree(msgbuf, pExpr->_node.pLeft); if (code != TSDB_CODE_SUCCESS) { return code; } - code = exprTreeValidateTree(pExpr->_node.pRight); + code = exprTreeValidateTree(msgbuf, pExpr->_node.pRight); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -115,15 +128,18 @@ int32_t exprTreeValidateTree(tExprNode *pExpr) { } } else if (pExpr->nodeType == TSQL_NODE_FUNC) { for (int32_t i = 0; i < pExpr->_func.numChildren; ++i) { - code = exprTreeValidateTree(pExpr->_func.pChildren[i]); + code = exprTreeValidateTree(msgbuf, pExpr->_func.pChildren[i]); if (code != TSDB_CODE_SUCCESS) { return code; } } - code = exprTreeValidateFunctionNode(pExpr); + code = exprTreeValidateFunctionNode(msgbuf, pExpr); if (code != TSDB_CODE_SUCCESS) { return code; } + } else if (pExpr->nodeType == TSQL_NODE_TYPE) { + pExpr->resultType = pExpr->pType->type; + pExpr->resultBytes = pExpr->pType->bytes; } return TSDB_CODE_SUCCESS; @@ -222,6 +238,8 @@ void tExprTreeDestroy(tExprNode *pNode, void (*fp)(void *)) { tfree(pNode->pSchema); } else if (pNode->nodeType == TSQL_NODE_FUNC) { doExprTreeDestroy(&pNode, fp); + } else if (pNode->nodeType == TSQL_NODE_TYPE) { + tfree(pNode->pType); } free(pNode); @@ -249,6 +267,8 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) { doExprTreeDestroy((*pExpr)->_func.pChildren + i, fp); } free((*pExpr)->_func.pChildren); + } else if ((*pExpr)->nodeType == TSQL_NODE_TYPE) { + tfree((*pExpr)->pType); } free(*pExpr); @@ -344,7 +364,7 @@ void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper for (int i = 0; i < numChildren; ++i) { tExprNode *pChild = pExpr->_func.pChildren[i]; if (pChild->nodeType == TSQL_NODE_EXPR || pChild->nodeType == TSQL_NODE_FUNC) { - pChildrenOutput[i] = malloc(pChild->resultBytes * numOfRows); + pChildrenOutput[i] = malloc((pChild->resultBytes + 1) * numOfRows); pChildrenResults[i].data = pChildrenOutput[i]; exprTreeInternalNodeTraverse(pChild, numOfRows, pChildrenResults+i, param, order, getSourceDataBlock); pInputs[i].data = pChildrenOutput[i]; @@ -353,7 +373,7 @@ void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper assert(pChild->resultType == pChild->pSchema->type && pChild->resultBytes == pChild->pSchema->bytes); char *pInputData = getSourceDataBlock(param, pChild->pSchema->name, pChild->pSchema->colId); if (order == TSDB_ORDER_DESC) { - pChildrenOutput[i] = malloc(pChild->pSchema->bytes * numOfRows); + pChildrenOutput[i] = malloc((pChild->pSchema->bytes + 1) * numOfRows); reverseCopy(pChildrenOutput[i], pInputData, pChild->pSchema->type, numOfRows); pInputs[i].data = pChildrenOutput[i]; } else { @@ -361,7 +381,7 @@ void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper } pInputs[i].numOfRows = (int16_t)numOfRows; } else if (pChild->nodeType == TSQL_NODE_VALUE) { - pChildrenOutput[i] = malloc(pChild->resultBytes); + pChildrenOutput[i] = malloc(pChild->resultBytes + 1); tVariantDump(pChild->pVal, pChildrenOutput[i], pChild->resultType, true); pInputs[i].data = pChildrenOutput[i]; pInputs[i].numOfRows = 1; @@ -860,8 +880,11 @@ tExprNode* exprdup(tExprNode* pNode) { for (int i = 0; i < pNode->_func.numChildren; ++i) { pCloned->_func.pChildren[i] = exprdup(pNode->_func.pChildren[i]); } - } - + } else if (pNode->nodeType == TSQL_NODE_TYPE) { + pCloned->pType = calloc(1, sizeof(TAOS_FIELD)); + *pCloned->pType = *pNode->pType; + } + pCloned->nodeType = pNode->nodeType; pCloned->resultType = pNode->resultType; pCloned->resultBytes = pNode->resultBytes; @@ -964,6 +987,45 @@ int32_t exprValidateStringLengthNode(tExprNode *pExpr) { return TSDB_CODE_SUCCESS; } +int32_t exprValidateCastNode(char* msgbuf, tExprNode *pExpr) { + const char* msg1 = "invalid param num for cast function"; + const char* msg2 = "the second param should be a valid type name for cast function"; + const char* msg3 = "target type is not supported for cast function"; + const char* msg4 = "not supported type convertion for cast function"; + + if (pExpr->_func.numChildren != 2) { + return exprInvalidOperationMsg(msgbuf, msg1); + } + + tExprNode* child0 = pExpr->_func.pChildren[0]; + tExprNode* child1 = pExpr->_func.pChildren[1]; + + if (child1->nodeType != TSQL_NODE_TYPE) { + return exprInvalidOperationMsg(msgbuf, msg2); + } + + if (child1->resultType != TSDB_DATA_TYPE_BIGINT && child1->resultType != TSDB_DATA_TYPE_UBIGINT + && child1->resultType != TSDB_DATA_TYPE_TIMESTAMP && child1->resultType != TSDB_DATA_TYPE_BINARY + && child1->resultType != TSDB_DATA_TYPE_NCHAR) { + return exprInvalidOperationMsg(msgbuf, msg3); + } + + if ((child0->resultType == TSDB_DATA_TYPE_BINARY && child1->resultType == TSDB_DATA_TYPE_TIMESTAMP) + || (child0->resultType == TSDB_DATA_TYPE_TIMESTAMP && (child1->resultType == TSDB_DATA_TYPE_BINARY || child1->resultType == TSDB_DATA_TYPE_NCHAR)) + || (child0->resultType == TSDB_DATA_TYPE_NCHAR && (child1->resultType == TSDB_DATA_TYPE_BINARY || child1->resultType == TSDB_DATA_TYPE_TIMESTAMP))) { + return exprInvalidOperationMsg(msgbuf, msg4); + } + + pExpr->resultType = child1->resultType; + pExpr->resultBytes = child1->resultBytes; + + doExprTreeDestroy(&pExpr->_func.pChildren[1], NULL); + pExpr->_func.numChildren = 1; + + return TSDB_CODE_SUCCESS; +} + + int32_t exprValidateMathNode(tExprNode *pExpr) { switch (pExpr->_func.functionId) { case TSDB_FUNC_SCALAR_POW: @@ -1102,6 +1164,93 @@ void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInpu } } +void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t OutputType, int16_t outputBytes, char *output) { + switch (OutputType) { + case TSDB_DATA_TYPE_BIGINT: + if (inputType == TSDB_DATA_TYPE_BINARY) { + input[inputBytes] = 0; + *(int64_t *)output = strtoll(varDataVal(input), NULL, 10); + } else if (inputType == TSDB_DATA_TYPE_NCHAR) { + char *newColData = calloc(1, outputBytes * TSDB_NCHAR_SIZE + 1); + int len = taosUcs4ToMbs(varDataVal(input), varDataLen(input), newColData); + newColData[len] = 0; + *(int64_t *)output = strtoll(newColData, NULL, 10); + tfree(newColData); + } else { + GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input); + } + break; + case TSDB_DATA_TYPE_UBIGINT: + if (inputType == TSDB_DATA_TYPE_BINARY) { + input[inputBytes] = 0; + *(uint64_t *)output = strtoull(varDataVal(input), NULL, 10); + } else if (inputType == TSDB_DATA_TYPE_NCHAR) { + char *newColData = calloc(1, outputBytes * TSDB_NCHAR_SIZE + 1); + int len = taosUcs4ToMbs(varDataVal(input), varDataLen(input), newColData); + newColData[len] = 0; + *(int64_t *)output = strtoull(newColData, NULL, 10); + tfree(newColData); + } else { + GET_TYPED_DATA(*(uint64_t *)output, uint64_t, inputType, input); + } + break; + case TSDB_DATA_TYPE_TIMESTAMP: + if (inputType == TSDB_DATA_TYPE_BINARY || inputType == TSDB_DATA_TYPE_NCHAR) { + assert(0); + } else { + GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input); + } + break; + case TSDB_DATA_TYPE_BINARY: + if (inputType == TSDB_DATA_TYPE_BOOL) { + int32_t len = sprintf(varDataVal(output), "%.*s", (int32_t)(outputBytes - VARSTR_HEADER_SIZE), *(int8_t*)input ? "true" : "false"); + varDataSetLen(output, len); + } else if (inputType == TSDB_DATA_TYPE_BINARY) { + int32_t len = sprintf(varDataVal(output), "%.*s", (int32_t)(outputBytes - VARSTR_HEADER_SIZE), input); + varDataSetLen(output, len); + } else if (inputType == TSDB_DATA_TYPE_TIMESTAMP || inputType == TSDB_DATA_TYPE_NCHAR) { + assert(0); + } else { + char tmp[64] = {0}; + NUM_TO_STRING(inputType, input, sizeof(tmp), tmp); + int32_t len = strlen(tmp); + len = (outputBytes - VARSTR_HEADER_SIZE) > len ? len : (outputBytes - VARSTR_HEADER_SIZE); + memcpy(varDataVal(output), tmp, len); + varDataSetLen(output, len); + } + break; + case TSDB_DATA_TYPE_NCHAR: { + int32_t ncharSize = (outputBytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + if (inputType == TSDB_DATA_TYPE_BOOL) { + char tmp[8] = {0}; + int32_t len = sprintf(tmp, "%.*s", ncharSize, *(int8_t*)input ? "true" : "false"); + taosMbsToUcs4(tmp, len, varDataVal(output), outputBytes - VARSTR_HEADER_SIZE, &len); + varDataSetLen(output, len); + } else if (inputType == TSDB_DATA_TYPE_BINARY) { + int32_t len = ncharSize > varDataLen(input) ? varDataLen(input) : ncharSize; + taosMbsToUcs4(input + VARSTR_HEADER_SIZE, len, varDataVal(output), outputBytes - VARSTR_HEADER_SIZE, &len); + varDataSetLen(output, len); + } else if (inputType == TSDB_DATA_TYPE_TIMESTAMP) { + assert(0); + } else if (inputType == TSDB_DATA_TYPE_NCHAR) { + int32_t len = (inputBytes > outputBytes) ? outputBytes : inputBytes; + memcpy(output, input, len); + varDataSetLen(output, len - VARSTR_HEADER_SIZE); + } else { + char tmp[64] = {0}; + NUM_TO_STRING(inputType, input, sizeof(tmp), tmp); + int32_t len = ncharSize > strlen(tmp) ? strlen(tmp) : ncharSize; + taosMbsToUcs4(tmp, len, varDataVal(output), outputBytes - VARSTR_HEADER_SIZE, &len); + varDataSetLen(output, len); + } + break; + } + default: + assert(0); + break; + } +} + void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { for (int i = 0; i < numInputs; ++i) { @@ -1306,6 +1455,10 @@ void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numIn } break; } + case TSDB_FUNC_SCALAR_CAST: { + castConvert(pInputs[0].type, pInputs[0].bytes, inputData[0], pOutput->type, pOutput->bytes, outputData); + break; + } default: { assert(false); break; @@ -1398,5 +1551,10 @@ tScalarFunctionInfo aScalarFunctions[] = { TSDB_FUNC_SCALAR_LENGTH, "length", vectorLength - } + }, + { + TSDB_FUNC_SCALAR_CAST, + "cast", + vectorMathFunc + }, }; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index eb8cc5baa6..c24a393fe3 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -217,6 +217,8 @@ + + #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/inc/ttype.h b/src/inc/ttype.h index 3f1606e957..0f9bc5239a 100644 --- a/src/inc/ttype.h +++ b/src/inc/ttype.h @@ -125,6 +125,42 @@ typedef struct { } \ } while (0) +#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \ + do { \ + switch (_inputType) { \ + case TSDB_DATA_TYPE_TINYINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_UTINYINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_SMALLINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_USMALLINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_BIGINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_UBIGINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_FLOAT: \ + snprintf(_output, (int32_t)(_outputBytes), "%e", *(float *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_DOUBLE: \ + snprintf(_output, (int32_t)(_outputBytes), "%e", *(double *)(_input)); \ + break; \ + case TSDB_DATA_TYPE_UINT: \ + snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \ + break; \ + default: \ + snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input)); \ + 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) diff --git a/src/query/inc/qAggMain.h b/src/query/inc/qAggMain.h index 9a8ff62be7..e6ec45c717 100644 --- a/src/query/inc/qAggMain.h +++ b/src/query/inc/qAggMain.h @@ -252,7 +252,7 @@ void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw); void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDist); /* global sql function array */ -extern struct SAggFunctionInfo aAggs[]; +extern struct SAggFunctionInfo aAggs[40]; extern int32_t functionCompatList[]; // compatible check array list diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index cd6e74dd26..c0c921b277 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -38,6 +38,7 @@ enum SQL_NODE_TYPE { SQL_NODE_SQLFUNCTION = 2, SQL_NODE_VALUE = 3, SQL_NODE_EXPR = 4, + SQL_NODE_DATA_TYPE = 5, }; enum SQL_NODE_FROM_TYPE { @@ -258,6 +259,7 @@ typedef struct tSqlExpr { int32_t functionId; // function id, todo remove it SStrToken columnName; // table column info + TAOS_FIELD dataType; // data type tVariant value; // the use input value SStrToken exprToken; // original sql expr string uint32_t flags; // todo remove it @@ -284,6 +286,7 @@ SRelationInfo *addSubqueryElem(SRelationInfo* pRelationInfo, SArray* pSub, SStrT // sql expr leaf node tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optrType); tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType); +tSqlExpr *tSqlExprCreateFuncWithParams(SSqlInfo *pInfo, tSqlExpr* col, TAOS_FIELD *colType, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType); SArray *tStrTokenAppend(SArray *pList, SStrToken *pToken); tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType); diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 451df9c259..6d0c576ef3 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -723,6 +723,9 @@ expr(A) ::= ID(X) LP exprlist(Y) RP(E). { tStrTokenAppend(pInfo->funcs, &X); A = // for parsing sql functions with wildcard for parameters. e.g., count(*)/first(*)/last(*) operation expr(A) ::= ID(X) LP STAR RP(Y). { tStrTokenAppend(pInfo->funcs, &X); A = tSqlExprCreateFunction(NULL, &X, &Y, X.type); } +// for parsing sql function CAST(column as typename) +expr(A) ::= ID(X) LP expr(B) AS typename(C) RP(Y). { tStrTokenAppend(pInfo->funcs, &X); A = tSqlExprCreateFuncWithParams(pInfo, B, &C, &X, &Y, X.type); } + // is (not) null expression expr(A) ::= expr(X) IS NULL. {A = tSqlExprCreate(X, NULL, TK_ISNULL);} expr(A) ::= expr(X) IS NOT NULL. {A = tSqlExprCreate(X, NULL, TK_NOTNULL);} diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 67eaf65c5a..8ce9a07d87 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -480,7 +480,7 @@ int32_t isValidFunction(const char* name, int32_t len) { } } - for(int32_t i = 0; i <= TSDB_FUNC_BLKINFO; ++i) { + for(int32_t i = 0; i <= tListLen(aAggs); ++i) { int32_t nameLen = (int32_t) strlen(aAggs[i].name); if (len != nameLen) { continue; @@ -4852,7 +4852,7 @@ int32_t functionCompatList[] = { 7 }; -SAggFunctionInfo aAggs[] = {{ +SAggFunctionInfo aAggs[40] = {{ // 0, count function does not invoke the finalize function "count", TSDB_FUNC_COUNT, diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index 07ff79b161..0e58b416b4 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -178,6 +178,14 @@ tSqlExpr *tSqlExprCreateIdValue(SSqlInfo* pInfo, SStrToken *pToken, int32_t optr pSqlExpr->value.nType = TSDB_DATA_TYPE_BIGINT; pSqlExpr->tokenId = TK_TIMESTAMP; pSqlExpr->type = SQL_NODE_VALUE; + } else if (optrType == TK_AS) { + // Here it must be column type + if (pToken != NULL) { + pSqlExpr->dataType = *(TAOS_FIELD *)pToken; + } + + pSqlExpr->tokenId = optrType; + pSqlExpr->type = SQL_NODE_DATA_TYPE; } else { // Here it must be the column name (tk_id) if it is not a number or string. assert(optrType == TK_ID || optrType == TK_ALL); @@ -216,6 +224,25 @@ tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToke return pExpr; } +tSqlExpr *tSqlExprCreateFuncWithParams(SSqlInfo *pInfo, tSqlExpr* col, TAOS_FIELD *colType, SStrToken *pFuncToken, SStrToken *endToken, int32_t optType) { + if (colType == NULL || col == NULL) { + return NULL; + } + + if (NULL == col) { + return NULL; + } + + tSqlExpr* ctype = tSqlExprCreateIdValue(pInfo, (SStrToken *)colType, TK_AS); + + SArray *exprList = tSqlExprListAppend(0,col,0, 0); + + tSqlExprListAppend(exprList,ctype,0, 0); + + return tSqlExprCreateFunction(exprList, pFuncToken, endToken, optType); +} + + /* * create binary expression in this procedure * if the expr is arithmetic, calculate the result and set it to tSqlExpr Object diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 2dfda7748b..b48098fc2e 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -138,18 +138,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 368 -#define YYNRULE 294 -#define YYNRULE_WITH_ACTION 294 +#define YYNSTATE 371 +#define YYNRULE 295 +#define YYNRULE_WITH_ACTION 295 #define YYNTOKEN 197 -#define YY_MAX_SHIFT 367 -#define YY_MIN_SHIFTREDUCE 576 -#define YY_MAX_SHIFTREDUCE 869 -#define YY_ERROR_ACTION 870 -#define YY_ACCEPT_ACTION 871 -#define YY_NO_ACTION 872 -#define YY_MIN_REDUCE 873 -#define YY_MAX_REDUCE 1166 +#define YY_MAX_SHIFT 370 +#define YY_MIN_SHIFTREDUCE 580 +#define YY_MAX_SHIFTREDUCE 874 +#define YY_ERROR_ACTION 875 +#define YY_ACCEPT_ACTION 876 +#define YY_NO_ACTION 877 +#define YY_MIN_REDUCE 878 +#define YY_MAX_REDUCE 1172 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,168 +216,170 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (773) +#define YY_ACTTAB_COUNT (796) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1023, 628, 366, 235, 211, 362, 960, 23, 264, 629, - /* 10 */ 1051, 871, 367, 59, 60, 1142, 63, 64, 164, 178, - /* 20 */ 255, 53, 52, 51, 628, 62, 324, 67, 65, 68, - /* 30 */ 66, 157, 629, 241, 247, 58, 57, 1029, 1029, 56, - /* 40 */ 55, 54, 59, 60, 249, 63, 64, 248, 1029, 255, - /* 50 */ 53, 52, 51, 38, 62, 324, 67, 65, 68, 66, - /* 60 */ 999, 1042, 997, 998, 58, 57, 173, 1000, 56, 55, - /* 70 */ 54, 1001, 252, 1002, 1003, 58, 57, 277, 1048, 56, - /* 80 */ 55, 54, 59, 60, 286, 63, 64, 82, 664, 255, - /* 90 */ 53, 52, 51, 1089, 62, 324, 67, 65, 68, 66, - /* 100 */ 284, 283, 1025, 79, 58, 57, 29, 322, 56, 55, - /* 110 */ 54, 59, 61, 806, 63, 64, 354, 164, 255, 53, - /* 120 */ 52, 51, 628, 62, 324, 67, 65, 68, 66, 922, - /* 130 */ 629, 712, 211, 58, 57, 711, 192, 56, 55, 54, - /* 140 */ 63, 64, 1042, 1143, 255, 53, 52, 51, 208, 62, - /* 150 */ 324, 67, 65, 68, 66, 56, 55, 54, 238, 58, - /* 160 */ 57, 344, 343, 56, 55, 54, 97, 577, 578, 579, - /* 170 */ 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, - /* 180 */ 590, 155, 60, 236, 63, 64, 771, 772, 255, 53, - /* 190 */ 52, 51, 94, 62, 324, 67, 65, 68, 66, 1012, - /* 200 */ 1013, 35, 1016, 58, 57, 1, 180, 56, 55, 54, - /* 210 */ 44, 320, 361, 360, 319, 318, 317, 359, 316, 315, - /* 220 */ 314, 358, 313, 357, 356, 991, 979, 980, 981, 982, - /* 230 */ 983, 984, 985, 986, 987, 988, 989, 990, 992, 993, - /* 240 */ 24, 254, 821, 269, 932, 810, 209, 813, 215, 816, - /* 250 */ 1042, 192, 273, 272, 95, 164, 38, 214, 14, 254, - /* 260 */ 821, 251, 96, 810, 222, 813, 239, 816, 83, 256, - /* 270 */ 139, 138, 137, 221, 164, 233, 234, 329, 88, 325, - /* 280 */ 5, 41, 182, 812, 811, 815, 814, 181, 106, 111, - /* 290 */ 102, 110, 99, 233, 234, 67, 65, 68, 66, 88, - /* 300 */ 788, 237, 1015, 58, 57, 1026, 309, 56, 55, 54, - /* 310 */ 258, 736, 628, 216, 733, 45, 734, 263, 735, 34, - /* 320 */ 629, 211, 749, 69, 123, 117, 128, 264, 298, 211, - /* 330 */ 93, 127, 1143, 133, 136, 126, 45, 276, 179, 80, - /* 340 */ 1143, 69, 130, 923, 260, 261, 229, 38, 9, 1090, - /* 350 */ 192, 296, 304, 202, 200, 198, 264, 787, 822, 817, - /* 360 */ 197, 143, 142, 141, 140, 818, 38, 1027, 38, 38, - /* 370 */ 752, 44, 217, 361, 360, 38, 822, 817, 359, 326, - /* 380 */ 38, 38, 358, 818, 357, 356, 259, 322, 257, 38, - /* 390 */ 332, 331, 245, 265, 85, 262, 1026, 339, 338, 38, - /* 400 */ 38, 73, 278, 819, 820, 100, 365, 364, 148, 125, - /* 410 */ 86, 246, 81, 333, 334, 1026, 39, 1026, 1026, 768, - /* 420 */ 335, 354, 3, 193, 1026, 336, 340, 737, 738, 1026, - /* 430 */ 1026, 280, 76, 159, 341, 154, 152, 151, 1026, 778, - /* 440 */ 808, 1017, 779, 74, 342, 346, 1014, 280, 1026, 1026, - /* 450 */ 722, 301, 724, 70, 756, 303, 26, 253, 1137, 723, - /* 460 */ 844, 823, 627, 1136, 39, 39, 70, 1028, 16, 98, - /* 470 */ 15, 1162, 77, 70, 25, 25, 25, 1135, 809, 6, - /* 480 */ 135, 134, 825, 116, 18, 115, 17, 231, 741, 739, - /* 490 */ 742, 740, 20, 122, 19, 121, 22, 232, 21, 212, - /* 500 */ 213, 218, 1154, 210, 219, 220, 1100, 274, 224, 225, - /* 510 */ 226, 223, 207, 1099, 243, 1096, 1095, 48, 156, 244, - /* 520 */ 345, 174, 1050, 1061, 1058, 1082, 1059, 1063, 158, 1043, - /* 530 */ 281, 163, 292, 1024, 1081, 175, 153, 310, 1022, 285, - /* 540 */ 176, 177, 937, 306, 307, 767, 165, 308, 311, 166, - /* 550 */ 312, 46, 205, 42, 240, 323, 931, 287, 330, 1161, - /* 560 */ 113, 1160, 1157, 289, 183, 78, 1040, 299, 337, 1153, - /* 570 */ 75, 167, 119, 1152, 50, 297, 295, 169, 1149, 184, - /* 580 */ 957, 43, 40, 47, 206, 919, 129, 917, 131, 132, - /* 590 */ 915, 914, 266, 195, 196, 293, 911, 910, 909, 908, - /* 600 */ 291, 907, 906, 905, 199, 201, 902, 900, 898, 896, - /* 610 */ 203, 893, 204, 889, 49, 355, 279, 84, 89, 290, - /* 620 */ 1083, 288, 124, 347, 348, 349, 350, 230, 250, 351, - /* 630 */ 305, 352, 353, 363, 869, 227, 267, 228, 268, 868, - /* 640 */ 270, 936, 271, 935, 107, 867, 850, 849, 108, 275, - /* 650 */ 280, 300, 10, 30, 913, 87, 912, 282, 144, 187, - /* 660 */ 145, 186, 958, 185, 189, 188, 190, 191, 904, 2, - /* 670 */ 146, 995, 903, 4, 959, 895, 33, 172, 170, 168, - /* 680 */ 171, 147, 894, 744, 90, 769, 160, 162, 780, 1005, - /* 690 */ 161, 242, 774, 91, 31, 776, 92, 294, 11, 12, - /* 700 */ 32, 13, 27, 302, 28, 99, 101, 104, 36, 103, - /* 710 */ 642, 37, 105, 677, 675, 674, 673, 671, 670, 669, - /* 720 */ 666, 632, 321, 109, 7, 327, 824, 826, 8, 328, - /* 730 */ 112, 114, 71, 72, 714, 713, 39, 710, 118, 120, - /* 740 */ 658, 656, 648, 654, 650, 652, 646, 644, 680, 679, - /* 750 */ 678, 676, 672, 668, 667, 194, 630, 594, 873, 872, - /* 760 */ 872, 872, 872, 872, 872, 872, 872, 872, 872, 872, - /* 770 */ 872, 149, 150, + /* 0 */ 23, 632, 369, 237, 1056, 210, 243, 716, 212, 633, + /* 10 */ 1034, 876, 370, 60, 61, 1047, 64, 65, 1047, 1148, + /* 20 */ 257, 54, 53, 52, 632, 63, 326, 68, 66, 69, + /* 30 */ 67, 240, 633, 158, 241, 59, 58, 347, 346, 57, + /* 40 */ 56, 55, 60, 61, 249, 64, 65, 165, 1034, 257, + /* 50 */ 54, 53, 52, 668, 63, 326, 68, 66, 69, 67, + /* 60 */ 1004, 1047, 1002, 1003, 59, 58, 165, 1005, 57, 56, + /* 70 */ 55, 1006, 1053, 1007, 1008, 59, 58, 279, 756, 57, + /* 80 */ 56, 55, 60, 61, 251, 64, 65, 83, 1034, 257, + /* 90 */ 54, 53, 52, 96, 63, 326, 68, 66, 69, 67, + /* 100 */ 254, 253, 286, 285, 59, 58, 258, 84, 57, 56, + /* 110 */ 55, 60, 61, 14, 64, 65, 38, 97, 257, 54, + /* 120 */ 53, 52, 1094, 63, 326, 68, 66, 69, 67, 57, + /* 130 */ 56, 55, 324, 59, 58, 357, 632, 57, 56, 55, + /* 140 */ 98, 95, 60, 62, 633, 64, 65, 100, 211, 257, + /* 150 */ 54, 53, 52, 810, 63, 326, 68, 66, 69, 67, + /* 160 */ 208, 212, 760, 89, 59, 58, 212, 165, 57, 56, + /* 170 */ 55, 1149, 1149, 1017, 1018, 35, 1021, 1149, 816, 1028, + /* 180 */ 819, 581, 582, 583, 584, 585, 586, 587, 588, 589, + /* 190 */ 590, 591, 592, 593, 594, 156, 61, 238, 64, 65, + /* 200 */ 46, 1020, 257, 54, 53, 52, 217, 63, 326, 68, + /* 210 */ 66, 69, 67, 16, 260, 15, 165, 59, 58, 632, + /* 220 */ 126, 57, 56, 55, 64, 65, 250, 633, 257, 54, + /* 230 */ 53, 52, 357, 63, 326, 68, 66, 69, 67, 815, + /* 240 */ 300, 818, 94, 59, 58, 775, 776, 57, 56, 55, + /* 250 */ 45, 322, 364, 363, 321, 320, 319, 362, 318, 317, + /* 260 */ 316, 361, 315, 360, 359, 996, 984, 985, 986, 987, + /* 270 */ 988, 989, 990, 991, 992, 993, 994, 995, 997, 998, + /* 280 */ 24, 256, 825, 39, 174, 814, 324, 817, 218, 820, + /* 290 */ 261, 1095, 259, 298, 335, 334, 39, 216, 823, 256, + /* 300 */ 825, 29, 288, 814, 224, 817, 82, 820, 39, 219, + /* 310 */ 140, 139, 138, 223, 1033, 235, 236, 332, 89, 328, + /* 320 */ 5, 42, 183, 39, 368, 367, 149, 182, 107, 112, + /* 330 */ 103, 111, 1030, 235, 236, 68, 66, 69, 67, 1143, + /* 340 */ 1019, 239, 39, 59, 58, 1031, 311, 57, 56, 55, + /* 350 */ 265, 740, 77, 247, 737, 46, 738, 1031, 739, 824, + /* 360 */ 117, 39, 116, 70, 124, 118, 129, 266, 248, 266, + /* 370 */ 39, 128, 1031, 134, 137, 127, 101, 278, 179, 81, + /* 380 */ 180, 70, 131, 1142, 262, 263, 231, 336, 39, 39, + /* 390 */ 39, 1031, 78, 203, 201, 199, 39, 39, 826, 821, + /* 400 */ 198, 144, 143, 142, 141, 822, 337, 155, 153, 152, + /* 410 */ 1031, 45, 1022, 364, 363, 338, 826, 821, 362, 1031, + /* 420 */ 927, 266, 361, 822, 360, 359, 267, 193, 264, 792, + /* 430 */ 342, 341, 327, 339, 343, 344, 266, 1031, 1031, 1031, + /* 440 */ 271, 345, 349, 753, 937, 1031, 1031, 1032, 928, 275, + /* 450 */ 274, 193, 365, 965, 86, 193, 1, 181, 3, 194, + /* 460 */ 280, 87, 772, 782, 783, 74, 726, 741, 742, 9, + /* 470 */ 303, 728, 812, 305, 40, 727, 160, 71, 26, 34, + /* 480 */ 40, 849, 827, 255, 40, 71, 791, 99, 329, 71, + /* 490 */ 631, 282, 18, 80, 17, 25, 25, 745, 282, 746, + /* 500 */ 743, 20, 744, 19, 25, 6, 123, 75, 122, 22, + /* 510 */ 813, 21, 306, 136, 135, 1141, 233, 234, 214, 215, + /* 520 */ 1168, 1160, 220, 1105, 1104, 715, 213, 221, 222, 226, + /* 530 */ 227, 228, 225, 209, 245, 1101, 276, 157, 1100, 246, + /* 540 */ 1055, 348, 49, 1087, 1086, 175, 1066, 1063, 154, 1064, + /* 550 */ 1048, 283, 1068, 159, 1029, 164, 294, 176, 1027, 287, + /* 560 */ 177, 178, 242, 942, 308, 309, 170, 310, 313, 771, + /* 570 */ 314, 47, 206, 43, 325, 289, 291, 1045, 166, 167, + /* 580 */ 936, 301, 333, 1167, 114, 79, 76, 1166, 51, 1163, + /* 590 */ 168, 830, 184, 340, 1159, 299, 297, 169, 120, 1158, + /* 600 */ 1155, 185, 962, 44, 41, 295, 48, 207, 924, 293, + /* 610 */ 130, 922, 132, 133, 920, 919, 268, 196, 197, 916, + /* 620 */ 915, 290, 914, 913, 912, 911, 910, 200, 202, 907, + /* 630 */ 905, 903, 901, 312, 204, 898, 205, 894, 50, 358, + /* 640 */ 281, 85, 90, 292, 1088, 125, 350, 351, 171, 352, + /* 650 */ 353, 355, 232, 354, 252, 307, 356, 366, 874, 269, + /* 660 */ 229, 270, 873, 230, 272, 108, 941, 940, 109, 273, + /* 670 */ 872, 855, 277, 854, 282, 302, 10, 30, 918, 917, + /* 680 */ 909, 188, 187, 963, 186, 189, 191, 190, 192, 4, + /* 690 */ 145, 146, 2, 147, 908, 1000, 964, 900, 33, 899, + /* 700 */ 172, 148, 88, 748, 173, 284, 91, 1010, 773, 161, + /* 710 */ 163, 784, 162, 244, 778, 92, 31, 780, 93, 296, + /* 720 */ 11, 32, 12, 13, 27, 304, 28, 100, 102, 105, + /* 730 */ 36, 104, 646, 37, 106, 681, 679, 678, 677, 675, + /* 740 */ 674, 673, 670, 323, 7, 636, 110, 829, 330, 831, + /* 750 */ 828, 8, 331, 113, 72, 73, 718, 717, 40, 115, + /* 760 */ 714, 119, 121, 662, 660, 652, 658, 654, 656, 650, + /* 770 */ 648, 684, 683, 682, 680, 676, 672, 671, 195, 634, + /* 780 */ 598, 878, 877, 877, 877, 877, 877, 877, 877, 877, + /* 790 */ 877, 877, 877, 877, 150, 151, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 199, 1, 199, 200, 266, 221, 222, 266, 199, 9, - /* 10 */ 199, 197, 198, 13, 14, 277, 16, 17, 199, 210, + /* 0 */ 266, 1, 199, 200, 199, 266, 245, 5, 266, 9, + /* 10 */ 249, 197, 198, 13, 14, 247, 16, 17, 247, 277, /* 20 */ 20, 21, 22, 23, 1, 25, 26, 27, 28, 29, - /* 30 */ 30, 199, 9, 245, 245, 35, 36, 249, 249, 39, - /* 40 */ 40, 41, 13, 14, 245, 16, 17, 246, 249, 20, - /* 50 */ 21, 22, 23, 199, 25, 26, 27, 28, 29, 30, - /* 60 */ 223, 247, 225, 226, 35, 36, 253, 230, 39, 40, - /* 70 */ 41, 234, 206, 236, 237, 35, 36, 263, 267, 39, - /* 80 */ 40, 41, 13, 14, 271, 16, 17, 87, 5, 20, - /* 90 */ 21, 22, 23, 274, 25, 26, 27, 28, 29, 30, - /* 100 */ 268, 269, 248, 83, 35, 36, 83, 85, 39, 40, - /* 110 */ 41, 13, 14, 84, 16, 17, 91, 199, 20, 21, - /* 120 */ 22, 23, 1, 25, 26, 27, 28, 29, 30, 205, - /* 130 */ 9, 5, 266, 35, 36, 115, 212, 39, 40, 41, - /* 140 */ 16, 17, 247, 277, 20, 21, 22, 23, 266, 25, - /* 150 */ 26, 27, 28, 29, 30, 39, 40, 41, 263, 35, - /* 160 */ 36, 35, 36, 39, 40, 41, 207, 46, 47, 48, - /* 170 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - /* 180 */ 59, 60, 14, 62, 16, 17, 126, 127, 20, 21, - /* 190 */ 22, 23, 274, 25, 26, 27, 28, 29, 30, 240, - /* 200 */ 241, 242, 243, 35, 36, 208, 209, 39, 40, 41, - /* 210 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - /* 220 */ 109, 110, 111, 112, 113, 223, 224, 225, 226, 227, - /* 230 */ 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - /* 240 */ 45, 1, 2, 143, 205, 5, 266, 7, 266, 9, - /* 250 */ 247, 212, 152, 153, 250, 199, 199, 62, 83, 1, - /* 260 */ 2, 206, 87, 5, 69, 7, 263, 9, 264, 206, - /* 270 */ 75, 76, 77, 78, 199, 35, 36, 82, 83, 39, - /* 280 */ 63, 64, 65, 5, 5, 7, 7, 70, 71, 72, - /* 290 */ 73, 74, 117, 35, 36, 27, 28, 29, 30, 83, - /* 300 */ 77, 244, 0, 35, 36, 248, 89, 39, 40, 41, - /* 310 */ 69, 2, 1, 266, 5, 120, 7, 69, 9, 83, - /* 320 */ 9, 266, 98, 83, 63, 64, 65, 199, 272, 266, - /* 330 */ 274, 70, 277, 72, 73, 74, 120, 142, 210, 144, - /* 340 */ 277, 83, 81, 205, 35, 36, 151, 199, 124, 274, - /* 350 */ 212, 276, 116, 63, 64, 65, 199, 134, 118, 119, - /* 360 */ 70, 71, 72, 73, 74, 125, 199, 210, 199, 199, - /* 370 */ 39, 99, 266, 101, 102, 199, 118, 119, 106, 15, - /* 380 */ 199, 199, 110, 125, 112, 113, 145, 85, 147, 199, - /* 390 */ 149, 150, 244, 145, 84, 147, 248, 149, 150, 199, - /* 400 */ 199, 98, 84, 125, 125, 207, 66, 67, 68, 79, - /* 410 */ 84, 244, 207, 244, 244, 248, 98, 248, 248, 84, - /* 420 */ 244, 91, 203, 204, 248, 244, 244, 118, 119, 248, - /* 430 */ 248, 121, 98, 98, 244, 63, 64, 65, 248, 84, - /* 440 */ 1, 243, 84, 140, 244, 244, 241, 121, 248, 248, - /* 450 */ 84, 84, 84, 98, 123, 84, 98, 61, 266, 84, - /* 460 */ 84, 84, 84, 266, 98, 98, 98, 249, 146, 98, - /* 470 */ 148, 249, 138, 98, 98, 98, 98, 266, 39, 83, - /* 480 */ 79, 80, 118, 146, 146, 148, 148, 266, 5, 5, - /* 490 */ 7, 7, 146, 146, 148, 148, 146, 266, 148, 266, - /* 500 */ 266, 266, 249, 266, 266, 266, 239, 199, 266, 266, - /* 510 */ 266, 266, 266, 239, 239, 239, 239, 265, 199, 239, - /* 520 */ 239, 251, 199, 199, 199, 275, 199, 199, 199, 247, - /* 530 */ 247, 199, 199, 247, 275, 199, 61, 90, 199, 270, - /* 540 */ 199, 199, 199, 199, 199, 125, 261, 199, 199, 260, - /* 550 */ 199, 199, 199, 199, 270, 199, 199, 270, 199, 199, - /* 560 */ 199, 199, 199, 270, 199, 137, 262, 132, 199, 199, - /* 570 */ 139, 259, 199, 199, 136, 135, 130, 257, 199, 199, - /* 580 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - /* 590 */ 199, 199, 199, 199, 199, 129, 199, 199, 199, 199, - /* 600 */ 128, 199, 199, 199, 199, 199, 199, 199, 199, 199, - /* 610 */ 199, 199, 199, 199, 141, 114, 201, 201, 201, 201, - /* 620 */ 201, 131, 97, 96, 52, 93, 95, 201, 201, 56, - /* 630 */ 201, 94, 92, 85, 5, 201, 154, 201, 5, 5, - /* 640 */ 154, 211, 5, 211, 207, 5, 101, 100, 207, 143, - /* 650 */ 121, 116, 83, 83, 201, 122, 201, 98, 202, 214, - /* 660 */ 202, 218, 220, 219, 215, 217, 216, 213, 201, 208, - /* 670 */ 202, 238, 201, 203, 222, 201, 252, 254, 256, 258, - /* 680 */ 255, 202, 201, 84, 98, 84, 83, 98, 84, 238, - /* 690 */ 83, 1, 84, 83, 98, 84, 83, 83, 133, 133, - /* 700 */ 98, 83, 83, 116, 83, 117, 79, 71, 88, 87, - /* 710 */ 5, 88, 87, 9, 5, 5, 5, 5, 5, 5, - /* 720 */ 5, 86, 15, 79, 83, 26, 84, 118, 83, 60, - /* 730 */ 148, 148, 16, 16, 5, 5, 98, 84, 148, 148, - /* 740 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 750 */ 5, 5, 5, 5, 5, 98, 86, 61, 0, 278, - /* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 770 */ 278, 21, 21, 278, 278, 278, 278, 278, 278, 278, - /* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 790 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 30 */ 30, 263, 9, 199, 263, 35, 36, 35, 36, 39, + /* 40 */ 40, 41, 13, 14, 245, 16, 17, 199, 249, 20, + /* 50 */ 21, 22, 23, 5, 25, 26, 27, 28, 29, 30, + /* 60 */ 223, 247, 225, 226, 35, 36, 199, 230, 39, 40, + /* 70 */ 41, 234, 267, 236, 237, 35, 36, 263, 39, 39, + /* 80 */ 40, 41, 13, 14, 245, 16, 17, 87, 249, 20, + /* 90 */ 21, 22, 23, 250, 25, 26, 27, 28, 29, 30, + /* 100 */ 206, 206, 268, 269, 35, 36, 206, 264, 39, 40, + /* 110 */ 41, 13, 14, 83, 16, 17, 87, 87, 20, 21, + /* 120 */ 22, 23, 274, 25, 26, 27, 28, 29, 30, 39, + /* 130 */ 40, 41, 85, 35, 36, 91, 1, 39, 40, 41, + /* 140 */ 207, 274, 13, 14, 9, 16, 17, 117, 266, 20, + /* 150 */ 21, 22, 23, 84, 25, 26, 27, 28, 29, 30, + /* 160 */ 266, 266, 123, 83, 35, 36, 266, 199, 39, 40, + /* 170 */ 41, 277, 277, 240, 241, 242, 243, 277, 5, 199, + /* 180 */ 7, 46, 47, 48, 49, 50, 51, 52, 53, 54, + /* 190 */ 55, 56, 57, 58, 59, 60, 14, 62, 16, 17, + /* 200 */ 120, 0, 20, 21, 22, 23, 266, 25, 26, 27, + /* 210 */ 28, 29, 30, 146, 69, 148, 199, 35, 36, 1, + /* 220 */ 79, 39, 40, 41, 16, 17, 246, 9, 20, 21, + /* 230 */ 22, 23, 91, 25, 26, 27, 28, 29, 30, 5, + /* 240 */ 272, 7, 274, 35, 36, 126, 127, 39, 40, 41, + /* 250 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + /* 260 */ 109, 110, 111, 112, 113, 223, 224, 225, 226, 227, + /* 270 */ 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + /* 280 */ 45, 1, 2, 199, 253, 5, 85, 7, 266, 9, + /* 290 */ 145, 274, 147, 276, 149, 150, 199, 62, 125, 1, + /* 300 */ 2, 83, 271, 5, 69, 7, 207, 9, 199, 266, + /* 310 */ 75, 76, 77, 78, 249, 35, 36, 82, 83, 39, + /* 320 */ 63, 64, 65, 199, 66, 67, 68, 70, 71, 72, + /* 330 */ 73, 74, 248, 35, 36, 27, 28, 29, 30, 266, + /* 340 */ 241, 244, 199, 35, 36, 248, 89, 39, 40, 41, + /* 350 */ 69, 2, 98, 244, 5, 120, 7, 248, 9, 125, + /* 360 */ 146, 199, 148, 83, 63, 64, 65, 199, 244, 199, + /* 370 */ 199, 70, 248, 72, 73, 74, 207, 142, 210, 144, + /* 380 */ 210, 83, 81, 266, 35, 36, 151, 244, 199, 199, + /* 390 */ 199, 248, 138, 63, 64, 65, 199, 199, 118, 119, + /* 400 */ 70, 71, 72, 73, 74, 125, 244, 63, 64, 65, + /* 410 */ 248, 99, 243, 101, 102, 244, 118, 119, 106, 248, + /* 420 */ 205, 199, 110, 125, 112, 113, 145, 212, 147, 77, + /* 430 */ 149, 150, 210, 244, 244, 244, 199, 248, 248, 248, + /* 440 */ 143, 244, 244, 98, 205, 248, 248, 210, 205, 152, + /* 450 */ 153, 212, 221, 222, 84, 212, 208, 209, 203, 204, + /* 460 */ 84, 84, 84, 84, 84, 98, 84, 118, 119, 124, + /* 470 */ 84, 84, 1, 84, 98, 84, 98, 98, 98, 83, + /* 480 */ 98, 84, 84, 61, 98, 98, 134, 98, 15, 98, + /* 490 */ 84, 121, 146, 83, 148, 98, 98, 5, 121, 7, + /* 500 */ 5, 146, 7, 148, 98, 83, 146, 140, 148, 146, + /* 510 */ 39, 148, 116, 79, 80, 266, 266, 266, 266, 266, + /* 520 */ 249, 249, 266, 239, 239, 115, 266, 266, 266, 266, + /* 530 */ 266, 266, 266, 266, 239, 239, 199, 199, 239, 239, + /* 540 */ 199, 239, 265, 275, 275, 251, 199, 199, 61, 199, + /* 550 */ 247, 247, 199, 199, 247, 199, 199, 199, 199, 270, + /* 560 */ 199, 199, 270, 199, 199, 199, 257, 199, 199, 125, + /* 570 */ 199, 199, 199, 199, 199, 270, 270, 262, 261, 260, + /* 580 */ 199, 132, 199, 199, 199, 137, 139, 199, 136, 199, + /* 590 */ 259, 118, 199, 199, 199, 135, 130, 258, 199, 199, + /* 600 */ 199, 199, 199, 199, 199, 129, 199, 199, 199, 128, + /* 610 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + /* 620 */ 199, 131, 199, 199, 199, 199, 199, 199, 199, 199, + /* 630 */ 199, 199, 199, 90, 199, 199, 199, 199, 141, 114, + /* 640 */ 201, 201, 201, 201, 201, 97, 96, 52, 256, 93, + /* 650 */ 95, 94, 201, 56, 201, 201, 92, 85, 5, 154, + /* 660 */ 201, 5, 5, 201, 154, 207, 211, 211, 207, 5, + /* 670 */ 5, 101, 143, 100, 121, 116, 83, 83, 201, 201, + /* 680 */ 201, 214, 218, 220, 219, 217, 216, 215, 213, 203, + /* 690 */ 202, 202, 208, 202, 201, 238, 222, 201, 252, 201, + /* 700 */ 255, 202, 122, 84, 254, 98, 98, 238, 84, 83, + /* 710 */ 98, 84, 83, 1, 84, 83, 98, 84, 83, 83, + /* 720 */ 133, 98, 133, 83, 83, 116, 83, 117, 79, 71, + /* 730 */ 88, 87, 5, 88, 87, 9, 5, 5, 5, 5, + /* 740 */ 5, 5, 5, 15, 83, 86, 79, 84, 26, 118, + /* 750 */ 84, 83, 60, 148, 16, 16, 5, 5, 98, 148, + /* 760 */ 84, 148, 148, 5, 5, 5, 5, 5, 5, 5, + /* 770 */ 5, 5, 5, 5, 5, 5, 5, 5, 98, 86, + /* 780 */ 61, 0, 278, 278, 278, 278, 278, 278, 278, 278, + /* 790 */ 278, 278, 278, 278, 21, 21, 278, 278, 278, 278, /* 800 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 810 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 820 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, @@ -395,113 +397,118 @@ static const YYCODETYPE yy_lookahead[] = { /* 940 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 950 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, /* 960 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 970 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 980 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, + /* 990 */ 278, 278, 278, }; -#define YY_SHIFT_COUNT (367) +#define YY_SHIFT_COUNT (370) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (758) +#define YY_SHIFT_MAX (781) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 195, 111, 111, 272, 272, 22, 240, 258, 258, 23, - /* 10 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 20 */ 311, 311, 311, 0, 121, 258, 309, 309, 309, 216, - /* 30 */ 216, 311, 311, 60, 311, 302, 311, 311, 311, 311, - /* 40 */ 330, 22, 25, 25, 83, 773, 773, 773, 258, 258, - /* 50 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - /* 60 */ 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - /* 70 */ 309, 309, 309, 126, 126, 126, 126, 126, 126, 126, - /* 80 */ 311, 311, 311, 331, 311, 311, 311, 216, 216, 311, - /* 90 */ 311, 311, 311, 223, 223, 224, 216, 311, 311, 311, - /* 100 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 110 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 120 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 130 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 140 */ 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - /* 150 */ 311, 311, 311, 311, 311, 311, 475, 475, 475, 420, - /* 160 */ 420, 420, 420, 475, 475, 428, 431, 435, 438, 440, - /* 170 */ 446, 466, 472, 490, 473, 475, 475, 475, 447, 447, - /* 180 */ 501, 22, 22, 475, 475, 525, 527, 572, 532, 531, - /* 190 */ 573, 537, 540, 501, 83, 475, 475, 548, 548, 475, - /* 200 */ 548, 475, 548, 475, 475, 773, 773, 29, 69, 69, - /* 210 */ 98, 69, 168, 124, 217, 268, 268, 268, 268, 268, - /* 220 */ 268, 261, 290, 40, 40, 40, 40, 241, 248, 100, - /* 230 */ 175, 116, 116, 278, 279, 340, 372, 318, 310, 326, - /* 240 */ 335, 355, 358, 303, 334, 366, 367, 368, 371, 375, - /* 250 */ 236, 376, 377, 439, 396, 364, 378, 322, 337, 338, - /* 260 */ 483, 484, 346, 347, 20, 350, 401, 629, 482, 633, - /* 270 */ 634, 486, 637, 640, 545, 547, 506, 529, 535, 569, - /* 280 */ 533, 599, 570, 559, 586, 601, 603, 604, 607, 608, - /* 290 */ 589, 610, 611, 613, 690, 614, 596, 565, 602, 566, - /* 300 */ 618, 535, 619, 587, 621, 588, 627, 620, 622, 636, - /* 310 */ 705, 623, 625, 704, 709, 710, 711, 712, 713, 714, - /* 320 */ 715, 635, 707, 644, 641, 642, 609, 645, 699, 669, - /* 330 */ 716, 582, 583, 638, 638, 638, 638, 717, 590, 591, - /* 340 */ 638, 638, 638, 729, 730, 653, 638, 735, 736, 737, - /* 350 */ 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, - /* 360 */ 748, 749, 657, 670, 750, 751, 696, 758, + /* 0 */ 235, 151, 151, 312, 312, 47, 280, 298, 298, 218, + /* 10 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 20 */ 23, 23, 23, 0, 135, 298, 349, 349, 349, 80, + /* 30 */ 80, 23, 23, 119, 23, 201, 23, 23, 23, 23, + /* 40 */ 23, 141, 47, 44, 44, 48, 796, 796, 796, 298, + /* 50 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + /* 60 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + /* 70 */ 298, 349, 349, 349, 2, 2, 2, 2, 2, 2, + /* 80 */ 2, 23, 23, 23, 39, 23, 23, 23, 80, 80, + /* 90 */ 23, 23, 23, 23, 352, 352, 345, 80, 23, 23, + /* 100 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 110 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 120 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 130 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 140 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + /* 150 */ 23, 23, 23, 23, 23, 23, 23, 487, 487, 487, + /* 160 */ 444, 444, 444, 444, 487, 487, 448, 447, 449, 452, + /* 170 */ 460, 466, 476, 481, 490, 497, 487, 487, 487, 543, + /* 180 */ 543, 525, 47, 47, 487, 487, 548, 550, 595, 556, + /* 190 */ 555, 597, 557, 564, 525, 48, 487, 487, 572, 572, + /* 200 */ 487, 572, 487, 572, 487, 487, 796, 796, 29, 69, + /* 210 */ 98, 98, 98, 129, 182, 208, 257, 308, 308, 308, + /* 220 */ 308, 308, 308, 301, 330, 40, 40, 40, 40, 145, + /* 230 */ 281, 297, 30, 90, 90, 173, 234, 258, 344, 376, + /* 240 */ 370, 377, 378, 379, 380, 367, 254, 382, 386, 387, + /* 250 */ 389, 391, 396, 397, 398, 471, 422, 473, 406, 67, + /* 260 */ 214, 346, 492, 495, 355, 360, 410, 363, 434, 653, + /* 270 */ 505, 656, 657, 510, 664, 665, 570, 573, 529, 553, + /* 280 */ 559, 593, 580, 619, 594, 607, 608, 624, 626, 627, + /* 290 */ 629, 630, 612, 632, 633, 635, 712, 636, 618, 587, + /* 300 */ 623, 589, 640, 559, 641, 609, 643, 610, 649, 642, + /* 310 */ 644, 658, 727, 645, 647, 726, 731, 732, 733, 734, + /* 320 */ 735, 736, 737, 659, 728, 667, 661, 663, 666, 631, + /* 330 */ 668, 722, 692, 738, 605, 611, 660, 660, 660, 660, + /* 340 */ 739, 613, 614, 660, 660, 660, 751, 752, 676, 660, + /* 350 */ 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, + /* 360 */ 768, 769, 770, 771, 772, 680, 693, 773, 774, 719, + /* 370 */ 781, }; -#define YY_REDUCE_COUNT (206) -#define YY_REDUCE_MIN (-262) -#define YY_REDUCE_MAX (481) +#define YY_REDUCE_COUNT (207) +#define YY_REDUCE_MIN (-266) +#define YY_REDUCE_MAX (499) static const short yy_reduce_ofst[] = { - /* 0 */ -186, 2, 2, -163, -163, -41, -134, 55, 63, -168, - /* 10 */ 57, 75, 56, 148, 167, 169, 170, 176, 181, 182, - /* 20 */ 190, 200, 201, -189, -197, -262, -212, -211, -201, -105, - /* 30 */ 3, -181, -82, -187, -199, 198, -191, 128, 157, -146, - /* 40 */ -76, 205, 39, 138, -216, 4, -3, 219, -259, -118, - /* 50 */ -20, -18, 47, 106, 192, 197, 211, 221, 231, 233, - /* 60 */ 234, 235, 237, 238, 239, 242, 243, 244, 245, 246, - /* 70 */ 218, 222, 253, 267, 274, 275, 276, 277, 280, 281, - /* 80 */ 308, 319, 323, 252, 324, 325, 327, 282, 283, 328, - /* 90 */ 329, 332, 333, 250, 259, 270, 286, 336, 339, 341, - /* 100 */ 342, 343, 344, 345, 348, 349, 351, 352, 353, 354, - /* 110 */ 356, 357, 359, 360, 361, 362, 363, 365, 369, 370, - /* 120 */ 373, 374, 379, 380, 381, 382, 383, 384, 385, 386, - /* 130 */ 387, 388, 389, 390, 391, 392, 393, 394, 395, 397, - /* 140 */ 398, 399, 400, 402, 403, 404, 405, 406, 407, 408, - /* 150 */ 409, 410, 411, 412, 413, 414, 415, 416, 417, 269, - /* 160 */ 284, 287, 293, 418, 419, 304, 285, 289, 312, 421, - /* 170 */ 320, 422, 425, 423, 424, 426, 427, 429, 430, 432, - /* 180 */ 433, 437, 441, 434, 436, 442, 444, 443, 445, 448, - /* 190 */ 449, 450, 454, 451, 452, 453, 455, 456, 458, 467, - /* 200 */ 468, 471, 479, 474, 481, 461, 470, + /* 0 */ -186, 42, 42, -163, -163, -67, -106, -105, -100, -166, + /* 10 */ 97, 17, -32, 109, 124, 143, 162, 171, 189, 190, + /* 20 */ 191, 197, 198, -195, -197, -258, -239, -201, -161, -232, + /* 30 */ -229, -152, -133, 31, -20, 169, 168, 170, 222, 237, + /* 40 */ 84, 215, 99, 239, 243, 231, -157, 248, 255, -266, + /* 50 */ -261, -118, -60, 22, 43, 73, 117, 249, 250, 251, + /* 60 */ 252, 253, 256, 260, 261, 262, 263, 264, 265, 266, + /* 70 */ 267, 65, 271, 272, 284, 285, 295, 296, 299, 300, + /* 80 */ 302, 337, 338, 341, 277, 347, 348, 350, 303, 304, + /* 90 */ 353, 354, 356, 357, 268, 269, 294, 307, 358, 359, + /* 100 */ 361, 362, 364, 365, 366, 368, 369, 371, 372, 373, + /* 110 */ 374, 375, 381, 383, 384, 385, 388, 390, 393, 394, + /* 120 */ 395, 399, 400, 401, 402, 403, 404, 405, 407, 408, + /* 130 */ 409, 411, 412, 413, 414, 415, 416, 417, 418, 419, + /* 140 */ 420, 421, 423, 424, 425, 426, 427, 428, 429, 430, + /* 150 */ 431, 432, 433, 435, 436, 437, 438, 439, 440, 441, + /* 160 */ 289, 292, 305, 306, 442, 443, 315, 317, 319, 331, + /* 170 */ 339, 309, 392, 445, 450, 446, 451, 453, 454, 455, + /* 180 */ 456, 457, 458, 461, 459, 462, 463, 465, 464, 467, + /* 190 */ 468, 472, 470, 475, 469, 474, 477, 478, 488, 489, + /* 200 */ 479, 491, 493, 499, 496, 498, 484, 486, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 870, 994, 933, 1004, 920, 930, 1145, 1145, 1145, 870, - /* 10 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 20 */ 870, 870, 870, 1052, 890, 1145, 870, 870, 870, 870, - /* 30 */ 870, 870, 870, 1067, 870, 930, 870, 870, 870, 870, - /* 40 */ 940, 930, 940, 940, 870, 1047, 978, 996, 870, 870, - /* 50 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 60 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 70 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 80 */ 870, 870, 870, 1054, 1060, 1057, 870, 870, 870, 1062, - /* 90 */ 870, 870, 870, 1086, 1086, 1045, 870, 870, 870, 870, - /* 100 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 110 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 120 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 918, - /* 130 */ 870, 916, 870, 870, 870, 870, 870, 870, 870, 870, - /* 140 */ 870, 870, 870, 870, 870, 870, 870, 870, 901, 870, - /* 150 */ 870, 870, 870, 870, 870, 888, 892, 892, 892, 870, - /* 160 */ 870, 870, 870, 892, 892, 1093, 1097, 1079, 1091, 1087, - /* 170 */ 1074, 1072, 1070, 1078, 1101, 892, 892, 892, 938, 938, - /* 180 */ 934, 930, 930, 892, 892, 956, 954, 952, 944, 950, - /* 190 */ 946, 948, 942, 921, 870, 892, 892, 928, 928, 892, - /* 200 */ 928, 892, 928, 892, 892, 978, 996, 870, 1102, 1092, - /* 210 */ 870, 1144, 1132, 1131, 870, 1140, 1139, 1138, 1130, 1129, - /* 220 */ 1128, 870, 870, 1124, 1127, 1126, 1125, 870, 870, 870, - /* 230 */ 870, 1134, 1133, 870, 870, 870, 870, 870, 870, 870, - /* 240 */ 870, 870, 870, 1098, 1094, 870, 870, 870, 870, 870, - /* 250 */ 870, 870, 870, 870, 1104, 870, 870, 870, 870, 870, - /* 260 */ 870, 870, 870, 870, 1006, 870, 870, 870, 870, 870, - /* 270 */ 870, 870, 870, 870, 870, 870, 870, 1044, 870, 870, - /* 280 */ 870, 870, 870, 1056, 1055, 870, 870, 870, 870, 870, - /* 290 */ 870, 870, 870, 870, 870, 870, 1088, 870, 1080, 870, - /* 300 */ 870, 1018, 870, 870, 870, 870, 870, 870, 870, 870, - /* 310 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 320 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 330 */ 870, 870, 870, 1163, 1158, 1159, 1156, 870, 870, 870, - /* 340 */ 1155, 1150, 1151, 870, 870, 870, 1148, 870, 870, 870, - /* 350 */ 870, 870, 870, 870, 870, 870, 870, 870, 870, 870, - /* 360 */ 870, 870, 962, 870, 899, 897, 870, 870, + /* 0 */ 875, 999, 938, 1009, 925, 935, 1151, 1151, 1151, 875, + /* 10 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 20 */ 875, 875, 875, 1057, 895, 1151, 875, 875, 875, 875, + /* 30 */ 875, 875, 875, 1072, 875, 935, 875, 875, 875, 875, + /* 40 */ 875, 945, 935, 945, 945, 875, 1052, 983, 1001, 875, + /* 50 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 60 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 70 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 80 */ 875, 875, 875, 875, 1059, 1065, 1062, 875, 875, 875, + /* 90 */ 1067, 875, 875, 875, 1091, 1091, 1050, 875, 875, 875, + /* 100 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 110 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 120 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 130 */ 923, 875, 921, 875, 875, 875, 875, 875, 875, 875, + /* 140 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 906, + /* 150 */ 875, 875, 875, 875, 875, 875, 893, 897, 897, 897, + /* 160 */ 875, 875, 875, 875, 897, 897, 1098, 1102, 1084, 1096, + /* 170 */ 1092, 1079, 1077, 1075, 1083, 1106, 897, 897, 897, 943, + /* 180 */ 943, 939, 935, 935, 897, 897, 961, 959, 957, 949, + /* 190 */ 955, 951, 953, 947, 926, 875, 897, 897, 933, 933, + /* 200 */ 897, 933, 897, 933, 897, 897, 983, 1001, 1150, 875, + /* 210 */ 1107, 1097, 1150, 875, 1138, 1137, 875, 1146, 1145, 1144, + /* 220 */ 1136, 1135, 1134, 875, 875, 1130, 1133, 1132, 1131, 875, + /* 230 */ 875, 875, 875, 1140, 1139, 875, 875, 875, 875, 875, + /* 240 */ 875, 875, 875, 875, 875, 1103, 1099, 875, 875, 875, + /* 250 */ 875, 875, 875, 875, 875, 875, 1109, 875, 875, 875, + /* 260 */ 875, 875, 875, 875, 875, 875, 1011, 875, 875, 875, + /* 270 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 1049, + /* 280 */ 875, 875, 875, 875, 875, 1061, 1060, 875, 875, 875, + /* 290 */ 875, 875, 875, 875, 875, 875, 875, 875, 1093, 875, + /* 300 */ 1085, 875, 875, 1023, 875, 875, 875, 875, 875, 875, + /* 310 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 320 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 330 */ 875, 875, 875, 875, 875, 875, 1169, 1164, 1165, 1162, + /* 340 */ 875, 875, 875, 1161, 1156, 1157, 875, 875, 875, 1154, + /* 350 */ 875, 875, 875, 875, 875, 875, 875, 875, 875, 875, + /* 360 */ 875, 875, 875, 875, 875, 967, 875, 904, 902, 875, + /* 370 */ 875, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1339,51 +1346,52 @@ static const char *const yyRuleName[] = { /* 246 */ "expr ::= NULL", /* 247 */ "expr ::= ID LP exprlist RP", /* 248 */ "expr ::= ID LP STAR RP", - /* 249 */ "expr ::= expr IS NULL", - /* 250 */ "expr ::= expr IS NOT NULL", - /* 251 */ "expr ::= expr LT expr", - /* 252 */ "expr ::= expr GT expr", - /* 253 */ "expr ::= expr LE expr", - /* 254 */ "expr ::= expr GE expr", - /* 255 */ "expr ::= expr NE expr", - /* 256 */ "expr ::= expr EQ expr", - /* 257 */ "expr ::= expr BETWEEN expr AND expr", - /* 258 */ "expr ::= expr AND expr", - /* 259 */ "expr ::= expr OR expr", - /* 260 */ "expr ::= expr PLUS expr", - /* 261 */ "expr ::= expr MINUS expr", - /* 262 */ "expr ::= expr STAR expr", - /* 263 */ "expr ::= expr SLASH expr", - /* 264 */ "expr ::= expr REM expr", - /* 265 */ "expr ::= expr LIKE expr", - /* 266 */ "expr ::= expr MATCH expr", - /* 267 */ "expr ::= expr NMATCH expr", - /* 268 */ "expr ::= expr IN LP exprlist RP", - /* 269 */ "exprlist ::= exprlist COMMA expritem", - /* 270 */ "exprlist ::= expritem", - /* 271 */ "expritem ::= expr", - /* 272 */ "expritem ::=", - /* 273 */ "cmd ::= RESET QUERY CACHE", - /* 274 */ "cmd ::= SYNCDB ids REPLICA", - /* 275 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 276 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 277 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", - /* 278 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 279 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 280 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 281 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 282 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", - /* 283 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", - /* 284 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", - /* 285 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", - /* 286 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", - /* 287 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", - /* 288 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", - /* 289 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", - /* 290 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", - /* 291 */ "cmd ::= KILL CONNECTION INTEGER", - /* 292 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 293 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 249 */ "expr ::= ID LP expr AS typename RP", + /* 250 */ "expr ::= expr IS NULL", + /* 251 */ "expr ::= expr IS NOT NULL", + /* 252 */ "expr ::= expr LT expr", + /* 253 */ "expr ::= expr GT expr", + /* 254 */ "expr ::= expr LE expr", + /* 255 */ "expr ::= expr GE expr", + /* 256 */ "expr ::= expr NE expr", + /* 257 */ "expr ::= expr EQ expr", + /* 258 */ "expr ::= expr BETWEEN expr AND expr", + /* 259 */ "expr ::= expr AND expr", + /* 260 */ "expr ::= expr OR expr", + /* 261 */ "expr ::= expr PLUS expr", + /* 262 */ "expr ::= expr MINUS expr", + /* 263 */ "expr ::= expr STAR expr", + /* 264 */ "expr ::= expr SLASH expr", + /* 265 */ "expr ::= expr REM expr", + /* 266 */ "expr ::= expr LIKE expr", + /* 267 */ "expr ::= expr MATCH expr", + /* 268 */ "expr ::= expr NMATCH expr", + /* 269 */ "expr ::= expr IN LP exprlist RP", + /* 270 */ "exprlist ::= exprlist COMMA expritem", + /* 271 */ "exprlist ::= expritem", + /* 272 */ "expritem ::= expr", + /* 273 */ "expritem ::=", + /* 274 */ "cmd ::= RESET QUERY CACHE", + /* 275 */ "cmd ::= SYNCDB ids REPLICA", + /* 276 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 277 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 278 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", + /* 279 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 280 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 281 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 282 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 283 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", + /* 284 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", + /* 285 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", + /* 286 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", + /* 287 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", + /* 288 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", + /* 289 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", + /* 290 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", + /* 291 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", + /* 292 */ "cmd ::= KILL CONNECTION INTEGER", + /* 293 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 294 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -2100,51 +2108,52 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 266, /* (246) expr ::= NULL */ 266, /* (247) expr ::= ID LP exprlist RP */ 266, /* (248) expr ::= ID LP STAR RP */ - 266, /* (249) expr ::= expr IS NULL */ - 266, /* (250) expr ::= expr IS NOT NULL */ - 266, /* (251) expr ::= expr LT expr */ - 266, /* (252) expr ::= expr GT expr */ - 266, /* (253) expr ::= expr LE expr */ - 266, /* (254) expr ::= expr GE expr */ - 266, /* (255) expr ::= expr NE expr */ - 266, /* (256) expr ::= expr EQ expr */ - 266, /* (257) expr ::= expr BETWEEN expr AND expr */ - 266, /* (258) expr ::= expr AND expr */ - 266, /* (259) expr ::= expr OR expr */ - 266, /* (260) expr ::= expr PLUS expr */ - 266, /* (261) expr ::= expr MINUS expr */ - 266, /* (262) expr ::= expr STAR expr */ - 266, /* (263) expr ::= expr SLASH expr */ - 266, /* (264) expr ::= expr REM expr */ - 266, /* (265) expr ::= expr LIKE expr */ - 266, /* (266) expr ::= expr MATCH expr */ - 266, /* (267) expr ::= expr NMATCH expr */ - 266, /* (268) expr ::= expr IN LP exprlist RP */ - 206, /* (269) exprlist ::= exprlist COMMA expritem */ - 206, /* (270) exprlist ::= expritem */ - 277, /* (271) expritem ::= expr */ - 277, /* (272) expritem ::= */ - 198, /* (273) cmd ::= RESET QUERY CACHE */ - 198, /* (274) cmd ::= SYNCDB ids REPLICA */ - 198, /* (275) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 198, /* (276) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 198, /* (277) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - 198, /* (278) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 198, /* (279) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 198, /* (280) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 198, /* (281) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 198, /* (282) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - 198, /* (283) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 198, /* (284) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 198, /* (285) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - 198, /* (286) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 198, /* (287) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 198, /* (288) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 198, /* (289) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - 198, /* (290) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - 198, /* (291) cmd ::= KILL CONNECTION INTEGER */ - 198, /* (292) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 198, /* (293) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + 266, /* (249) expr ::= ID LP expr AS typename RP */ + 266, /* (250) expr ::= expr IS NULL */ + 266, /* (251) expr ::= expr IS NOT NULL */ + 266, /* (252) expr ::= expr LT expr */ + 266, /* (253) expr ::= expr GT expr */ + 266, /* (254) expr ::= expr LE expr */ + 266, /* (255) expr ::= expr GE expr */ + 266, /* (256) expr ::= expr NE expr */ + 266, /* (257) expr ::= expr EQ expr */ + 266, /* (258) expr ::= expr BETWEEN expr AND expr */ + 266, /* (259) expr ::= expr AND expr */ + 266, /* (260) expr ::= expr OR expr */ + 266, /* (261) expr ::= expr PLUS expr */ + 266, /* (262) expr ::= expr MINUS expr */ + 266, /* (263) expr ::= expr STAR expr */ + 266, /* (264) expr ::= expr SLASH expr */ + 266, /* (265) expr ::= expr REM expr */ + 266, /* (266) expr ::= expr LIKE expr */ + 266, /* (267) expr ::= expr MATCH expr */ + 266, /* (268) expr ::= expr NMATCH expr */ + 266, /* (269) expr ::= expr IN LP exprlist RP */ + 206, /* (270) exprlist ::= exprlist COMMA expritem */ + 206, /* (271) exprlist ::= expritem */ + 277, /* (272) expritem ::= expr */ + 277, /* (273) expritem ::= */ + 198, /* (274) cmd ::= RESET QUERY CACHE */ + 198, /* (275) cmd ::= SYNCDB ids REPLICA */ + 198, /* (276) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + 198, /* (277) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + 198, /* (278) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + 198, /* (279) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + 198, /* (280) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + 198, /* (281) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + 198, /* (282) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + 198, /* (283) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + 198, /* (284) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + 198, /* (285) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + 198, /* (286) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + 198, /* (287) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + 198, /* (288) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + 198, /* (289) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + 198, /* (290) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + 198, /* (291) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + 198, /* (292) cmd ::= KILL CONNECTION INTEGER */ + 198, /* (293) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + 198, /* (294) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -2399,51 +2408,52 @@ static const signed char yyRuleInfoNRhs[] = { -1, /* (246) expr ::= NULL */ -4, /* (247) expr ::= ID LP exprlist RP */ -4, /* (248) expr ::= ID LP STAR RP */ - -3, /* (249) expr ::= expr IS NULL */ - -4, /* (250) expr ::= expr IS NOT NULL */ - -3, /* (251) expr ::= expr LT expr */ - -3, /* (252) expr ::= expr GT expr */ - -3, /* (253) expr ::= expr LE expr */ - -3, /* (254) expr ::= expr GE expr */ - -3, /* (255) expr ::= expr NE expr */ - -3, /* (256) expr ::= expr EQ expr */ - -5, /* (257) expr ::= expr BETWEEN expr AND expr */ - -3, /* (258) expr ::= expr AND expr */ - -3, /* (259) expr ::= expr OR expr */ - -3, /* (260) expr ::= expr PLUS expr */ - -3, /* (261) expr ::= expr MINUS expr */ - -3, /* (262) expr ::= expr STAR expr */ - -3, /* (263) expr ::= expr SLASH expr */ - -3, /* (264) expr ::= expr REM expr */ - -3, /* (265) expr ::= expr LIKE expr */ - -3, /* (266) expr ::= expr MATCH expr */ - -3, /* (267) expr ::= expr NMATCH expr */ - -5, /* (268) expr ::= expr IN LP exprlist RP */ - -3, /* (269) exprlist ::= exprlist COMMA expritem */ - -1, /* (270) exprlist ::= expritem */ - -1, /* (271) expritem ::= expr */ - 0, /* (272) expritem ::= */ - -3, /* (273) cmd ::= RESET QUERY CACHE */ - -3, /* (274) cmd ::= SYNCDB ids REPLICA */ - -7, /* (275) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (276) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (277) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (278) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (279) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (280) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (281) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (282) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ - -7, /* (283) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (284) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (285) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ - -7, /* (286) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (287) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (288) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (289) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (290) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ - -3, /* (291) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (292) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (293) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + -6, /* (249) expr ::= ID LP expr AS typename RP */ + -3, /* (250) expr ::= expr IS NULL */ + -4, /* (251) expr ::= expr IS NOT NULL */ + -3, /* (252) expr ::= expr LT expr */ + -3, /* (253) expr ::= expr GT expr */ + -3, /* (254) expr ::= expr LE expr */ + -3, /* (255) expr ::= expr GE expr */ + -3, /* (256) expr ::= expr NE expr */ + -3, /* (257) expr ::= expr EQ expr */ + -5, /* (258) expr ::= expr BETWEEN expr AND expr */ + -3, /* (259) expr ::= expr AND expr */ + -3, /* (260) expr ::= expr OR expr */ + -3, /* (261) expr ::= expr PLUS expr */ + -3, /* (262) expr ::= expr MINUS expr */ + -3, /* (263) expr ::= expr STAR expr */ + -3, /* (264) expr ::= expr SLASH expr */ + -3, /* (265) expr ::= expr REM expr */ + -3, /* (266) expr ::= expr LIKE expr */ + -3, /* (267) expr ::= expr MATCH expr */ + -3, /* (268) expr ::= expr NMATCH expr */ + -5, /* (269) expr ::= expr IN LP exprlist RP */ + -3, /* (270) exprlist ::= exprlist COMMA expritem */ + -1, /* (271) exprlist ::= expritem */ + -1, /* (272) expritem ::= expr */ + 0, /* (273) expritem ::= */ + -3, /* (274) cmd ::= RESET QUERY CACHE */ + -3, /* (275) cmd ::= SYNCDB ids REPLICA */ + -7, /* (276) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (277) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + -7, /* (278) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (279) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + -7, /* (280) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + -8, /* (281) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (282) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (283) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + -7, /* (284) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + -7, /* (285) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + -7, /* (286) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + -7, /* (287) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + -7, /* (288) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + -8, /* (289) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + -9, /* (290) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + -7, /* (291) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + -3, /* (292) cmd ::= KILL CONNECTION INTEGER */ + -5, /* (293) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + -5, /* (294) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3282,7 +3292,7 @@ static YYACTIONTYPE yy_reduce( break; case 218: /* having_opt ::= */ case 228: /* where_opt ::= */ yytestcase(yyruleno==228); - case 272: /* expritem ::= */ yytestcase(yyruleno==272); + case 273: /* expritem ::= */ yytestcase(yyruleno==273); {yymsp[1].minor.yy439 = 0;} break; case 219: /* having_opt ::= HAVING expr */ @@ -3376,112 +3386,116 @@ static YYACTIONTYPE yy_reduce( { tStrTokenAppend(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy439 = yylhsminor.yy439; break; - case 249: /* expr ::= expr IS NULL */ + case 249: /* expr ::= ID LP expr AS typename RP */ +{ tStrTokenAppend(pInfo->funcs, &yymsp[-5].minor.yy0); yylhsminor.yy439 = tSqlExprCreateFuncWithParams(pInfo, yymsp[-3].minor.yy439, &yymsp[-1].minor.yy183, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, yymsp[-5].minor.yy0.type); } + yymsp[-5].minor.yy439 = yylhsminor.yy439; + break; + case 250: /* expr ::= expr IS NULL */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, NULL, TK_ISNULL);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 250: /* expr ::= expr IS NOT NULL */ + case 251: /* expr ::= expr IS NOT NULL */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-3].minor.yy439, NULL, TK_NOTNULL);} yymsp[-3].minor.yy439 = yylhsminor.yy439; break; - case 251: /* expr ::= expr LT expr */ + case 252: /* expr ::= expr LT expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LT);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 252: /* expr ::= expr GT expr */ + case 253: /* expr ::= expr GT expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GT);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 253: /* expr ::= expr LE expr */ + case 254: /* expr ::= expr LE expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LE);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 254: /* expr ::= expr GE expr */ + case 255: /* expr ::= expr GE expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_GE);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 255: /* expr ::= expr NE expr */ + case 256: /* expr ::= expr NE expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NE);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 256: /* expr ::= expr EQ expr */ + case 257: /* expr ::= expr EQ expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_EQ);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 257: /* expr ::= expr BETWEEN expr AND expr */ + case 258: /* expr ::= expr BETWEEN expr AND expr */ { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy439); yylhsminor.yy439 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy439, yymsp[-2].minor.yy439, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy439, TK_LE), TK_AND);} yymsp[-4].minor.yy439 = yylhsminor.yy439; break; - case 258: /* expr ::= expr AND expr */ + case 259: /* expr ::= expr AND expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_AND);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 259: /* expr ::= expr OR expr */ + case 260: /* expr ::= expr OR expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_OR); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 260: /* expr ::= expr PLUS expr */ + case 261: /* expr ::= expr PLUS expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_PLUS); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 261: /* expr ::= expr MINUS expr */ + case 262: /* expr ::= expr MINUS expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MINUS); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 262: /* expr ::= expr STAR expr */ + case 263: /* expr ::= expr STAR expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_STAR); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 263: /* expr ::= expr SLASH expr */ + case 264: /* expr ::= expr SLASH expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_DIVIDE);} yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 264: /* expr ::= expr REM expr */ + case 265: /* expr ::= expr REM expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_REM); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 265: /* expr ::= expr LIKE expr */ + case 266: /* expr ::= expr LIKE expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_LIKE); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 266: /* expr ::= expr MATCH expr */ + case 267: /* expr ::= expr MATCH expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_MATCH); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 267: /* expr ::= expr NMATCH expr */ + case 268: /* expr ::= expr NMATCH expr */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-2].minor.yy439, yymsp[0].minor.yy439, TK_NMATCH); } yymsp[-2].minor.yy439 = yylhsminor.yy439; break; - case 268: /* expr ::= expr IN LP exprlist RP */ + case 269: /* expr ::= expr IN LP exprlist RP */ {yylhsminor.yy439 = tSqlExprCreate(yymsp[-4].minor.yy439, (tSqlExpr*)yymsp[-1].minor.yy421, TK_IN); } yymsp[-4].minor.yy439 = yylhsminor.yy439; break; - case 269: /* exprlist ::= exprlist COMMA expritem */ + case 270: /* exprlist ::= exprlist COMMA expritem */ {yylhsminor.yy421 = tSqlExprListAppend(yymsp[-2].minor.yy421,yymsp[0].minor.yy439,0, 0);} yymsp[-2].minor.yy421 = yylhsminor.yy421; break; - case 270: /* exprlist ::= expritem */ + case 271: /* exprlist ::= expritem */ {yylhsminor.yy421 = tSqlExprListAppend(0,yymsp[0].minor.yy439,0, 0);} yymsp[0].minor.yy421 = yylhsminor.yy421; break; - case 271: /* expritem ::= expr */ + case 272: /* expritem ::= expr */ {yylhsminor.yy439 = yymsp[0].minor.yy439;} yymsp[0].minor.yy439 = yylhsminor.yy439; break; - case 273: /* cmd ::= RESET QUERY CACHE */ + case 274: /* cmd ::= RESET QUERY CACHE */ { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 274: /* cmd ::= SYNCDB ids REPLICA */ + case 275: /* cmd ::= SYNCDB ids REPLICA */ { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} break; - case 275: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 276: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 276: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 277: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3492,21 +3506,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 277: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ + case 278: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 278: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 279: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 279: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 280: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3517,7 +3531,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 280: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 281: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3531,7 +3545,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 281: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 282: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3543,21 +3557,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 282: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ + case 283: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 283: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + case 284: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 284: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + case 285: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3568,21 +3582,21 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 285: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ + case 286: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 286: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + case 287: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 287: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + case 288: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -3593,7 +3607,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 288: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + case 289: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -3607,7 +3621,7 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 289: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ + case 290: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -3619,20 +3633,20 @@ static YYACTIONTYPE yy_reduce( setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 290: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ + case 291: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 291: /* cmd ::= KILL CONNECTION INTEGER */ + case 292: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 292: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 293: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 293: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 294: /* 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/tests/script/general/compute/cast.sim b/tests/script/general/compute/cast.sim new file mode 100644 index 0000000000..5aea07d9a3 --- /dev/null +++ b/tests/script/general/compute/cast.sim @@ -0,0 +1,479 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c maxtablespervnode -v 6 +system sh/cfg.sh -n dnode1 -c cache -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect + +sql drop database if exists db +sql create database if not exists db +sql use db +sql create table stb1 (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double) + +sql create table tb1 using stb1 tags(1,'1',1.0) +sql create table tb2 using stb1 tags(2,'2',2.0) + + +sql insert into tb1 values ('2021-11-11 09:00:00',true,1,1,1,1,1,1,"1","1",1,1,1,1); +sql insert into tb1 values ('2021-11-11 09:00:01',true,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +sql insert into tb1 values ('2021-11-11 09:00:02',true,2,NULL,2,NULL,2,NULL,"2",NULL,2,NULL,2,NULL); +sql insert into tb1 values ('2021-11-11 09:00:03',false,NULL,3,NULL,3,NULL,3,NULL,"3",NULL,3,NULL,3); +sql insert into tb1 values ('2021-11-11 09:00:04',true,4,4,4,4,4,4,"4","4",4,4,4,4); +sql insert into tb1 values ('2021-11-11 09:00:05',true,127,32767,2147483647,9223372036854775807,3.402823466e+38,1.79769e+308,"5","5",254,65534,4294967294,9223372036854775807); +sql insert into tb1 values ('2021-11-11 09:00:06',true,-127,-32767,-2147483647,-9223372036854775807,-3.402823466e+38,-1.79769e+308,"6","6",0,0,0,0); + +sql_error select cast(* as tinyint) from tb1; +sql_error select cast(* as smallint) from tb1; +sql_error select cast(* as int) from tb1; +sql_error select cast(* as bool) from tb1; +sql_error select cast(* as bigint) as a from tb1; +sql_error select cast(* as bigint) + 1 as a from tb1; +sql_error select cast(tb1.* as bigint) + 1 as a from tb1; +sql_error select cast(* as bigint) from tb1; +sql_error select cast(c1 + c2 as bigint) from tb1; +sql_error select cast(c1 as binary(0)) from tb1; +sql_error select cast(c1 as binary(-1)) from tb1; +sql_error select cast(c1 as nchar(0)) from tb1; +sql_error select cast(c1 as nchar(-1)) from tb1; +sql_error select cast(c1 as tinyint) from tb1; +sql_error select cast(c1 as bool) from tb1; +sql_error select cast(c1 as smallint) from tb1; +sql_error select cast(c1 as int) from tb1; +sql_error select cast(c1 as float) from tb1; +sql_error select cast(c1 as double) from tb1; +sql_error select cast(c1 as tinyint unsigned) from tb1; +sql_error select cast(c1 as smallint unsigned) from tb1; +sql_error select cast(c1 as int unsigned) from tb1; +sql_error select cast(c2 as binary(0)) from tb1; +sql_error select cast(c2 as binary(-1)) from tb1; +sql_error select cast(c2 as nchar(0)) from tb1; +sql_error select cast(c2 as nchar(-1)) from tb1; +sql_error select cast(c2 as tinyint) from tb1; +sql_error select cast(c2 as bool) from tb1; +sql_error select cast(c2 as smallint) from tb1; +sql_error select cast(c2 as int) from tb1; +sql_error select cast(c2 as float) from tb1; +sql_error select cast(c2 as double) from tb1; +sql_error select cast(c2 as tinyint unsigned) from tb1; +sql_error select cast(c2 as smallint unsigned) from tb1; +sql_error select cast(c2 as int unsigned) from tb1; + +sql select cast(c1 as bigint) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 1 then + return -1 +endi +if $data20 != 1 then + return -1 +endi +if $data30 != 0 then + return -1 +endi +if $data40 != 1 then + return -1 +endi +if $data50 != 1 then + return -1 +endi +if $data60 != 1 then + return -1 +endi +sql select cast(c1 as binary(10)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != true then + return -1 +endi +if $data10 != true then + return -1 +endi +if $data20 != true then + return -1 +endi +if $data30 != false then + return -1 +endi +if $data40 != true then + return -1 +endi +if $data50 != true then + return -1 +endi +if $data60 != true then + return -1 +endi +sql select cast(c1 as binary(1)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != t then + return -1 +endi +if $data10 != t then + return -1 +endi +if $data20 != t then + return -1 +endi +if $data30 != f then + return -1 +endi +if $data40 != t then + return -1 +endi +if $data50 != t then + return -1 +endi +if $data60 != t then + return -1 +endi +sql select cast(c1 as timestamp) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data10 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data20 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data30 != @70-01-01 08:00:00.000@ then + return -1 +endi +if $data40 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data50 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data60 != @70-01-01 08:00:00.001@ then + return -1 +endi +sql select cast(c1 as nchar(10)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != true then + return -1 +endi +if $data10 != true then + return -1 +endi +if $data20 != true then + return -1 +endi +if $data30 != false then + return -1 +endi +if $data40 != true then + return -1 +endi +if $data50 != true then + return -1 +endi +if $data60 != true then + return -1 +endi +sql select cast(c1 as nchar(1)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != t then + return -1 +endi +if $data10 != t then + return -1 +endi +if $data20 != t then + return -1 +endi +if $data30 != f then + return -1 +endi +if $data40 != t then + return -1 +endi +if $data50 != t then + return -1 +endi +if $data60 != t then + return -1 +endi +sql select cast(c1 as bigint unsigned) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 1 then + return -1 +endi +if $data20 != 1 then + return -1 +endi +if $data30 != 0 then + return -1 +endi +if $data40 != 1 then + return -1 +endi +if $data50 != 1 then + return -1 +endi +if $data60 != 1 then + return -1 +endi + + +sql select cast(c2 as bigint) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4 then + return -1 +endi +if $data50 != 127 then + return -1 +endi +if $data60 != -127 then + return -1 +endi +sql select cast(c2 as binary(10)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4 then + return -1 +endi +if $data50 != 127 then + return -1 +endi +if $data60 != -127 then + return -1 +endi +sql select cast(c2 as binary(1)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4 then + return -1 +endi +if $data50 != 1 then + return -1 +endi +if $data60 != - then + return -1 +endi +sql select cast(c2 as timestamp) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != @70-01-01 08:00:00.001@ then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != @70-01-01 08:00:00.002@ then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != @70-01-01 08:00:00.004@ then + return -1 +endi +if $data50 != @70-01-01 08:00:00.127@ then + return -1 +endi +if $data60 != @70-01-01 08:00:00.-127@ then + print $data60 + return -1 +endi +sql select cast(c2 as nchar(10)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4 then + return -1 +endi +if $data50 != 127 then + return -1 +endi +if $data60 != -127 then + return -1 +endi +sql select cast(c2 as nchar(1)) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != 2 then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 4 then + return -1 +endi +if $data50 != 1 then + return -1 +endi +if $data60 != - then + return -1 +endi +sql select cast(c2 as bigint unsigned) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 1 then + return -1 +endi +if $data10 != 1 then + return -1 +endi +if $data20 != 1 then + return -1 +endi +if $data30 != 0 then + return -1 +endi +if $data40 != 1 then + return -1 +endi +if $data50 != 1 then + return -1 +endi +if $data60 != 1 then + return -1 +endi + + + + + + + +sql select cast(c2 + c3 as bigint) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 8 then + return -1 +endi +if $data50 != 32894 then + return -1 +endi +if $data60 != -32894 then + return -1 +endi +sql select cast((c2 + c3) as bigint) from tb1; +if $rows != 7 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data10 != NULL then + return -1 +endi +if $data20 != NULL then + return -1 +endi +if $data30 != NULL then + return -1 +endi +if $data40 != 8 then + return -1 +endi +if $data50 != 32894 then + return -1 +endi +if $data60 != -32894 then + return -1 +endi +sql select cast(c1 as bigint)+c2 from tb1; + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT + -- GitLab