Skip to content

Commit 5de4309

Browse files
lichuangBohuTANG
andauthored
fix: fix group by cube with join panic assert (#15515)
fix: fix group by bug Co-authored-by: Bohu <overred.shuttler@gmail.com>
1 parent a646bb4 commit 5de4309

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/query/sql/src/executor/physical_plans/physical_aggregate_expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl AggregateExpand {
5252
// All group by columns will wrap nullable.
5353
let i = input_schema.index_of(&group_by.to_string())?;
5454
let f = &mut output_fields[i];
55-
debug_assert_eq!(f.data_type(), ty);
55+
debug_assert!(f.data_type() == ty || f.data_type().wrap_nullable() == *ty);
5656
*f = DataField::new(f.name(), f.data_type().wrap_nullable());
5757
let new_field = DataField::new(&actual.to_string(), ty.clone());
5858
output_fields.push(new_field);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
statement ok
2+
drop table if exists tt1;
3+
4+
statement ok
5+
drop table if exists tt2;
6+
7+
statement ok
8+
create table tt1(a bool not null, b bitmap not null, c int not null);
9+
10+
statement ok
11+
create table tt2(a bool not null, b bitmap not null, c int not null);
12+
13+
statement ok
14+
insert into tt1 values (true, '1,2', 1),(true, '1,2,3', 2);
15+
16+
statement ok
17+
insert into tt2 values (true, '1,2', 1),(true, '1,2,3', 2);
18+
19+
query I
20+
select tt1.c from tt1 right outer join tt2 using(b) where tt1.a group by cube(tt1.c) order by c;
21+
----
22+
1
23+
2
24+
NULL

0 commit comments

Comments
 (0)