[td-10564] Fix bug in parser sql.
This commit is contained in:
parent
7c9d760026
commit
bdcaeff12b
|
@ -3158,9 +3158,16 @@ int32_t sqlExprToExprNode(tExprNode **pExpr, const tSqlExpr* pSqlExpr, SQuerySt
|
||||||
}
|
}
|
||||||
|
|
||||||
// scalar op aggregate check
|
// 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;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,8 +406,8 @@ TEST(testCase, function_Test10) {
|
||||||
sqlCheck("select cov(a, b) from `t.1abc`", true);
|
sqlCheck("select cov(a, b) from `t.1abc`", true);
|
||||||
sqlCheck("select sum(length(a) + count(b)) from `t.1abc`", false);
|
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 concat(concat(a,b), concat(a,b)) from `t.1abc`", true);
|
||||||
// sqlCheck("select length(length(length(a))) from `t.1abc`", true);
|
sqlCheck("select length(length(length(a))) from `t.1abc`", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(testCase, function_Test6) {
|
TEST(testCase, function_Test6) {
|
||||||
|
|
Loading…
Reference in New Issue