matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.79k stars 277 forks source link

[Bug]: optimize the result of rollup. #19985

Open Ariznawlll opened 3 days ago

Ariznawlll commented 3 days ago

Is there an existing issue for the same bug?

Branch Name

main

Commit ID

e7771f644

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

image

Expected Behavior

after displaying according to the grouping, the result should be consistent with mysql, otherwise it is not convenient to view the results.

Steps to Reproduce

drop table if exists sales;
create table sales (
year int,
quarter char(2),
product varchar(50),
amount decimal(10, 2)
);
insert into sales (year, quarter, product, amount) VALUES
(2022, 'Q1', 'Product A', 1000.00),
(2022, 'Q1', 'Product B', 1500.00),
(2022, 'Q2', 'Product A', 2000.00),
(2022, 'Q2', 'Product C', 2500.00),
(2023, 'Q1', 'Product A', 3000.00),
(2023, 'Q1', 'Product B', 3500.00),
(2023, 'Q2', 'Product B', 4000.00),
(2023, 'Q2', 'Product C', 4500.00);
select
    year,
    quarter,
    null as product,
    sum(amount) as total_sales
from
    sales
group by
    year,
    quarter with rollup;

select
    year,
    quarter,
    product,
    sum(amount) as total_sales
from
    sales
group by
    year,
    quarter,
    product with rollup;

Additional information

No response

Ariznawlll commented 3 days ago

与高老师商量,rollup相关issue均放到2.1.0解决