提交 2efab798 编写于 作者: S shenglian zhou

set output type for no input functions and try to implement select pow(min(f1),2 from d.st

上级 882152b2
......@@ -1828,6 +1828,8 @@ static int32_t handleScalarExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t e
static int32_t handleAggregateExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t exprIndex, tSqlExprItem* pItem,
SColumnList* columnList, bool finalResult) {
const char* msg2 = "invalid arithmetic expression in select clause";
columnList->num = 0;
columnList->ids[0] = (SColumnIndex) {0, 0};
......@@ -1862,6 +1864,11 @@ static int32_t handleAggregateExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_
}
pInfo->pExpr = pExprInfo;
ret = exprTreeValidateTree(pExprInfo->pExpr);
if (ret != TSDB_CODE_SUCCESS) {
tExprTreeDestroy(pExprInfo->pExpr, NULL);
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
SBufferWriter bw = tbufInitWriter(NULL, false);
......@@ -1879,7 +1886,7 @@ static int32_t handleAggregateExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_
pSqlExpr->param[0].nType = TSDB_DATA_TYPE_BINARY;
// tbufCloseWriter(&bw); // TODO there is a memory leak
tExprTreeDestroy(pInfo->pExpr->pExpr, NULL);
return TSDB_CODE_SUCCESS;
}
......
......@@ -417,8 +417,10 @@ void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper
uint8_t numChildren = pExpr->_func.numChildren;
if (numChildren == 0) {
_expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId);
scalarFn(pExpr->_func.functionId, NULL, 0, output, order);
output->type = pExpr->resultType;
output->bytes = pExpr->resultBytes;
output->numOfRows = numOfRows;
scalarFn(pExpr->_func.functionId, NULL, 0, output, order);
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册