fix: duplicated groups result in group by

This commit is contained in:
dapan1121 2022-12-23 12:04:20 +08:00
parent 2c63901782
commit c318be9214
3 changed files with 25 additions and 1 deletions

View File

@ -317,7 +317,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
if (pProjectInfo->mergeDataBlocks) { if (pProjectInfo->mergeDataBlocks) {
if (pRes->info.rows > 0) { if (pRes->info.rows > 0) {
pFinalRes->info.id.groupId = pRes->info.id.groupId; pFinalRes->info.id.groupId = 0; //clear groupId
pFinalRes->info.version = pRes->info.version; pFinalRes->info.version = pRes->info.version;
// continue merge data, ignore the group id // continue merge data, ignore the group id

View File

@ -175,6 +175,7 @@
,,y,script,./test.sh -f tsim/query/session.sim ,,y,script,./test.sh -f tsim/query/session.sim
,,y,script,./test.sh -f tsim/query/udf.sim ,,y,script,./test.sh -f tsim/query/udf.sim
,,y,script,./test.sh -f tsim/query/udf_with_const.sim ,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/groupby.sim
,,y,script,./test.sh -f tsim/qnode/basic1.sim ,,y,script,./test.sh -f tsim/qnode/basic1.sim
,,y,script,./test.sh -f tsim/snode/basic1.sim ,,y,script,./test.sh -f tsim/snode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic1.sim ,,y,script,./test.sh -f tsim/mnode/basic1.sim

View File

@ -0,0 +1,23 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql drop database if exists db1;
sql create database db1;
sql use db1;
sql create table test(pos_time TIMESTAMP,target_id INT ,data DOUBLE) tags(scene_id BIGINT,data_stage VARCHAR(64),data_source VARCHAR(64));
sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232060000,413254290,1);
sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232061000,413254290,2);
sql insert into _413254290_108_1001_ using test tags(108,'1001','') values(1667232062000,413254290,3);
sql insert into _413254000_108_1001_ using test tags(109,'1001','') values(1667232060000,413254290,3);
sql insert into _413254000_108_1001_ using test tags(109,'1001','') values(1667232062000,413254290,3);
sql select target_name,max(time_diff) AS time_diff,(count(1)) AS track_count from (select tbname as target_name,diff(pos_time) time_diff from test where tbname in ('_413254290_108_1001_','_413254000_108_1001_') partition by tbname) a group by target_name;
if $rows != 2 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT