提交 a713d367 编写于 作者: S shenglian zhou

support sql function scalar_func(const) like floor(3.0)

上级 88a4b851
...@@ -4303,12 +4303,10 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr, ...@@ -4303,12 +4303,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);
} }
...@@ -4317,8 +4315,6 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr, ...@@ -4317,8 +4315,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;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册