-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
area/colocatedIssues or PRs related to colocated tablesIssues or PRs related to colocated tablesarea/plannerIssues or PRs related to the query plannerIssues or PRs related to the query plannerkind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Describe the bug
The result of following query is incorrect:
SELECT k1, k2, SUM( k3 ) FROM table GROUP BY GROUPING SETS ( (k1, k2), (k1), (k2), ( ) ) order by k1, k2;
The result number is incorrect.
There are some duplicate rows that have not been aggregated.
To Reproduce
Steps to reproduce the behavior:
- create table , distributed by k1
CREATE TABLE `table` (
`k1` tinyint(4) NULL COMMENT "",
`k2` smallint(6) NULL COMMENT "",
`k3` int(11) NULL COMMENT "",
`k4` bigint(20) NULL COMMENT "",
`k5` decimal(9, 3) NULL COMMENT "",
`k6` char(5) NULL COMMENT "",
`k10` date NULL COMMENT "",
`k11` datetime NULL COMMENT "",
`k7` varchar(20) NULL COMMENT "",
`k8` double MAX NULL COMMENT "",
`k9` float SUM NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`k1`, `k2`, `k3`, `k4`, `k5`, `k6`, `k10`, `k11`, `k7`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`k1`) BUCKETS 5
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);
- load data
- open colocate session variables
set disable_colocate_plan = false
- query, the answer is incorrect
SELECT k1, k2, SUM( k3 ) FROM table GROUP BY GROUPING SETS ( (k1, k2), (k1), (k2), ( ) ) order by k1, k2
Expected behavior
the correct answer should be same as the answer of query:
SELECT * FROM\n (SELECT k1 as k1, k2 as k2, SUM( k3 ) FROM test_query_qa.baseall GROUP BY k1, k2 UNION\n SELECT k1, null, SUM( k3 ) FROM test_query_qa.baseall GROUP BY k1 UNION\n SELECT null, k2, SUM( k3 ) FROM test_query_qa.baseall GROUP BY k2 UNION\n SELECT null, null, SUM( k3 )FROM test_query_qa.baseall\n ) t ORDER BY k1, k2
After colocate aggregation pr.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/colocatedIssues or PRs related to colocated tablesIssues or PRs related to colocated tablesarea/plannerIssues or PRs related to the query plannerIssues or PRs related to the query plannerkind/fixCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.