提交 4d7b7127 编写于 作者: D dapan1121

Merge branch 'szhou/feature/support-math-functions' into feature/TD-6140

...@@ -4373,12 +4373,10 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr, ...@@ -4373,12 +4373,10 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr,
} }
{ {
if (TSDB_FUNC_IS_SCALAR(functionId)) { if (TSDB_FUNC_IS_SCALAR(functionId)) {
bool allChildValue = true;
bool anyChildScalar = false; bool anyChildScalar = false;
bool anyChildAgg = false; bool anyChildAgg = false;
for (int i = 0; i < numChildren; ++i) { for (int i = 0; i < numChildren; ++i) {
assert (childrenTypes[i] != SQLEXPR_TYPE_UNASSIGNED); assert (childrenTypes[i] != SQLEXPR_TYPE_UNASSIGNED);
allChildValue = allChildValue && (childrenTypes[i] == SQLEXPR_TYPE_VALUE);
anyChildScalar = anyChildScalar || (childrenTypes[i] == SQLEXPR_TYPE_SCALAR); anyChildScalar = anyChildScalar || (childrenTypes[i] == SQLEXPR_TYPE_SCALAR);
anyChildAgg = anyChildAgg || (childrenTypes[i] == SQLEXPR_TYPE_AGG); anyChildAgg = anyChildAgg || (childrenTypes[i] == SQLEXPR_TYPE_AGG);
} }
...@@ -4387,8 +4385,6 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr, ...@@ -4387,8 +4385,6 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr,
} }
if (anyChildAgg) { if (anyChildAgg) {
*type = SQLEXPR_TYPE_AGG; *type = SQLEXPR_TYPE_AGG;
} else if (allChildValue) {
*type = SQLEXPR_TYPE_VALUE;
} else { } else {
*type = SQLEXPR_TYPE_SCALAR; *type = SQLEXPR_TYPE_SCALAR;
} }
...@@ -7386,7 +7382,8 @@ static bool onlyTagPrjFunction(SQueryInfo* pQueryInfo) { ...@@ -7386,7 +7382,8 @@ static bool onlyTagPrjFunction(SQueryInfo* pQueryInfo) {
size_t size = taosArrayGetSize(pQueryInfo->exprList); size_t size = taosArrayGetSize(pQueryInfo->exprList);
for (int32_t i = 0; i < size; ++i) { for (int32_t i = 0; i < size; ++i) {
SExprInfo* pExpr = tscExprGet(pQueryInfo, i); SExprInfo* pExpr = tscExprGet(pQueryInfo, i);
if (pExpr->base.functionId == TSDB_FUNC_PRJ) { if (pExpr->base.functionId == TSDB_FUNC_PRJ ||
(pExpr->base.functionId == TSDB_FUNC_SCALAR_EXPR && ((pQueryInfo->type & TSDB_QUERY_TYPE_PROJECTION_QUERY) != 0))) {
hasColumnPrj = true; hasColumnPrj = true;
} else if (pExpr->base.functionId == TSDB_FUNC_TAGPRJ) { } else if (pExpr->base.functionId == TSDB_FUNC_TAGPRJ) {
hasTagPrj = true; hasTagPrj = true;
...@@ -7478,8 +7475,6 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) { ...@@ -7478,8 +7475,6 @@ static int32_t checkUpdateTagPrjFunctions(SQueryInfo* pQueryInfo, char* msg) {
if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0) { if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0) {
numOfSelectivity++; numOfSelectivity++;
} else if ((aAggs[functionId].status & TSDB_FUNCSTATE_SCALAR) != 0) {
numOfScalar++;
} else { } else {
numOfAggregation++; numOfAggregation++;
} }
...@@ -7721,7 +7716,8 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* ...@@ -7721,7 +7716,8 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char*
continue; continue;
} }
if (TSDB_FUNC_IS_SCALAR(f)) { if (f == TSDB_FUNC_SCALAR_EXPR &&
(pQueryInfo->type & TSDB_QUERY_TYPE_PROJECTION_QUERY) != 0) {
return invalidOperationMsg(msg, msg1); return invalidOperationMsg(msg, msg1);
} }
...@@ -7745,9 +7741,6 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char* ...@@ -7745,9 +7741,6 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char*
return invalidOperationMsg(msg, msg1); return invalidOperationMsg(msg, msg1);
} }
if (IS_SCALAR_FUNCTION(aAggs[f].status)) {
return invalidOperationMsg(msg, msg1);
}
if (f == TSDB_FUNC_COUNT && pExpr->base.colInfo.colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (f == TSDB_FUNC_COUNT && pExpr->base.colInfo.colIndex == TSDB_TBNAME_COLUMN_INDEX) {
return invalidOperationMsg(msg, msg1); return invalidOperationMsg(msg, msg1);
...@@ -9826,7 +9819,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS ...@@ -9826,7 +9819,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
SArray* paramList = pSqlExpr->Expr.paramList; SArray* paramList = pSqlExpr->Expr.paramList;
size_t paramSize = paramList ? taosArrayGetSize(paramList) : 0; size_t paramSize = paramList ? taosArrayGetSize(paramList) : 0;
if (paramSize > 0) { if (paramSize > 0) {
(*pExpr)->_func.numChildren = (uint8_t)paramSize; (*pExpr)->_func.numChildren = (int32_t)paramSize;
(*pExpr)->_func.pChildren = (tExprNode**)calloc(paramSize, sizeof(tExprNode*)); (*pExpr)->_func.pChildren = (tExprNode**)calloc(paramSize, sizeof(tExprNode*));
} }
for (int32_t i = 0; i < paramSize; ++i) { for (int32_t i = 0; i < paramSize; ++i) {
......
...@@ -62,8 +62,10 @@ struct SSchema; ...@@ -62,8 +62,10 @@ struct SSchema;
#define TSDB_FUNC_SCALAR_ROUND (TSDB_FUNC_FLAG_SCALAR | 0x000C) #define TSDB_FUNC_SCALAR_ROUND (TSDB_FUNC_FLAG_SCALAR | 0x000C)
#define TSDB_FUNC_SCALAR_CONCAT (TSDB_FUNC_FLAG_SCALAR | 0x000D) #define TSDB_FUNC_SCALAR_CONCAT (TSDB_FUNC_FLAG_SCALAR | 0x000D)
#define TSDB_FUNC_SCALAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x000E) #define TSDB_FUNC_SCALAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x000E)
#define TSDB_FUNC_SCALAR_CAST (TSDB_FUNC_FLAG_SCALAR | 0x000F) #define TSDB_FUNC_SCALAR_CONCAT_WS (TSDB_FUNC_FLAG_SCALAR | 0x000F)
#define TSDB_FUNC_SCALAR_MAX_NUM 16 #define TSDB_FUNC_SCALAR_CHAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x0010)
#define TSDB_FUNC_SCALAR_CAST (TSDB_FUNC_FLAG_SCALAR | 0x0011)
#define TSDB_FUNC_SCALAR_MAX_NUM 18
#define TSDB_FUNC_SCALAR_NAME_MAX_LEN 16 #define TSDB_FUNC_SCALAR_NAME_MAX_LEN 16
...@@ -74,7 +76,7 @@ typedef struct { ...@@ -74,7 +76,7 @@ typedef struct {
char* data; char* data;
} tExprOperandInfo; } tExprOperandInfo;
typedef void (*_expr_scalar_function_t)(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order); typedef void (*_expr_scalar_function_t)(int16_t functionId, tExprOperandInfo* pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order);
_expr_scalar_function_t getExprScalarFunction(uint16_t scalar); _expr_scalar_function_t getExprScalarFunction(uint16_t scalar);
...@@ -128,7 +130,7 @@ typedef struct tExprNode { ...@@ -128,7 +130,7 @@ typedef struct tExprNode {
struct { struct {
int16_t functionId; int16_t functionId;
uint8_t numChildren; int32_t numChildren;
struct tExprNode **pChildren; struct tExprNode **pChildren;
} _func; } _func;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
static int32_t exprValidateMathNode(tExprNode *pExpr); static int32_t exprValidateMathNode(tExprNode *pExpr);
static int32_t exprValidateStringConcatNode(tExprNode *pExpr); static int32_t exprValidateStringConcatNode(tExprNode *pExpr);
static int32_t exprValidateStringConcatWsNode(tExprNode *pExpr);
static int32_t exprValidateStringLengthNode(tExprNode *pExpr); static int32_t exprValidateStringLengthNode(tExprNode *pExpr);
static int32_t exprValidateCastNode(char* msgbuf, tExprNode *pExpr); static int32_t exprValidateCastNode(char* msgbuf, tExprNode *pExpr);
...@@ -65,12 +66,17 @@ int32_t exprTreeValidateFunctionNode(char* msgbuf, tExprNode *pExpr) { ...@@ -65,12 +66,17 @@ int32_t exprTreeValidateFunctionNode(char* msgbuf, tExprNode *pExpr) {
case TSDB_FUNC_SCALAR_CONCAT: { case TSDB_FUNC_SCALAR_CONCAT: {
return exprValidateStringConcatNode(pExpr); return exprValidateStringConcatNode(pExpr);
} }
case TSDB_FUNC_SCALAR_LENGTH: { case TSDB_FUNC_SCALAR_LENGTH:
case TSDB_FUNC_SCALAR_CHAR_LENGTH: {
return exprValidateStringLengthNode(pExpr); return exprValidateStringLengthNode(pExpr);
} }
case TSDB_FUNC_SCALAR_CAST: { case TSDB_FUNC_SCALAR_CAST: {
return exprValidateCastNode(msgbuf, pExpr); return exprValidateCastNode(msgbuf, pExpr);
} }
case TSDB_FUNC_SCALAR_CONCAT_WS: {
return exprValidateStringConcatWsNode(pExpr);
}
default: default:
break; break;
} }
...@@ -348,7 +354,7 @@ void exprTreeInternalNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper ...@@ -348,7 +354,7 @@ void exprTreeInternalNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper
void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOperandInfo *output, void *param, int32_t order, void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOperandInfo *output, void *param, int32_t order,
char *(*getSourceDataBlock)(void *, const char*, int32_t)) { char *(*getSourceDataBlock)(void *, const char*, int32_t)) {
uint8_t numChildren = pExpr->_func.numChildren; int32_t numChildren = pExpr->_func.numChildren;
if (numChildren == 0) { if (numChildren == 0) {
_expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId); _expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId);
output->type = pExpr->resultType; output->type = pExpr->resultType;
...@@ -517,7 +523,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) { ...@@ -517,7 +523,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) {
exprTreeToBinaryImpl(bw, expr->_node.pRight); exprTreeToBinaryImpl(bw, expr->_node.pRight);
} else if (expr->nodeType == TSQL_NODE_FUNC) { } else if (expr->nodeType == TSQL_NODE_FUNC) {
tbufWriteInt16(bw, expr->_func.functionId); tbufWriteInt16(bw, expr->_func.functionId);
tbufWriteUint8(bw, expr->_func.numChildren); tbufWriteInt32(bw, expr->_func.numChildren);
for (int i = 0; i < expr->_func.numChildren; ++i) { for (int i = 0; i < expr->_func.numChildren; ++i) {
exprTreeToBinaryImpl(bw, expr->_func.pChildren[i]); exprTreeToBinaryImpl(bw, expr->_func.pChildren[i]);
} }
...@@ -590,7 +596,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) { ...@@ -590,7 +596,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) {
assert(pExpr->_node.pLeft != NULL && pExpr->_node.pRight != NULL); assert(pExpr->_node.pLeft != NULL && pExpr->_node.pRight != NULL);
} else if (pExpr->nodeType == TSQL_NODE_FUNC) { } else if (pExpr->nodeType == TSQL_NODE_FUNC) {
pExpr->_func.functionId = tbufReadInt16(br); pExpr->_func.functionId = tbufReadInt16(br);
pExpr->_func.numChildren = tbufReadUint8(br); pExpr->_func.numChildren = tbufReadInt32(br);
pExpr->_func.pChildren = (tExprNode**)calloc(pExpr->_func.numChildren, sizeof(tExprNode*)); pExpr->_func.pChildren = (tExprNode**)calloc(pExpr->_func.numChildren, sizeof(tExprNode*));
for (int i = 0; i < pExpr->_func.numChildren; ++i) { for (int i = 0; i < pExpr->_func.numChildren; ++i) {
pExpr->_func.pChildren[i] = exprTreeFromBinaryImpl(br); pExpr->_func.pChildren[i] = exprTreeFromBinaryImpl(br);
...@@ -865,7 +871,7 @@ tExprNode* exprdup(tExprNode* pNode) { ...@@ -865,7 +871,7 @@ tExprNode* exprdup(tExprNode* pNode) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// scalar functions // scalar functions
int32_t exprValidateStringConcatNode(tExprNode *pExpr) { int32_t exprValidateStringConcatNode(tExprNode *pExpr) {
if (pExpr->_func.numChildren < 2) { if (pExpr->_func.numChildren < 2 || pExpr->_func.numChildren > 8) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
...@@ -936,6 +942,82 @@ int32_t exprValidateStringConcatNode(tExprNode *pExpr) { ...@@ -936,6 +942,82 @@ int32_t exprValidateStringConcatNode(tExprNode *pExpr) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t exprValidateStringConcatWsNode(tExprNode *pExpr) {
if (pExpr->_func.numChildren < 3 || pExpr->_func.numChildren > 9) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
int16_t prevResultType = TSDB_DATA_TYPE_NULL;
int16_t resultType = TSDB_DATA_TYPE_NULL;
bool resultTypeDeduced = false;
for (int32_t i = 0; i < pExpr->_func.numChildren; ++i) {
tExprNode *child = pExpr->_func.pChildren[i];
if (child->nodeType != TSQL_NODE_VALUE) {
resultType = child->resultType;
if (!IS_VAR_DATA_TYPE(resultType)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if (!resultTypeDeduced) {
resultTypeDeduced = true;
} else {
if (resultType != prevResultType) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
prevResultType = child->resultType;
} else {
if (!IS_VAR_DATA_TYPE(child->resultType)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
}
if (resultTypeDeduced) {
for (int32_t i = 0; i < pExpr->_func.numChildren; ++i) {
tExprNode *child = pExpr->_func.pChildren[i];
if (child->nodeType == TSQL_NODE_VALUE) {
if (!IS_VAR_DATA_TYPE(child->pVal->nType)) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
char* payload = malloc(child->pVal->nLen * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE);
tVariantDump(child->pVal, payload, resultType, true);
int16_t resultBytes = varDataTLen(payload);
free(payload);
child->resultType = resultType;
child->resultBytes = (int16_t)(resultBytes);
}
}
} else {
for (int32_t i = 0; i < pExpr->_func.numChildren; ++i) {
tExprNode *child = pExpr->_func.pChildren[i];
assert(child->nodeType == TSQL_NODE_VALUE) ;
resultType = child->resultType;
for (int j = i+1; j < pExpr->_func.numChildren; ++j) {
if (pExpr->_func.pChildren[j]->resultType != resultType) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
}
}
pExpr->resultType = resultType;
int16_t resultBytes = 0;
for (int32_t i = 1; i < pExpr->_func.numChildren; ++i) {
tExprNode *child = pExpr->_func.pChildren[i];
if (resultBytes <= resultBytes + child->resultBytes - VARSTR_HEADER_SIZE) {
resultBytes += child->resultBytes - VARSTR_HEADER_SIZE;
} else {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
}
tExprNode* wsNode = pExpr->_func.pChildren[0];
int16_t wsResultBytes = wsNode->resultBytes - VARSTR_HEADER_SIZE;
resultBytes += wsResultBytes * (pExpr->_func.numChildren - 2);
pExpr->resultBytes = resultBytes + VARSTR_HEADER_SIZE;
return TSDB_CODE_SUCCESS;
}
int32_t exprValidateStringLengthNode(tExprNode *pExpr) { int32_t exprValidateStringLengthNode(tExprNode *pExpr) {
if (pExpr->_func.numChildren != 1) { if (pExpr->_func.numChildren != 1) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
...@@ -1073,7 +1155,7 @@ int32_t exprValidateMathNode(tExprNode *pExpr) { ...@@ -1073,7 +1155,7 @@ int32_t exprValidateMathNode(tExprNode *pExpr) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) {
assert(functionId == TSDB_FUNC_SCALAR_CONCAT && numInputs >=2 && order == TSDB_ORDER_ASC); assert(functionId == TSDB_FUNC_SCALAR_CONCAT && numInputs >=2 && order == TSDB_ORDER_ASC);
for (int i = 0; i < numInputs; ++i) { for (int i = 0; i < numInputs; ++i) {
assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows);
...@@ -1113,8 +1195,52 @@ void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInpu ...@@ -1113,8 +1195,52 @@ void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInpu
free(inputData); free(inputData);
} }
void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { void vectorConcatWs(int16_t functionId, tExprOperandInfo* pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) {
assert(functionId == TSDB_FUNC_SCALAR_CONCAT_WS && numInputs >=3 && order == TSDB_ORDER_ASC);
for (int i = 0; i < numInputs; ++i) {
assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows);
}
char* outputData = NULL;
char** inputData = calloc(numInputs, sizeof(char*));
for (int i = 0; i < pOutput->numOfRows; ++i) {
for (int j = 0; j < numInputs; ++j) {
if (pInputs[j].numOfRows == 1) {
inputData[j] = pInputs[j].data;
} else {
inputData[j] = pInputs[j].data + i * pInputs[j].bytes;
}
}
outputData = pOutput->data + i * pOutput->bytes;
if (isNull(inputData[0], pInputs[0].type)) {
setNull(outputData, pOutput->type, pOutput->bytes);
continue;
}
int16_t dataLen = 0;
for (int j = 1; j < numInputs; ++j) {
if (isNull(inputData[j], pInputs[j].type)) {
continue;
}
memcpy(((char*)varDataVal(outputData))+dataLen, varDataVal(inputData[j]), varDataLen(inputData[j]));
dataLen += varDataLen(inputData[j]);
if (j < numInputs - 1) {
memcpy(((char*)varDataVal(outputData))+dataLen, varDataVal(inputData[0]), varDataLen(inputData[0]));
dataLen += varDataLen(inputData[0]);
}
}
varDataSetLen(outputData, dataLen);
}
free(inputData);
}
void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) {
assert(functionId == TSDB_FUNC_SCALAR_LENGTH && numInputs == 1 && order == TSDB_ORDER_ASC); assert(functionId == TSDB_FUNC_SCALAR_LENGTH && numInputs == 1 && order == TSDB_ORDER_ASC);
assert(IS_VAR_DATA_TYPE(pInputs[0].type));
char* data0 = NULL; char* data0 = NULL;
char* outputData = NULL; char* outputData = NULL;
...@@ -1232,8 +1358,34 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out ...@@ -1232,8 +1358,34 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out
} }
} }
void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { void vectorCharLength(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) {
assert(functionId == TSDB_FUNC_SCALAR_CHAR_LENGTH && numInputs == 1 && order == TSDB_ORDER_ASC);
assert(IS_VAR_DATA_TYPE(pInputs[0].type));
char* data0 = NULL;
char* outputData = NULL;
for (int32_t i = 0; i < pOutput->numOfRows; ++i) {
if (pInputs[0].numOfRows == 1) {
data0 = pInputs[0].data;
} else {
data0 = pInputs[0].data + i * pInputs[0].bytes;
}
outputData = pOutput->data + i * pOutput->bytes;
if (isNull(data0, pInputs[0].type)) {
setNull(outputData, pOutput->type, pOutput->bytes);
} else {
int16_t result = varDataLen(data0);
if (pInputs[0].type == TSDB_DATA_TYPE_BINARY) {
SET_TYPED_DATA(outputData, pOutput->type, result);
} else if (pInputs[0].type == TSDB_DATA_TYPE_NCHAR) {
SET_TYPED_DATA(outputData, pOutput->type, result/TSDB_NCHAR_SIZE);
}
}
}
}
void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) {
for (int i = 0; i < numInputs; ++i) { for (int i = 0; i < numInputs; ++i) {
assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows);
} }
...@@ -1538,4 +1690,14 @@ tScalarFunctionInfo aScalarFunctions[] = { ...@@ -1538,4 +1690,14 @@ tScalarFunctionInfo aScalarFunctions[] = {
"cast", "cast",
vectorMathFunc vectorMathFunc
}, },
{
TSDB_FUNC_SCALAR_CONCAT_WS,
"concat_ws",
vectorConcatWs
},
{
TSDB_FUNC_SCALAR_CHAR_LENGTH,
"char_length",
vectorCharLength
}
}; };
...@@ -220,6 +220,8 @@ ...@@ -220,6 +220,8 @@
#define TK_SPACE 300 #define TK_SPACE 300
#define TK_COMMENT 301 #define TK_COMMENT 301
#define TK_ILLEGAL 302 #define TK_ILLEGAL 302
......
...@@ -90,7 +90,6 @@ extern "C" { ...@@ -90,7 +90,6 @@ extern "C" {
#define TSDB_FUNCSTATE_OF 0x10u // outer forward #define TSDB_FUNCSTATE_OF 0x10u // outer forward
#define TSDB_FUNCSTATE_NEED_TS 0x20u // timestamp is required during query processing #define TSDB_FUNCSTATE_NEED_TS 0x20u // timestamp is required during query processing
#define TSDB_FUNCSTATE_SELECTIVITY 0x40u // selectivity functions, can exists along with tag columns #define TSDB_FUNCSTATE_SELECTIVITY 0x40u // selectivity functions, can exists along with tag columns
#define TSDB_FUNCSTATE_SCALAR 0x80u
#define TSDB_BASE_FUNC_SO TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF #define TSDB_BASE_FUNC_SO TSDB_FUNCSTATE_SO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF
#define TSDB_BASE_FUNC_MO TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF #define TSDB_BASE_FUNC_MO TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STREAM | TSDB_FUNCSTATE_STABLE | TSDB_FUNCSTATE_OF
...@@ -231,7 +230,6 @@ int32_t isValidFunction(const char* name, int32_t len); ...@@ -231,7 +230,6 @@ int32_t isValidFunction(const char* name, int32_t len);
#define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0) #define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0)
#define IS_SINGLEOUTPUT(x) (((x)&TSDB_FUNCSTATE_SO) != 0) #define IS_SINGLEOUTPUT(x) (((x)&TSDB_FUNCSTATE_SO) != 0)
#define IS_OUTER_FORWARD(x) (((x)&TSDB_FUNCSTATE_OF) != 0) #define IS_OUTER_FORWARD(x) (((x)&TSDB_FUNCSTATE_OF) != 0)
#define IS_SCALAR_FUNCTION(x) (((x)&TSDB_FUNCSTATE_SCALAR) != 0)
// determine the real data need to calculated the result // determine the real data need to calculated the result
enum { enum {
......
...@@ -435,10 +435,6 @@ static bool isScalarWithTagsQuery(SQLFunctionCtx *pCtx, int32_t numOfOutput) { ...@@ -435,10 +435,6 @@ static bool isScalarWithTagsQuery(SQLFunctionCtx *pCtx, int32_t numOfOutput) {
hasTags = true; hasTags = true;
continue; continue;
} }
if ((aAggs[functId].status & TSDB_FUNCSTATE_SCALAR) != 0) {
numOfScalar++;
}
} }
return (numOfScalar > 0 && hasTags); return (numOfScalar > 0 && hasTags);
...@@ -1866,7 +1862,7 @@ static int32_t setCtxTagColumnInfo(SQLFunctionCtx *pCtx, int32_t numOfOutput) { ...@@ -1866,7 +1862,7 @@ static int32_t setCtxTagColumnInfo(SQLFunctionCtx *pCtx, int32_t numOfOutput) {
if (functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS_DUMMY) { if (functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS_DUMMY) {
tagLen += pCtx[i].outputBytes; tagLen += pCtx[i].outputBytes;
pTagCtx[num++] = &pCtx[i]; pTagCtx[num++] = &pCtx[i];
} else if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0 || (aAggs[functionId].status & TSDB_FUNCSTATE_SCALAR) != 0) { } else if ((aAggs[functionId].status & TSDB_FUNCSTATE_SELECTIVITY) != 0) {
p = &pCtx[i]; p = &pCtx[i];
} else if (functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TAG) { } else if (functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TAG) {
// tag function may be the group by tag column // tag function may be the group by tag column
......
...@@ -146,7 +146,7 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) { ...@@ -146,7 +146,7 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) {
} }
int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) { int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
int64_t v = 0; uint64_t v = 0;
GET_TYPED_DATA(v, uint64_t, pBucket->type, value); GET_TYPED_DATA(v, uint64_t, pBucket->type, value);
int32_t index = -1; int32_t index = -1;
...@@ -162,8 +162,8 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) { ...@@ -162,8 +162,8 @@ int32_t tBucketUintHash(tMemBucket *pBucket, const void *value) {
index = (int32_t) (delta % pBucket->numOfSlots); index = (int32_t) (delta % pBucket->numOfSlots);
} else { } else {
double slotSpan = (double)span / pBucket->numOfSlots; double slotSpan = (double)span / pBucket->numOfSlots;
index = (int32_t)((v - pBucket->range.u64MinVal) / slotSpan); index = (int32_t)(((double)v - pBucket->range.u64MinVal) / slotSpan);
if (v == pBucket->range.u64MaxVal) { if (index == pBucket->numOfSlots) {
index -= 1; index -= 1;
} }
} }
...@@ -194,7 +194,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) { ...@@ -194,7 +194,7 @@ int32_t tBucketDoubleHash(tMemBucket *pBucket, const void *value) {
} else { } else {
double slotSpan = span / pBucket->numOfSlots; double slotSpan = span / pBucket->numOfSlots;
index = (int32_t)((v - pBucket->range.dMinVal) / slotSpan); index = (int32_t)((v - pBucket->range.dMinVal) / slotSpan);
if (v == pBucket->range.dMaxVal) { if (index == pBucket->numOfSlots) {
index -= 1; index -= 1;
} }
} }
......
...@@ -1748,6 +1748,16 @@ class TDTestCase: ...@@ -1748,6 +1748,16 @@ class TDTestCase:
'select ceil(last_row(usmallint_col)) from t1', 'select ceil(last_row(usmallint_col)) from t1',
'select ceil(last_row(utinyint_col)) from super', 'select ceil(last_row(utinyint_col)) from super',
'select ceil(last_row(utinyint_col)) from t1', 'select ceil(last_row(utinyint_col)) from t1',
'select ceil(interp(int_col)) from t1',
'select ceil(interp(bigint_col)) from t1',
'select ceil(interp(float_col)) from t1',
'select ceil(interp(double_col)) from t1',
'select ceil(interp(smallint_col)) from t1',
'select ceil(interp(tinyint_col)) from t1',
'select ceil(interp(uint_col)) from t1',
'select ceil(interp(ubigint_col)) from t1',
'select ceil(interp(usmallint_col)) from t1',
'select ceil(interp(utinyint_col)) from t1',
'select ceil(spread(ts)) from super', 'select ceil(spread(ts)) from super',
'select ceil(spread(ts)) from t1', 'select ceil(spread(ts)) from t1',
'select ceil(spread(timestamp_col)) from super', 'select ceil(spread(timestamp_col)) from super',
......
...@@ -1720,6 +1720,16 @@ class TDTestCase: ...@@ -1720,6 +1720,16 @@ class TDTestCase:
'select floor(last_row(usmallint_col)) from t1', 'select floor(last_row(usmallint_col)) from t1',
'select floor(last_row(utinyint_col)) from super', 'select floor(last_row(utinyint_col)) from super',
'select floor(last_row(utinyint_col)) from t1', 'select floor(last_row(utinyint_col)) from t1',
'select floor(interp(int_col)) from t1',
'select floor(interp(bigint_col)) from t1',
'select floor(interp(float_col)) from t1',
'select floor(interp(double_col)) from t1',
'select floor(interp(smallint_col)) from t1',
'select floor(interp(tinyint_col)) from t1',
'select floor(interp(uint_col)) from t1',
'select floor(interp(ubigint_col)) from t1',
'select floor(interp(usmallint_col)) from t1',
'select floor(interp(utinyint_col)) from t1',
'select floor(spread(ts)) from super', 'select floor(spread(ts)) from super',
'select floor(spread(ts)) from t1', 'select floor(spread(ts)) from t1',
'select floor(spread(timestamp_col)) from super', 'select floor(spread(timestamp_col)) from super',
...@@ -1883,7 +1893,9 @@ class TDTestCase: ...@@ -1883,7 +1893,9 @@ class TDTestCase:
'select floor(usmallint_col) as anyName from super', 'select floor(usmallint_col) as anyName from super',
'select floor(usmallint_col) as anyName from t1', 'select floor(usmallint_col) as anyName from t1',
'select floor(utinyint_col) as anyName from super', 'select floor(utinyint_col) as anyName from super',
'select floor(utinyint_col) as anyName from t1'] 'select floor(utinyint_col) as anyName from t1'
]
shouldPass2 = ['select floor(super.int_col) from super', shouldPass2 = ['select floor(super.int_col) from super',
'select floor(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag', 'select floor(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag',
......
...@@ -1720,6 +1720,16 @@ class TDTestCase: ...@@ -1720,6 +1720,16 @@ class TDTestCase:
'select round(last_row(usmallint_col)) from t1', 'select round(last_row(usmallint_col)) from t1',
'select round(last_row(utinyint_col)) from super', 'select round(last_row(utinyint_col)) from super',
'select round(last_row(utinyint_col)) from t1', 'select round(last_row(utinyint_col)) from t1',
'select round(interp(int_col)) from t1',
'select round(interp(bigint_col)) from t1',
'select round(interp(float_col)) from t1',
'select round(interp(double_col)) from t1',
'select round(interp(smallint_col)) from t1',
'select round(interp(tinyint_col)) from t1',
'select round(interp(uint_col)) from t1',
'select round(interp(ubigint_col)) from t1',
'select round(interp(usmallint_col)) from t1',
'select round(interp(utinyint_col)) from t1',
'select round(spread(ts)) from super', 'select round(spread(ts)) from super',
'select round(spread(ts)) from t1', 'select round(spread(ts)) from t1',
'select round(spread(timestamp_col)) from super', 'select round(spread(timestamp_col)) from super',
...@@ -1885,6 +1895,7 @@ class TDTestCase: ...@@ -1885,6 +1895,7 @@ class TDTestCase:
'select round(utinyint_col) as anyName from super', 'select round(utinyint_col) as anyName from super',
'select round(utinyint_col) as anyName from t1'] 'select round(utinyint_col) as anyName from t1']
shouldPass2 = ['select round(super.int_col) from super', shouldPass2 = ['select round(super.int_col) from super',
'select round(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag', 'select round(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag',
'select round(super.bigint_col) from super', 'select round(super.bigint_col) from super',
......
...@@ -39,6 +39,8 @@ run general/compute/sum.sim ...@@ -39,6 +39,8 @@ run general/compute/sum.sim
run general/compute/top.sim run general/compute/top.sim
run general/compute/block_dist.sim run general/compute/block_dist.sim
run general/compute/scalar_pow.sim run general/compute/scalar_pow.sim
run general/compute/scalar_triangle.sim
run general/compute/scalar_str_concat_len.sim
run general/compute/table_group.sim run general/compute/table_group.sim
run general/db/alter_option.sim run general/db/alter_option.sim
run general/db/alter_tables_d2.sim run general/db/alter_tables_d2.sim
...@@ -141,6 +143,7 @@ run general/parser/groupby.sim ...@@ -141,6 +143,7 @@ run general/parser/groupby.sim
run general/parser/top_groupby.sim run general/parser/top_groupby.sim
run general/parser/tags_dynamically_specifiy.sim run general/parser/tags_dynamically_specifiy.sim
run general/parser/set_tag_vals.sim run general/parser/set_tag_vals.sim
run general/parser/scalar_expression.sim
#unsupport run general/parser/repeatAlter.sim #unsupport run general/parser/repeatAlter.sim
#unsupport run general/parser/slimit_alter_tags.sim #unsupport run general/parser/slimit_alter_tags.sim
run general/parser/precision_ns.sim run general/parser/precision_ns.sim
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 500
sql connect
$dbPrefix = db
$tbPrefix = ct
$mtPrefix = st
$quote = '
$tbNum = 2
$rowNum = 50
print =============== step1 create stable/table
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, c1 int, c2 binary(10), c3 binary(30), c4 binary(40), c5 binary(50), c6 nchar(10), c7 nchar(20), c8 nchar(30), c9 nchar(40)) TAGS (tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
$z2 = $x . 2
$y2 = $quote . $z2
$y2 = $y2 . $quote
$z3 = $x . 3
$y3 = $quote . $z3
$y3 = $y3 . $quote
$z4 = $x . 4
$y4 = $quote . $z4
$y4 = $y4 . $quote
$z5 = $x . 5
$y5 = $quote . $z5
$y5 = $y5 . $quote
$z6 = $x . 6
$y6 = $quote . $z6
$y6 = $y6 . $quote
$z7 = $x . 7
$y7 = $quote . $z7
$y7 = $y7 . $quote
$z8 = $x . 8
$y8 = $quote . $z8
$y8 = $y8 . $quote
$z9 = $x . 9
$y9 = $quote . $z9
$y9 = $y9 . $quote
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x , $y2 , $y3 , $y4 , $y5 , $y6 , $y7 , $y8 , $y9 )
$x = $x + 1
$z2 = $x . 2
$y2 = $quote . $z2
$y2 = $y2 . $quote
$z3 = $x . 3
$y3 = $quote . $z3
$y3 = $y3 . $quote
$z4 = $x . 4
$y4 = $quote . $z4
$y4 = $y4 . $quote
$z5 = $x . 5
$y5 = $quote . $z5
$y5 = $y5 . $quote
$z6 = $x . 6
$y6 = $quote . $z6
$y6 = $y6 . $quote
$z7 = $x . 7
$y7 = $quote . $z7
$y7 = $y7 . $quote
$z8 = $x . 8
$y8 = $quote . $z8
$y8 = $y8 . $quote
$z9 = $x . 9
$y9 = $quote . $z9
$y9 = $y9 . $quote
endw
$i = $i + 1
endw
print ================= step2
$i = 1
$tb = $tbPrefix . $i
$stb = $mtPrefix . 0
print sql select concat(c2, c3, c4, c5) from $tb
sql select concat(c2, c3, c4, c5) from $tb
print $data00
if $data00 != 02030405 then
return -1
endi
print sql select concat_ws('data',c2,c3,c4,c5) from $tb
sql select concat_ws('data',c2,c3,c4,c5) from $tb
print $data00
if $data00 != 02data03data04data05 then
return -1
endi
print sql select concat(c6, c7, c8, c9) from $tb
sql select concat(c6, c7, c8, c9) from $tb
print $data00
if $data00 != 06070809 then
return -1
endi
print sql select concat_ws('data' ,c6,c7,c8,c9) from $tb
sql select concat_ws('data' ,c6,c7,c8,c9) from $tb
print $data00
if $data00 != 06data07data08data09 then
return -1
endi
print sql select length(concat(c2, c3, c4, c5)) from $tb
sql select length(concat(c2, c3, c4, c5)) from $tb
print $data00
if $data00 != 8 then
return -1
endi
print sql select char_length(concat(c2, c3, c4, c5)) from $tb
sql select char_length(concat(c2, c3, c4, c5)) from $tb
print $data00
if $data00 != 8 then
return -1
endi
print sql select length(concat_ws('data',c2,c3,c4,c5)) from $tb
sql select length(concat_ws('data',c2,c3,c4,c5)) from $tb
print $data00
if $data00 != 20 then
return -1
endi
print sql select char_length(concat_ws('data',c2,c3,c4,c5)) from $tb
sql select char_length(concat_ws('data',c2,c3,c4,c5)) from $tb
print $data00
if $data00 != 20 then
return -1
endi
print sql select length(concat(c6, c7, c8, c9)) from $tb
sql select length(concat(c6, c7, c8, c9)) from $tb
print $data00
if $data00 != 32 then
return -1
endi
print sql select char_length(concat(c6, c7, c8, c9)) from $tb
sql select char_length(concat(c6, c7, c8, c9)) from $tb
print $data00
if $data00 != 8 then
return -1
endi
print sql select length(concat_ws('data' ,c6,c7,c8,c9)) from $tb
sql select length(concat_ws('data' ,c6,c7,c8,c9)) from $tb
print $data00
if $data00 != 80 then
return -1
endi
print sql select char_length(concat_ws('data', c6,c7,c8,c9)) from $tb
sql select char_length(concat_ws('data', c6, c7, c8, c9)) from $tb
print $data00
if $data00 != 20 then
return -1
endi
print sql_error select concat(c1, c2, c3, c4, c5) from $tb
sql_error select concat(c1, c2, c3, c4, c5) from $tb
print sql_error select concat_ws('data',c1,c2,c3,c4,c5) from $tb
sql_error select concat_ws('data',c1,c2,c3,c4,c5) from $tb
print ===============> step 3 sql_error stable, group by, window
sql_error select concat(c2) from $stb group by tbname;
sql_error select concat(c2) from $stb group by tgcol;
sql_error select concat(c2) from $stb group by c3;
sql_error select concat(c2) from $stb interval(1m);
sql_error select concat(c2) from $stb state_window(c7);
sql_error select concat(c2) from $tb state_window(c7);
sql_error select concat(c2) from $stb session(ts, 30s);
sql_error select concat(c2) from $tb session(ts, 30s);
sql_error select concat(c2) from $stb slimit 2;
sql_error select concat(c2) from $stb interval(1m) slimit 2;
sql_error select length(c2) from $stb group by tbname;
sql_error select length(c2) from $stb group by tgcol;
sql_error select length(c2) from $stb group by c3;
sql_error select length(c2) from $stb interval(1m);
sql_error select length(c2) from $stb state_window(c7);
sql_error select length(c2) from $tb state_window(c7);
sql_error select length(c2) from $stb session(ts, 30s);
sql_error select length(c2) from $tb session(ts, 30s);
sql_error select length(c2) from $stb slimit 2;
sql_error select length(c2) from $stb interval(1m) slimit 2;
sql_error select concat_ws(c2) from $stb group by tbname;
sql_error select concat_ws(c2) from $stb group by tgcol;
sql_error select concat_ws(c2) from $stb group by c3;
sql_error select concat_ws(c2) from $stb interval(1m);
sql_error select concat_ws(c2) from $stb state_window(c7);
sql_error select concat_ws(c2) from $tb state_window(c7);
sql_error select concat_ws(c2) from $stb session(ts, 30s);
sql_error select concat_ws(c2) from $tb session(ts, 30s);
sql_error select concat_ws(c2) from $stb slimit 2;
sql_error select concat_ws(c2) from $stb interval(1m) slimit 2;
print =============== trival test
print execute sql select concat(c2,c3),concat(c2,c3,c4),concat(c2,c3,c4,c5) from ct1
sql select concat(c2,c3),concat(c2,c3,c4),concat(c2,c3,c4,c5) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @0203@ then
return -1
endi
if $data01 != @020304@ then
return -1
endi
if $data02 != @02030405@ then
return -1
endi
if $data10 != @1213@ then
return -1
endi
if $data11 != @121314@ then
return -1
endi
if $data12 != @12131415@ then
return -1
endi
print execute sql select concat('taos',c2,c3),concat('taos',c2,c4),concat('taos',c2,c5),concat('taos',c3,c4),concat('taos',c3,c5) from ct1
sql select concat('taos',c2,c3),concat('taos',c2,c4),concat('taos',c2,c5),concat('taos',c3,c4),concat('taos',c3,c5) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @taos0203@ then
return -1
endi
if $data01 != @taos0204@ then
return -1
endi
if $data02 != @taos0205@ then
return -1
endi
if $data03 != @taos0304@ then
return -1
endi
if $data04 != @taos0305@ then
return -1
endi
if $data10 != @taos1213@ then
return -1
endi
if $data11 != @taos1214@ then
return -1
endi
if $data12 != @taos1215@ then
return -1
endi
if $data13 != @taos1314@ then
return -1
endi
if $data14 != @taos1315@ then
return -1
endi
print execute sql select concat(c6,c7,'taos'),concat(c6,c8,'taos'),concat(c6,c9,'taos'),concat(c7,c8,'taos'),concat(c7,c9,'taos') from ct1
sql select concat(c6,c7,'taos'),concat(c6,c8,'taos'),concat(c6,c9,'taos'),concat(c7,c8,'taos'),concat(c7,c9,'taos') from ct1
if $rows != 50 then
return -1
endi
if $data00 != @0607taos@ then
return -1
endi
if $data01 != @0608taos@ then
return -1
endi
if $data02 != @0609taos@ then
return -1
endi
if $data03 != @0708taos@ then
return -1
endi
if $data04 != @0709taos@ then
return -1
endi
if $data10 != @1617taos@ then
return -1
endi
if $data11 != @1618taos@ then
return -1
endi
if $data12 != @1619taos@ then
return -1
endi
if $data13 != @1718taos@ then
return -1
endi
if $data14 != @1719taos@ then
return -1
endi
print execute sql select concat('data',c7,'taos'),concat('data',c8,'taos'),concat('data',c9,'taos'),concat(c7,c8,'taos'),concat(c7,c9,'taos') from ct1
sql select concat('data',c7,'taos'),concat('data',c8,'taos'),concat('data',c9,'taos'),concat(c7,c8,'taos'),concat(c7,c9,'taos') from ct1
if $rows != 50 then
return -1
endi
if $data00 != @data07taos@ then
return -1
endi
if $data01 != @data08taos@ then
return -1
endi
if $data02 != @data09taos@ then
return -1
endi
if $data03 != @0708taos@ then
return -1
endi
if $data04 != @0709taos@ then
return -1
endi
if $data10 != @data17taos@ then
return -1
endi
if $data11 != @data18taos@ then
return -1
endi
if $data12 != @data19taos@ then
return -1
endi
if $data13 != @1718taos@ then
return -1
endi
if $data14 != @1719taos@ then
return -1
endi
print execute sql select concat_ws('jeff',c2,c3),concat_ws('jeff',c2,c3,c4),concat_ws('jeff',c2,c3,c4,c5) from ct1
sql select concat_ws('jeff',c2,c3),concat_ws('jeff',c2,c3,c4),concat_ws('jeff',c2,c3,c4,c5) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @02jeff03@ then
return -1
endi
if $data01 != @02jeff03jeff04@ then
return -1
endi
if $data02 != @02jeff03jeff04jeff05@ then
return -1
endi
if $data10 != @12jeff13@ then
return -1
endi
if $data11 != @12jeff13jeff14@ then
return -1
endi
if $data12 != @12jeff13jeff14jeff15@ then
return -1
endi
print execute sql select concat_ws('jeff','taos',c2,c3),concat_ws('jeff','taos',c2,c4),concat_ws('jeff','taos',c2,c5),concat_ws('jeff','taos',c3,c4),concat_ws('jeff','taos',c3,c5) from ct1
sql select concat_ws('jeff','taos',c2,c3),concat_ws('jeff','taos',c2,c4),concat_ws('jeff','taos',c2,c5),concat_ws('jeff','taos',c3,c4),concat_ws('jeff','taos',c3,c5) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @taosjeff02jeff03@ then
return -1
endi
if $data01 != @taosjeff02jeff04@ then
return -1
endi
if $data02 != @taosjeff02jeff05@ then
return -1
endi
if $data03 != @taosjeff03jeff04@ then
return -1
endi
if $data04 != @taosjeff03jeff05@ then
return -1
endi
if $data10 != @taosjeff12jeff13@ then
return -1
endi
if $data11 != @taosjeff12jeff14@ then
return -1
endi
if $data12 != @taosjeff12jeff15@ then
return -1
endi
if $data13 != @taosjeff13jeff14@ then
return -1
endi
if $data14 != @taosjeff13jeff15@ then
return -1
endi
print execute sql select concat_ws('jeff','data',c3),concat_ws('jeff','data',c3,c4),concat_ws('jeff','data',c3,c4,c5) from ct1
sql select concat_ws('jeff','data',c3),concat_ws('jeff','data',c3,c4),concat_ws('jeff','data',c3,c4,c5) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @datajeff03@ then
return -1
endi
if $data01 != @datajeff03jeff04@ then
return -1
endi
if $data02 != @datajeff03jeff04jeff05@ then
return -1
endi
if $data10 != @datajeff13@ then
return -1
endi
if $data11 != @datajeff13jeff14@ then
return -1
endi
if $data12 != @datajeff13jeff14jeff15@ then
return -1
endi
print execute sql select concat_ws('jeff','data',c7,'taos'),concat_ws('jeff','data',c8,'taos'),concat_ws('jeff','data',c9,'taos'),concat_ws('jeff',c7,c8,'taos'),concat_ws('jeff',c7,c9,'taos') from ct1
sql select concat_ws('jeff','data',c7,'taos'),concat_ws('jeff','data',c8,'taos'),concat_ws('jeff','data',c9,'taos'),concat_ws('jeff',c7,c8,'taos'),concat_ws('jeff',c7,c9,'taos') from ct1
if $rows != 50 then
return -1
endi
if $data00 != @datajeff07jefftaos@ then
return -1
endi
if $data01 != @datajeff08jefftaos@ then
return -1
endi
if $data02 != @datajeff09jefftaos@ then
return -1
endi
if $data03 != @07jeff08jefftaos@ then
return -1
endi
if $data04 != @07jeff09jefftaos@ then
return -1
endi
if $data10 != @datajeff17jefftaos@ then
return -1
endi
if $data11 != @datajeff18jefftaos@ then
return -1
endi
if $data12 != @datajeff19jefftaos@ then
return -1
endi
if $data13 != @17jeff18jefftaos@ then
return -1
endi
if $data14 != @17jeff19jefftaos@ then
return -1
endi
print execute sql select length(concat(c2,c3)),length(concat(c2,c3,c4)),length(concat(c2,c3,c4,c5)) from ct1
sql select length(concat(c2,c3)),length(concat(c2,c3,c4)),length(concat(c2,c3,c4,c5)) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @4@ then
return -1
endi
if $data01 != @6@ then
return -1
endi
if $data02 != @8@ then
return -1
endi
if $data10 != @4@ then
return -1
endi
if $data11 != @6@ then
return -1
endi
if $data12 != @8@ then
return -1
endi
print execute sql select length(concat(c6,c7,'taos')),length(concat(c6,c8,'taos')),length(concat(c6,c9,'taos')),length(concat(c7,c8,'taos')),length(concat(c7,c9,'taos')) from ct1
sql select length(concat(c6,c7,'taos')),length(concat(c6,c8,'taos')),length(concat(c6,c9,'taos')),length(concat(c7,c8,'taos')),length(concat(c7,c9,'taos')) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @32@ then
return -1
endi
if $data01 != @32@ then
return -1
endi
if $data02 != @32@ then
return -1
endi
if $data03 != @32@ then
return -1
endi
if $data04 != @32@ then
return -1
endi
if $data10 != @32@ then
return -1
endi
if $data11 != @32@ then
return -1
endi
if $data12 != @32@ then
return -1
endi
if $data13 != @32@ then
return -1
endi
if $data14 != @32@ then
return -1
endi
print execute sql select length(concat_ws('jeff','taos',c2,c3)),length(concat_ws('jeff','taos',c2,c4)),length(concat_ws('jeff','taos',c2,c5)),length(concat_ws('jeff','taos',c3,c4)),length(concat_ws('jeff','taos',c3,c5)) from ct1
sql select length(concat_ws('jeff','taos',c2,c3)),length(concat_ws('jeff','taos',c2,c4)),length(concat_ws('jeff','taos',c2,c5)),length(concat_ws('jeff','taos',c3,c4)),length(concat_ws('jeff','taos',c3,c5)) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @16@ then
return -1
endi
if $data01 != @16@ then
return -1
endi
if $data02 != @16@ then
return -1
endi
if $data03 != @16@ then
return -1
endi
if $data04 != @16@ then
return -1
endi
if $data10 != @16@ then
return -1
endi
if $data11 != @16@ then
return -1
endi
if $data12 != @16@ then
return -1
endi
if $data13 != @16@ then
return -1
endi
if $data14 != @16@ then
return -1
endi
print execute sql select length(concat_ws('jeff',c6,c7,'taos')),length(concat_ws('jeff',c6,c8,'taos')),length(concat_ws('jeff',c6,c9,'taos')),length(concat_ws('jeff',c7,c8,'taos')),length(concat_ws('jeff',c7,c9,'taos')) from ct1
sql select length(concat_ws('jeff',c6,c7,'taos')),length(concat_ws('jeff',c6,c8,'taos')),length(concat_ws('jeff',c6,c9,'taos')),length(concat_ws('jeff',c7,c8,'taos')),length(concat_ws('jeff',c7,c9,'taos')) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @64@ then
return -1
endi
if $data01 != @64@ then
return -1
endi
if $data02 != @64@ then
return -1
endi
if $data03 != @64@ then
return -1
endi
if $data04 != @64@ then
return -1
endi
if $data10 != @64@ then
return -1
endi
if $data11 != @64@ then
return -1
endi
if $data12 != @64@ then
return -1
endi
if $data13 != @64@ then
return -1
endi
if $data14 != @64@ then
return -1
endi
print execute sql select char_length(concat(c2,'taos',c3)),char_length(concat(c2,'taos',c4)),char_length(concat(c2,'taos',c5)),char_length(concat(c3,'taos',c4)),char_length(concat(c3,'taos',c5)) from ct1
sql select char_length(concat(c2,'taos',c3)),char_length(concat(c2,'taos',c4)),char_length(concat(c2,'taos',c5)),char_length(concat(c3,'taos',c4)),char_length(concat(c3,'taos',c5)) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @8@ then
return -1
endi
if $data01 != @8@ then
return -1
endi
if $data02 != @8@ then
return -1
endi
if $data03 != @8@ then
return -1
endi
if $data04 != @8@ then
return -1
endi
if $data10 != @8@ then
return -1
endi
if $data11 != @8@ then
return -1
endi
if $data12 != @8@ then
return -1
endi
if $data13 != @8@ then
return -1
endi
if $data14 != @8@ then
return -1
endi
print execute sql select char_length(concat(c6,'taos')),char_length(concat(c7,'taos')),char_length(concat(c8,'taos')),char_length(concat(c9,'taos')) from ct1
sql select char_length(concat(c6,'taos')),char_length(concat(c7,'taos')),char_length(concat(c8,'taos')),char_length(concat(c9,'taos')) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @6@ then
return -1
endi
if $data01 != @6@ then
return -1
endi
if $data02 != @6@ then
return -1
endi
if $data03 != @6@ then
return -1
endi
if $data10 != @6@ then
return -1
endi
if $data11 != @6@ then
return -1
endi
if $data12 != @6@ then
return -1
endi
if $data13 != @6@ then
return -1
endi
print execute sql select char_length(concat_ws('jeff',c2,'taos',c3)),char_length(concat_ws('jeff',c2,'taos',c4)),char_length(concat_ws('jeff',c2,'taos',c5)),char_length(concat_ws('jeff',c3,'taos',c4)),char_length(concat_ws('jeff',c3,'taos',c5)) from ct1
sql select char_length(concat_ws('jeff',c2,'taos',c3)),char_length(concat_ws('jeff',c2,'taos',c4)),char_length(concat_ws('jeff',c2,'taos',c5)),char_length(concat_ws('jeff',c3,'taos',c4)),char_length(concat_ws('jeff',c3,'taos',c5)) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @16@ then
return -1
endi
if $data01 != @16@ then
return -1
endi
if $data02 != @16@ then
return -1
endi
if $data03 != @16@ then
return -1
endi
if $data04 != @16@ then
return -1
endi
if $data10 != @16@ then
return -1
endi
if $data11 != @16@ then
return -1
endi
if $data12 != @16@ then
return -1
endi
if $data13 != @16@ then
return -1
endi
if $data14 != @16@ then
return -1
endi
print execute sql select char_length(concat_ws('jeff',c6,'taos')),char_length(concat_ws('jeff',c7,'taos')),char_length(concat_ws('jeff',c8,'taos')),char_length(concat_ws('jeff',c9,'taos')) from ct1
sql select char_length(concat_ws('jeff',c6,'taos')),char_length(concat_ws('jeff',c7,'taos')),char_length(concat_ws('jeff',c8,'taos')),char_length(concat_ws('jeff',c9,'taos')) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @10@ then
return -1
endi
if $data01 != @10@ then
return -1
endi
if $data02 != @10@ then
return -1
endi
if $data03 != @10@ then
return -1
endi
if $data10 != @10@ then
return -1
endi
if $data11 != @10@ then
return -1
endi
if $data12 != @10@ then
return -1
endi
if $data13 != @10@ then
return -1
endi
print =============== clear
#sql drop database $db
#sql show databases
#if $rows != 0 then
# return -1
#endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 500
sql connect
$dbPrefix = db
$tbPrefix = ct
$mtPrefix = st
$tbNum = 2
$rowNum = 50
print =============== step1 create stable/table
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 nchar(5), c9 binary(10)) TAGS (tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
$y = 0.25
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x , $y , $x , $x , $x , $y , $x , $x , $x )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
print ================= step2
$i = 1
$tb = $tbPrefix . $i
$stb = $mtPrefix . 0
print execute sql select c1, sin(c1), cos(c1), tan(c1), asin(c1), acos(c1), atan(c1) from ct1
sql select c1, sin(c1), cos(c1), tan(c1), asin(c1), acos(c1), atan(c1) from ct1
if $rows != 50 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.000000000@ then
return -1
endi
if $data02 != @1.000000000@ then
return -1
endi
if $data03 != @0.000000000@ then
return -1
endi
if $data04 != @0.000000000@ then
return -1
endi
if $data05 != @1.570796327@ then
return -1
endi
if $data06 != @0.000000000@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.841470985@ then
return -1
endi
if $data12 != @0.540302306@ then
return -1
endi
if $data13 != @1.557407725@ then
return -1
endi
if $data14 != @1.570796327@ then
return -1
endi
if $data15 != @0.000000000@ then
return -1
endi
if $data16 != @0.785398163@ then
return -1
endi
if $data20 != @2@ then
return -1
endi
if $data21 != @0.909297427@ then
return -1
endi
if $data22 != @-0.416146837@ then
return -1
endi
if $data23 != @-2.185039863@ then
return -1
endi
if $data26 != @1.107148718@ then
return -1
endi
if $data30 != @3@ then
return -1
endi
if $data31 != @0.141120008@ then
return -1
endi
if $data32 != @-0.989992497@ then
return -1
endi
if $data33 != @-0.142546543@ then
return -1
endi
if $data36 != @1.249045772@ then
return -1
endi
if $data40 != @4@ then
return -1
endi
if $data41 != @-0.756802495@ then
return -1
endi
if $data42 != @-0.653643621@ then
return -1
endi
if $data43 != @1.157821282@ then
return -1
endi
if $data46 != @1.325817664@ then
return -1
endi
if $data50 != @5@ then
return -1
endi
if $data51 != @-0.958924275@ then
return -1
endi
if $data52 != @0.283662185@ then
return -1
endi
if $data53 != @-3.380515006@ then
return -1
endi
if $data56 != @1.373400767@ then
return -1
endi
if $data60 != @6@ then
return -1
endi
if $data61 != @-0.279415498@ then
return -1
endi
if $data62 != @0.960170287@ then
return -1
endi
if $data63 != @-0.291006191@ then
return -1
endi
if $data66 != @1.405647649@ then
return -1
endi
if $data70 != @7@ then
return -1
endi
if $data71 != @0.656986599@ then
return -1
endi
if $data72 != @0.753902254@ then
return -1
endi
if $data73 != @0.871447983@ then
return -1
endi
if $data76 != @1.428899272@ then
return -1
endi
if $data80 != @8@ then
return -1
endi
if $data81 != @0.989358247@ then
return -1
endi
if $data82 != @-0.145500034@ then
return -1
endi
if $data83 != @-6.799711455@ then
return -1
endi
if $data86 != @1.446441332@ then
return -1
endi
if $data90 != @9@ then
return -1
endi
if $data91 != @0.412118485@ then
return -1
endi
if $data92 != @-0.911130262@ then
return -1
endi
if $data93 != @-0.452315659@ then
return -1
endi
if $data96 != @1.460139106@ then
return -1
endi
print execute sql select c1, sin(c2)+2, cos(c2)+2, cos(pow(c2,2)+2), tan(pow(c2,3)+log(c3, 2)+pow(c5,2)) as v4, asin(pow(c4, 4.5)+pow(c3, 2)), acos(log(c1,2)+log(c3,4)+pow(c6,2.8)+2) as v6 from ct1 where ts == 1601481600000
sql select c1, sin(c2)+2, cos(c2)+2, cos(pow(c2,2)+2), tan(pow(c2,3)+log(c3, 2)+pow(c5,2)) as v4, asin(pow(c4, 4.5)+pow(c3, 2)), acos(log(c1,2)+log(c3,4)+pow(c6,2.8)+2) as v6 from ct1 where ts == 1601481600000
if $rows != 1 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @2.247403959@ then
return -1
endi
if $data02 != @2.968912422@ then
return -1
endi
if $data03 != @-0.472128411@ then
return -1
endi
if $data05 != @0.000000000@ then
return -1
endi
print execute sql select c1, sin(c2), cos(c1+2), tan(c2+2)+2, sin(c2+3)+cos(c3+2)+tan(c5+2) as v4, sin(c4+4.5)+tan(c3+2), sin(c1+2)+cos(c3+4)+acos(c6+2.8)+2 as v6 from st0 where ts == 1601481600000
sql select c1, sin(c2), cos(c1+2), tan(c2+2)+2, sin(c2+3)+cos(c3+2)+tan(c5+2) as v4, sin(c4+4.5)+tan(c3+2), sin(c1+2)+cos(c3+4)+acos(c6+2.8)+2 as v6 from st0 where ts == 1601481600000
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.247403959@ then
return -1
endi
if $data02 != @-0.416146837@ then
return -1
endi
if $data03 != @0.761372384@ then
return -1
endi
if $data04 != @-2.709381834@ then
return -1
endi
if $data05 != @-3.162569981@ then
return -1
endi
if $data10 != @0@ then
return -1
endi
if $data11 != @0.247403959@ then
return -1
endi
if $data12 != @-0.416146837@ then
return -1
endi
if $data13 != @0.761372384@ then
return -1
endi
if $data14 != @-2.709381834@ then
return -1
endi
if $data15 != @-3.162569981@ then
return -1
endi
print execute sql select c1, tan(c2+ 2), sin(pow(c1,2)), cos(pow(c2,2)+2), tan(pow(c2,3)+log(c3, 2)+pow(c5,2)) as v4, asin(pow(c4, 4.5)+pow(c3, 2)), acos(log(c1,2)+log(c3,4)+pow(c6,2.8)+2) as v6 from st0 where c1 == 0
sql select c1, tan(c2+ 2), sin(pow(c1,2)), cos(pow(c2,2)+2), tan(pow(c2,3)+log(c3, 2)+pow(c5,2)) as v4, asin(pow(c4, 4.5)+pow(c3, 2)), acos(log(c1,2)+log(c3,4)+pow(c6,2.8)+2) as v6 from st0 where c1 == 0
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @-1.238627616@ then
return -1
endi
if $data02 != @0.000000000@ then
return -1
endi
if $data03 != @-0.472128411@ then
return -1
endi
if $data05 != @0.000000000@ then
return -1
endi
if $data10 != @0@ then
return -1
endi
if $data11 != @-1.238627616@ then
return -1
endi
if $data12 != @0.000000000@ then
return -1
endi
if $data13 != @-0.472128411@ then
return -1
endi
if $data15 != @0.000000000@ then
return -1
endi
print execute sql select c1, atan(c2+2), asin(c1+2), acos(c2+c1)+2, acos(c2+c3)+asin(c3+c2)+pow(c5,2) as v4, acos(c4/4.5)+asin(c3-2), asin(c1/2)+log(c3,c4)+pow(c6, 2.8)+2 as v6 from st0 where c1 == 0
sql select c1, atan(c2+2), asin(c1+2), acos(c2+c1)+2, acos(c2+c3)+asin(c3+c2)+pow(c5,2) as v4, acos(c4/4.5)+asin(c3-2), asin(c1/2)+log(c3,c4)+pow(c6, 2.8)+2 as v6 from st0 where c1 == 0
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @1.152571997@ then
return -1
endi
if $data03 != @3.318116072@ then
return -1
endi
if $data04 != @1.570796327@ then
return -1
endi
if $data10 != @0@ then
return -1
endi
if $data11 != @1.152571997@ then
return -1
endi
if $data13 != @3.318116072@ then
return -1
endi
if $data14 != @1.570796327@ then
return -1
endi
print execute sql select c1, cos(c2+2), cos(ceil(pow(c1,2))), sin(floor(pow(c2,2)+2)), sin(ceil(c2)+floor(c3+c2)+round(c5+c2)) as v4, atan(pow(c4, 4.5)+pow(c3, 2)), tan(log(c1,2)+cos(c3+4)+pow(c6,2.8)+2) as v6 from st0 order by ts desc
sql select c1, cos(c2+2), cos(ceil(pow(c1,2))), sin(floor(pow(c2,2)+2)), sin(ceil(c2)+floor(c3+c2)+round(c5+c2)) as v4, atan(pow(c4, 4.5)+pow(c3, 2)), tan(log(c1,2)+cos(c3+4)+pow(c6,2.8)+2) as v6 from st0 order by ts desc
if $rows != 100 then
return -1
endi
if $data00 != @49@ then
return -1
endi
if $data01 != @0.742154197@ then
return -1
endi
if $data02 != @0.679868770@ then
return -1
endi
if $data03 != @0.313028384@ then
return -1
endi
if $data04 != @0.314456085@ then
return -1
endi
if $data05 != @1.570796302@ then
return -1
endi
if $data06 != @0.036525682@ then
return -1
endi
if $data10 != @49@ then
return -1
endi
if $data11 != @0.742154197@ then
return -1
endi
if $data12 != @0.679868770@ then
return -1
endi
if $data13 != @0.313028384@ then
return -1
endi
if $data14 != @0.314456085@ then
return -1
endi
if $data15 != @1.570796302@ then
return -1
endi
if $data16 != @0.036525682@ then
return -1
endi
if $data20 != @48@ then
return -1
endi
if $data21 != @0.964966028@ then
return -1
endi
if $data22 != @-0.350599733@ then
return -1
endi
if $data23 != @0.070932648@ then
return -1
endi
if $data24 != @0.146014414@ then
return -1
endi
if $data25 != @1.570796300@ then
return -1
endi
if $data26 != @-2.376507095@ then
return -1
endi
if $data30 != @48@ then
return -1
endi
if $data31 != @0.964966028@ then
return -1
endi
if $data32 != @-0.350599733@ then
return -1
endi
if $data33 != @0.070932648@ then
return -1
endi
if $data34 != @0.146014414@ then
return -1
endi
if $data35 != @1.570796300@ then
return -1
endi
if $data36 != @-2.376507095@ then
return -1
endi
if $data40 != @47@ then
return -1
endi
if $data41 != @0.300592544@ then
return -1
endi
if $data42 != @-0.895890607@ then
return -1
endi
if $data43 != @-0.629747508@ then
return -1
endi
if $data44 != @-0.012630495@ then
return -1
endi
if $data45 != @1.570796297@ then
return -1
endi
if $data46 != @-0.760993034@ then
return -1
endi
if $data50 != @47@ then
return -1
endi
if $data51 != @0.300592544@ then
return -1
endi
if $data52 != @-0.895890607@ then
return -1
endi
if $data53 != @-0.629747508@ then
return -1
endi
if $data54 != @-0.012630495@ then
return -1
endi
if $data55 != @1.570796297@ then
return -1
endi
if $data56 != @-0.760993034@ then
return -1
endi
if $data60 != @46@ then
return -1
endi
if $data61 != @-0.640144339@ then
return -1
endi
if $data62 != @0.136916383@ then
return -1
endi
if $data63 != @0.536725534@ then
return -1
endi
if $data64 != @0.999302812@ then
return -1
endi
if $data65 != @1.570796294@ then
return -1
endi
if $data66 != @-1.929269971@ then
return -1
endi
if $data70 != @46@ then
return -1
endi
if $data71 != @-0.640144339@ then
return -1
endi
if $data72 != @0.136916383@ then
return -1
endi
if $data73 != @0.536725534@ then
return -1
endi
if $data74 != @0.999302812@ then
return -1
endi
if $data75 != @1.570796294@ then
return -1
endi
if $data76 != @-1.929269971@ then
return -1
endi
if $data80 != @45@ then
return -1
endi
if $data81 != @-0.992335469@ then
return -1
endi
if $data82 != @-0.241134582@ then
return -1
endi
if $data83 != @-0.623130100@ then
return -1
endi
if $data84 != @-0.861031953@ then
return -1
endi
if $data85 != @1.570796290@ then
return -1
endi
if $data86 != @-7.205947409@ then
return -1
endi
if $data90 != @45@ then
return -1
endi
if $data91 != @-0.992335469@ then
return -1
endi
if $data92 != @-0.241134582@ then
return -1
endi
if $data93 != @-0.623130100@ then
return -1
endi
if $data94 != @-0.861031953@ then
return -1
endi
if $data95 != @1.570796290@ then
return -1
endi
if $data96 != @-7.205947409@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5+c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from ct1 order by ts limit 2;
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5+c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from ct1 order by ts limit 2;
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @2.154346269@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 order by ts desc)
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 order by ts desc)
if $rows != 100 then
return -1
endi
if $data00 != @49@ then
return -1
endi
if $data01 != @0.670229176@ then
return -1
endi
if $data02 != @0.992374553@ then
return -1
endi
if $data03 != @0.929814367@ then
return -1
endi
if $data05 != @0.713618282@ then
return -1
endi
if $data06 != @-0.746290424@ then
return -1
endi
if $data10 != @49@ then
return -1
endi
if $data11 != @0.670229176@ then
return -1
endi
if $data12 != @0.992374553@ then
return -1
endi
if $data13 != @0.929814367@ then
return -1
endi
if $data15 != @0.713618282@ then
return -1
endi
if $data16 != @-0.746290424@ then
return -1
endi
if $data20 != @48@ then
return -1
endi
if $data21 != @-0.262374854@ then
return -1
endi
if $data22 != @0.620208114@ then
return -1
endi
if $data23 != @1.817585733@ then
return -1
endi
if $data25 != @1.211884234@ then
return -1
endi
if $data26 != @5.183714989@ then
return -1
endi
if $data30 != @48@ then
return -1
endi
if $data31 != @-0.262374854@ then
return -1
endi
if $data32 != @0.620208114@ then
return -1
endi
if $data33 != @1.817585733@ then
return -1
endi
if $data35 != @1.211884234@ then
return -1
endi
if $data36 != @5.183714989@ then
return -1
endi
if $data40 != @47@ then
return -1
endi
if $data41 != @-0.953752653@ then
return -1
endi
if $data42 != @0.659304076@ then
return -1
endi
if $data43 != @3.457510675@ then
return -1
endi
if $data45 != @0.882083819@ then
return -1
endi
if $data46 != @2.630220446@ then
return -1
endi
if $data50 != @47@ then
return -1
endi
if $data51 != @-0.953752653@ then
return -1
endi
if $data52 != @0.659304076@ then
return -1
endi
if $data53 != @3.457510675@ then
return -1
endi
if $data55 != @0.882083819@ then
return -1
endi
if $data56 != @2.630220446@ then
return -1
endi
if $data60 != @46@ then
return -1
endi
if $data61 != @-0.768254661@ then
return -1
endi
if $data62 != @0.999843325@ then
return -1
endi
if $data63 != @1.276316926@ then
return -1
endi
if $data65 != @-0.300459259@ then
return -1
endi
if $data66 != @0.133920399@ then
return -1
endi
if $data70 != @46@ then
return -1
endi
if $data71 != @-0.768254661@ then
return -1
endi
if $data72 != @0.999843325@ then
return -1
endi
if $data73 != @1.276316926@ then
return -1
endi
if $data75 != @-0.300459259@ then
return -1
endi
if $data76 != @0.133920399@ then
return -1
endi
if $data80 != @45@ then
return -1
endi
if $data81 != @0.123573123@ then
return -1
endi
if $data82 != @0.673565060@ then
return -1
endi
if $data83 != @1.519318619@ then
return -1
endi
if $data85 != @-1.566189594@ then
return -1
endi
if $data86 != @5.513771854@ then
return -1
endi
if $data90 != @45@ then
return -1
endi
if $data91 != @0.123573123@ then
return -1
endi
if $data92 != @0.673565060@ then
return -1
endi
if $data93 != @1.519318619@ then
return -1
endi
if $data95 != @-1.566189594@ then
return -1
endi
if $data96 != @5.513771854@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 order by ts limit 2);
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 order by ts limit 2);
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @1.832595715@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 ) order by ts desc
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 ) order by ts desc
if $rows != 100 then
return -1
endi
if $data00 != @36@ then
return -1
endi
if $data01 != @0.296368579@ then
return -1
endi
if $data02 != @0.863270440@ then
return -1
endi
if $data03 != @0.549368160@ then
return -1
endi
if $data05 != @0.994467885@ then
return -1
endi
if $data06 != @11.004294268@ then
return -1
endi
if $data10 != @36@ then
return -1
endi
if $data11 != @0.296368579@ then
return -1
endi
if $data12 != @0.863270440@ then
return -1
endi
if $data13 != @0.549368160@ then
return -1
endi
if $data15 != @0.994467885@ then
return -1
endi
if $data16 != @11.004294268@ then
return -1
endi
if $data20 != @14@ then
return -1
endi
if $data21 != @-0.287903317@ then
return -1
endi
if $data22 != @0.859465627@ then
return -1
endi
if $data23 != @0.563690525@ then
return -1
endi
if $data25 != @0.411421636@ then
return -1
endi
if $data26 != @10.515512404@ then
return -1
endi
if $data30 != @14@ then
return -1
endi
if $data31 != @-0.287903317@ then
return -1
endi
if $data32 != @0.859465627@ then
return -1
endi
if $data33 != @0.563690525@ then
return -1
endi
if $data35 != @0.411421636@ then
return -1
endi
if $data36 != @10.515512404@ then
return -1
endi
if $data40 != @39@ then
return -1
endi
if $data41 != @-0.158622669@ then
return -1
endi
if $data42 != @0.799977785@ then
return -1
endi
if $data43 != @0.843592014@ then
return -1
endi
if $data45 != @0.331999454@ then
return -1
endi
if $data46 != @7.128532863@ then
return -1
endi
if $data50 != @39@ then
return -1
endi
if $data51 != @-0.158622669@ then
return -1
endi
if $data52 != @0.799977785@ then
return -1
endi
if $data53 != @0.843592014@ then
return -1
endi
if $data55 != @0.331999454@ then
return -1
endi
if $data56 != @7.128532863@ then
return -1
endi
if $data60 != @17@ then
return -1
endi
if $data61 != @0.149877210@ then
return -1
endi
if $data62 != @0.795909569@ then
return -1
endi
if $data63 != @0.864944321@ then
return -1
endi
if $data65 != @-0.130372900@ then
return -1
endi
if $data66 != @7.022998332@ then
return -1
endi
if $data70 != @17@ then
return -1
endi
if $data71 != @0.149877210@ then
return -1
endi
if $data72 != @0.795909569@ then
return -1
endi
if $data73 != @0.864944321@ then
return -1
endi
if $data75 != @-0.130372900@ then
return -1
endi
if $data76 != @7.022998332@ then
return -1
endi
if $data80 != @42@ then
return -1
endi
if $data81 != @0.017701925@ then
return -1
endi
if $data82 != @0.735011178@ then
return -1
endi
if $data83 != @1.191299764@ then
return -1
endi
if $data85 != @0.036467324@ then
return -1
endi
if $data86 != @6.024578313@ then
return -1
endi
if $data90 != @42@ then
return -1
endi
if $data91 != @0.017701925@ then
return -1
endi
if $data92 != @0.735011178@ then
return -1
endi
if $data93 != @1.191299764@ then
return -1
endi
if $data95 != @0.036467324@ then
return -1
endi
if $data96 != @6.024578313@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 )
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from st0 )
if $rows != 100 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @1.832595715@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
if $data20 != @2@ then
return -1
endi
if $data21 != @-0.756802495@ then
return -1
endi
if $data22 != @1.000000000@ then
return -1
endi
if $data23 != @1.234030298@ then
return -1
endi
if $data25 != @0.755422294@ then
return -1
endi
if $data26 != @0.058157641@ then
return -1
endi
if $data30 != @3@ then
return -1
endi
if $data31 != @-0.958924275@ then
return -1
endi
if $data32 != @0.666366745@ then
return -1
endi
if $data33 != @3.428875323@ then
return -1
endi
if $data35 != @1.008737178@ then
return -1
endi
if $data36 != @2.578037959@ then
return -1
endi
if $data40 != @4@ then
return -1
endi
if $data41 != @-0.279415498@ then
return -1
endi
if $data42 != @0.614300282@ then
return -1
endi
if $data43 != @1.853464439@ then
return -1
endi
if $data45 != @0.382340276@ then
return -1
endi
if $data46 != @5.147179529@ then
return -1
endi
if $data50 != @5@ then
return -1
endi
if $data51 != @0.656986599@ then
return -1
endi
if $data52 != @0.990059086@ then
return -1
endi
if $data53 != @0.886449574@ then
return -1
endi
if $data55 != @-0.876294736@ then
return -1
endi
if $data56 != @-0.924536117@ then
return -1
endi
if $data60 != @6@ then
return -1
endi
if $data61 != @0.989358247@ then
return -1
endi
if $data62 != @0.727035131@ then
return -1
endi
if $data63 != @3.124320480@ then
return -1
endi
if $data65 != @-1.869688257@ then
return -1
endi
if $data66 != @2.172420891@ then
return -1
endi
if $data70 != @7@ then
return -1
endi
if $data71 != @0.412118485@ then
return -1
endi
if $data72 != @0.574400879@ then
return -1
endi
if $data73 != @2.137595835@ then
return -1
endi
if $data75 != @-1.811908862@ then
return -1
endi
if $data76 != @4.862055338@ then
return -1
endi
if $data80 != @8@ then
return -1
endi
if $data81 != @-0.544021111@ then
return -1
endi
if $data82 != @0.961216805@ then
return -1
endi
if $data83 != @0.578734473@ then
return -1
endi
if $data85 != @-0.719965518@ then
return -1
endi
if $data86 != @-4.087614772@ then
return -1
endi
if $data90 != @9@ then
return -1
endi
if $data91 != @-0.999990207@ then
return -1
endi
if $data92 != @0.791836209@ then
return -1
endi
if $data93 != @2.776612512@ then
return -1
endi
if $data95 != @0.592988627@ then
return -1
endi
if $data96 != @1.796697094@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 ) order by ts limit 2;
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 ) order by ts limit 2;
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @1.832595715@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
print execute sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 ) limit 2;
sql select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6 from (select * from ct1 ) limit 2;
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @1.832595715@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
print execute sql select * from (select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6, ts from st0 order by ts desc)
sql select * from (select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6, ts from st0 order by ts desc)
if $rows != 100 then
return -1
endi
if $data00 != @49@ then
return -1
endi
if $data01 != @0.670229176@ then
return -1
endi
if $data02 != @0.992374553@ then
return -1
endi
if $data03 != @0.929814367@ then
return -1
endi
if $data05 != @0.713618282@ then
return -1
endi
if $data06 != @-0.746290424@ then
return -1
endi
if $data07 != @20-10-01 00:49:00.000@ then
return -1
endi
if $data10 != @49@ then
return -1
endi
if $data11 != @0.670229176@ then
return -1
endi
if $data12 != @0.992374553@ then
return -1
endi
if $data13 != @0.929814367@ then
return -1
endi
if $data15 != @0.713618282@ then
return -1
endi
if $data16 != @-0.746290424@ then
return -1
endi
if $data17 != @20-10-01 00:49:00.000@ then
return -1
endi
if $data20 != @48@ then
return -1
endi
if $data21 != @-0.262374854@ then
return -1
endi
if $data22 != @0.620208114@ then
return -1
endi
if $data23 != @1.817585733@ then
return -1
endi
if $data25 != @1.211884234@ then
return -1
endi
if $data26 != @5.183714989@ then
return -1
endi
if $data27 != @20-10-01 00:48:00.000@ then
return -1
endi
if $data30 != @48@ then
return -1
endi
if $data31 != @-0.262374854@ then
return -1
endi
if $data32 != @0.620208114@ then
return -1
endi
if $data33 != @1.817585733@ then
return -1
endi
if $data35 != @1.211884234@ then
return -1
endi
if $data36 != @5.183714989@ then
return -1
endi
if $data37 != @20-10-01 00:48:00.000@ then
return -1
endi
if $data40 != @47@ then
return -1
endi
if $data41 != @-0.953752653@ then
return -1
endi
if $data42 != @0.659304076@ then
return -1
endi
if $data43 != @3.457510675@ then
return -1
endi
if $data45 != @0.882083819@ then
return -1
endi
if $data46 != @2.630220446@ then
return -1
endi
if $data47 != @20-10-01 00:47:00.000@ then
return -1
endi
if $data50 != @47@ then
return -1
endi
if $data51 != @-0.953752653@ then
return -1
endi
if $data52 != @0.659304076@ then
return -1
endi
if $data53 != @3.457510675@ then
return -1
endi
if $data55 != @0.882083819@ then
return -1
endi
if $data56 != @2.630220446@ then
return -1
endi
if $data57 != @20-10-01 00:47:00.000@ then
return -1
endi
if $data60 != @46@ then
return -1
endi
if $data61 != @-0.768254661@ then
return -1
endi
if $data62 != @0.999843325@ then
return -1
endi
if $data63 != @1.276316926@ then
return -1
endi
if $data65 != @-0.300459259@ then
return -1
endi
if $data66 != @0.133920399@ then
return -1
endi
if $data67 != @20-10-01 00:46:00.000@ then
return -1
endi
if $data70 != @46@ then
return -1
endi
if $data71 != @-0.768254661@ then
return -1
endi
if $data72 != @0.999843325@ then
return -1
endi
if $data73 != @1.276316926@ then
return -1
endi
if $data75 != @-0.300459259@ then
return -1
endi
if $data76 != @0.133920399@ then
return -1
endi
if $data77 != @20-10-01 00:46:00.000@ then
return -1
endi
if $data80 != @45@ then
return -1
endi
if $data81 != @0.123573123@ then
return -1
endi
if $data82 != @0.673565060@ then
return -1
endi
if $data83 != @1.519318619@ then
return -1
endi
if $data85 != @-1.566189594@ then
return -1
endi
if $data86 != @5.513771854@ then
return -1
endi
if $data87 != @20-10-01 00:45:00.000@ then
return -1
endi
if $data90 != @45@ then
return -1
endi
if $data91 != @0.123573123@ then
return -1
endi
if $data92 != @0.673565060@ then
return -1
endi
if $data93 != @1.519318619@ then
return -1
endi
if $data95 != @-1.566189594@ then
return -1
endi
if $data96 != @5.513771854@ then
return -1
endi
if $data97 != @20-10-01 00:45:00.000@ then
return -1
endi
print execute sql select * from (select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6, ts from ct1 order by ts limit 2);
sql select * from (select c1, sin(c2+2), cos(sin(c1-2)), tan(cos(c2*2))+2, asin(acos(c2%3))+acos(c3/2)+atan(c5*c2) as v4, sin(c4+4.5)+cos(c3/2), tan(c1)+log(c3, c4)+sin(c6+c3)+2 as v6, ts from ct1 order by ts limit 2);
if $rows != 2 then
return -1
endi
if $data00 != @0@ then
return -1
endi
if $data01 != @0.778073197@ then
return -1
endi
if $data02 != @0.614300282@ then
return -1
endi
if $data03 != @3.203726628@ then
return -1
endi
if $data05 != @0.022469882@ then
return -1
endi
if $data07 != @20-10-01 00:00:00.000@ then
return -1
endi
if $data10 != @1@ then
return -1
endi
if $data11 != @0.141120008@ then
return -1
endi
if $data12 != @0.666366745@ then
return -1
endi
if $data13 != @1.558041126@ then
return -1
endi
if $data14 != @1.832595715@ then
return -1
endi
if $data15 != @0.172042236@ then
return -1
endi
if $data17 != @20-10-01 00:01:00.000@ then
return -1
endi
print ===============> step 3 sql_error stable, group by, window
sql_error select sin(c2) from $stb group by tbname;
sql_error select sin(c2) from $stb group by tgcol;
sql_error select sin(c2) from $stb group by c3;
sql_error select sin(c2) from $stb interval(1m);
sql_error select sin(c2) from $stb state_window(c7);
sql_error select sin(c2) from $tb state_window(c7);
sql_error select sin(c2) from $stb session(ts, 30s);
sql_error select sin(c2) from $tb session(ts, 30s);
sql_error select sin(c2) from $stb slimit 2;
sql_error select sin(c2) from $stb interval(1m) slimit 2;
print =============== clear
#sql drop database $db
#sql show databases
#if $rows != 0 then
# return -1
#endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -21,4 +21,6 @@ run general/compute/sum.sim ...@@ -21,4 +21,6 @@ run general/compute/sum.sim
run general/compute/top.sim run general/compute/top.sim
run general/compute/block_dist.sim run general/compute/block_dist.sim
run general/compute/scalar_pow.sim run general/compute/scalar_pow.sim
run general/compute/scalar_triangle.sim
run general/compute/scalar_str_concat_len.sim
run general/compute/table_group.sim run general/compute/table_group.sim
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/exec.sh -n dnode1 -s start
sleep 500
sql connect
$dbPrefix = db
$tbPrefix = ct
$mtPrefix = st
$tbNum = 2
$rowNum = 50
print =============== step1 create stable/table
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
sql use $db
sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 nchar(5), c9 binary(10)) TAGS (tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
$y = 0.25
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , $x , $y , $x , $x , $x , $y , $x , $x , $x )
$x = $x + 1
$y = $y + 1
endw
$i = $i + 1
endw
print ================= step2
$stb = $mtPrefix . 0
$tb = $tbPrefix . 0
print execute sql select floor(3.0)+ceil(4.0) from $tb
sql select floor(3.0)+ceil(4.0) from $tb
if $rows != 50 then
return -1
endi
if $data00 != 7.000000000 then
return -1
endi
if $data10 != 7.000000000 then
return -1
endi
if $data20 != 7.000000000 then
return -1
endi
if $data30 != 7.000000000 then
return -1
endi
if $data40 != 7.000000000 then
return -1
endi
if $data50 != 7.000000000 then
return -1
endi
if $data60 != 7.000000000 then
return -1
endi
if $data70 != 7.000000000 then
return -1
endi
if $data80 != 7.000000000 then
return -1
endi
if $data90 != 7.000000000 then
return -1
endi
print execute sql select sum(c1)+3.0+4.0 from $stb
sql select sum(c1)+3.0+4.0 from $stb
if $rows != 1 then
return -1
endi
if $data00 != 2457.000000000 then
return -1
endi
print execute sql select sin(log(avg(c1),sum(c2))+3)%4 from $stb
sql select sin(log(avg(c1),sum(c2))+3)%4 from $stb
if $rows != 1 then
return -1
endi
if $data00 != -0.265074286 then
return -1
endi
print execute sql select select log(pow(length(concat('3','4')),2),c2) from $stb
sql select log(pow(length(concat('3','4')),2),c2) from $stb
print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ]
if $data00 != -1.000000000 then
return -1
endi
if $data10 != @inf@ then
return -1
endi
if $data20 != 2.000000000 then
return -1
endi
if $data30 != 1.261859507 then
return -1
endi
if $data40 != 1.000000000 then
return -1
endi
if $data50 != 0.861353116 then
return -1
endi
if $data60 != 0.773705614 then
return -1
endi
if $data70 != 0.712414374 then
return -1
endi
if $data80 != 0.666666667 then
return -1
endi
if $data90 != 0.630929754 then
return -1
endi
print execute sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from $stb
sql select round(log(pow(length(concat('3','4')),2),c2)+floor(c3))+2 from $stb
print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ]
if $data00 != 1.000000000 then
return -1
endi
if $data10 != @inf@ then
return -1
endi
if $data20 != 4.000000000 then
return -1
endi
if $data30 != 3.000000000 then
return -1
endi
if $data40 != 3.000000000 then
return -1
endi
if $data50 != 3.000000000 then
return -1
endi
if $data60 != 3.000000000 then
return -1
endi
if $data70 != 3.000000000 then
return -1
endi
if $data80 != 3.000000000 then
return -1
endi
if $data90 != 3.000000000 then
return -1
endi
$tb0 = $tbPrefix . 0
$tb1 = $tbPrefix . 1
print execute sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from $tb0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from $tb1
sql select sin(pow(c1,log(c2,2))+pow(c2,2)) as val from $tb0 union all select pow(c4,2)+tan(sin(c5)/cos(c6)) as val from $tb1
print [ $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 , $data70 , $data80 , $data90 ]
if $data00 != @-nan@ then
return -1
endi
if $data10 != 0.909297427 then
return -1
endi
if $data20 != -0.279415498 then
return -1
endi
if $data30 != 0.843325058 then
return -1
endi
if $data40 != 0.551426681 then
return -1
endi
if $data50 != -0.840606612 then
return -1
endi
if $data60 != 0.436161076 then
return -1
endi
if $data70 != 0.897498185 then
return -1
endi
if $data80 != -0.885952778 then
return -1
endi
if $data90 != 0.429470715 then
return -1
endi
print execute sql select asin(c1) from $stb limit 1
sql select asin(c1) from $stb limit 1
if $data00 != 0.000000000 then
return -1
endi
print execute sql select pow(c1,2) from $stb limit 1 offset 2;
sql select pow(c1,2) from $stb limit 1 offset 2;
if $data00 != 4.000000000 then
return -1
endi
print exeucte sql select cos(c1) from db0.ct0, db0.ct1 where ct0.ts==ct1.ts;
sql select cos(c1) from db0.ct0, db0.ct1 where ct0.ts==ct1.ts
if $rows != 50 then
return -1
endi
if $data10 != 0.540302306 then
return -1
endi
print ============== invalid expressions
sql_error select agg(c1)+c2 from $stb
sql_error select agg(c1+2) from $stb
sql_error select agg(ceil(c1))+c2 from $stb
sql_error select agg(ceil(c1)) from $stb
sql_error select asin(c1) from $stb group by tbname
sql_error select asin(c2) from $stb group by tgcol
sql_error select asin(c1) from $stb session_window(ts, 1s)
sql_error select cos(c1) from $stb state_window(f1)
sql_error select pow(c2,2) from $stb interval(1s) sliding(500a)
sql_error select pow(c2,2) from $stb state_window(f1)
sql_error select tan(f1) from $stb from d.st slimit 1
sql_error select f1+2, tbname from $stb group by tbname
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -39,6 +39,8 @@ run general/compute/sum.sim ...@@ -39,6 +39,8 @@ run general/compute/sum.sim
run general/compute/top.sim run general/compute/top.sim
run general/compute/block_dist.sim run general/compute/block_dist.sim
run general/compute/scalar_pow.sim run general/compute/scalar_pow.sim
run general/compute/scalar_triangle.sim
run general/compute/scalar_str_concat_len.sim
run general/compute/table_group.sim run general/compute/table_group.sim
run general/db/alter_option.sim run general/db/alter_option.sim
run general/db/alter_tables_d2.sim run general/db/alter_tables_d2.sim
...@@ -142,6 +144,7 @@ run general/parser/tags_dynamically_specifiy.sim ...@@ -142,6 +144,7 @@ run general/parser/tags_dynamically_specifiy.sim
run general/parser/set_tag_vals.sim run general/parser/set_tag_vals.sim
run general/parser/repeatAlter.sim run general/parser/repeatAlter.sim
run general/parser/precision_ns.sim run general/parser/precision_ns.sim
run general/parser/scalar_expression.sim
##unsupport run general/parser/slimit_alter_tags.sim ##unsupport run general/parser/slimit_alter_tags.sim
run general/stable/disk.sim run general/stable/disk.sim
run general/stable/dnode3.sim run general/stable/dnode3.sim
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册