Skip to content

[Bug] wrong result when useing group by. #14372

@siriume

Description

@siriume

Search before asking

  • I had searched in the issues and found no similar issues.

Version

branch-1.2-lts
Git : git://lts12@9de1fec

What's Wrong?

Test table like this

CREATE TABLE `tb_holiday` (
  `date` bigint(20) NOT NULL COMMENT '日期',
  `holiday` tinyint(4) NOT NULL COMMENT '节假日',
  `holiday_cn` varchar(9) NOT NULL COMMENT '节假日'
) ENGINE=OLAP
UNIQUE KEY(`date`)
COMMENT '节假日'
DISTRIBUTED BY HASH(`date`) BUCKETS 4
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"in_memory" = "false",
"storage_format" = "V2",
"compression" = "LZ4",
"disable_auto_compaction" = "false"
);

sql like this

SELECT
 date_format(date, '%x%v') AS `date`,
 count(date) AS `diff_days`
FROM `tb_holiday`
WHERE `date` between 20221111 AND 20221116
GROUP BY date
ORDER BY date;

result like this

202245,1
202245,1
202245,1
202246,1
202246,1
202246,1

What You Expected?

result like this

202245,3
202246,3

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions