From 45d9af932f987eaa18c0e442255f37f48770da5c Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 9 May 2022 23:07:30 +0800 Subject: [PATCH] fix(query): group by with proj query can not work well --- src/query/src/qExecutor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 9dc5e9a7b1..8e05c1bd39 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -2072,6 +2072,12 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr } else if (functionId == TSDB_FUNC_SCALAR_EXPR) { pCtx->param[1].pz = (char*) &pRuntimeEnv->sasArray[i]; } + + // if group by , TSDB_FUNC_PRJ operator must set one row + if (pQueryAttr->groupbyColumn && functionId == TSDB_FUNC_PRJ) { + pCtx->param[0].i64 = 1; + pCtx->param[0].nType = TSDB_DATA_TYPE_BIGINT; + } } for(int32_t i = 1; i < numOfOutput; ++i) { -- GitLab