diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index c623e94a12..1042e6b30d 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1627,7 +1627,8 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); for (int32_t i = 0; i < numOfOutput; ++i) { const char* pName = pCtx[i].pExpr->pExpr->_function.functionName; - if ((strcmp(pName, "_select_value") == 0) || (strcmp(pName, "_group_key") == 0)) { + if ((strcmp(pName, "_select_value") == 0) || (strcmp(pName, "_group_key") == 0) + || (strcmp(pName, "_group_const_value") == 0)) { pValCtx[num++] = &pCtx[i]; } else if (fmIsSelectFunc(pCtx[i].functionId)) { void* data = taosHashGet(pSelectFuncs, pName, strlen(pName)); diff --git a/tests/script/tsim/parser/select_with_tags.sim b/tests/script/tsim/parser/select_with_tags.sim index 0cc8a7db8a..a4c460a937 100644 --- a/tests/script/tsim/parser/select_with_tags.sim +++ b/tests/script/tsim/parser/select_with_tags.sim @@ -452,6 +452,43 @@ if $data04 != @abc0@ then return -1 endi +sql select ts, top(c1, 100), tbname, t1, t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') partition by tbname order by ts; +if $row != 200 then + return -1 +endi + +if $data00 != @70-01-01 08:01:40.087@ then + return -1 +endi + +if $data10 != @70-01-01 08:01:40.088@ then + return -1 +endi + +if $data20 != @70-01-01 08:01:40.089@ then + return -1 +endi + +if $data90 != @70-01-01 08:01:40.096@ then + return -1 +endi + +if $data01 != 87 then + return -1 +endi + +if $data02 != @select_tags_tb0@ then + return -1 +endi + +if $data03 != 0 then + return -1 +endi + +if $data04 != @abc0@ then + return -1 +endi + sql select ts, top(c1, 2), t2, tbname, t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname,t2 order by ts; if $row != 4 then return -1