提交 bdcaeff1 编写于 作者: H Haojun Liao

[td-10564] Fix bug in parser sql.

上级 7c9d7600
......@@ -3137,7 +3137,7 @@ int32_t sqlExprToExprNode(tExprNode **pExpr, const tSqlExpr* pSqlExpr, SQuerySt
}
} else {
*pExpr = (tExprNode *)calloc(1, sizeof(tExprNode));
*pExpr = (tExprNode*)calloc(1, sizeof(tExprNode));
(*pExpr)->nodeType = TEXPR_BINARYEXPR_NODE;
(*pExpr)->_node.pLeft = pLeft;
......@@ -3158,9 +3158,16 @@ int32_t sqlExprToExprNode(tExprNode **pExpr, const tSqlExpr* pSqlExpr, SQuerySt
}
// scalar op aggregate check
if (pLeft->nodeType == TEXPR_FUNCTION_NODE && pRight->nodeType != TEXPR_FUNCTION_NODE) {
return buildInvalidOperationMsg(pMsgBuf, "invalid expression");
}
if (pLeft->nodeType == TEXPR_FUNCTION_NODE && pRight->nodeType == TEXPR_FUNCTION_NODE) {
if (qIsAggregateFunction(pLeft->_function.functionName) != qIsAggregateFunction(pRight->_function.functionName)) {
return buildInvalidOperationMsg(pMsgBuf, "invalid expression");
}
}
}
return TSDB_CODE_SUCCESS;
}
......
......@@ -406,8 +406,8 @@ TEST(testCase, function_Test10) {
sqlCheck("select cov(a, b) from `t.1abc`", true);
sqlCheck("select sum(length(a) + count(b)) from `t.1abc`", false);
// sqlCheck("select concat(concat(a,b), concat(a,b)) from `t.1abc`", true);
// sqlCheck("select length(length(length(a))) from `t.1abc`", true);
sqlCheck("select concat(concat(a,b), concat(a,b)) from `t.1abc`", true);
sqlCheck("select length(length(length(a))) from `t.1abc`", true);
}
TEST(testCase, function_Test6) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册