Skip to content

Commit

Permalink
[fix](planner)nullable info of agg node's intermediate and output slo…
Browse files Browse the repository at this point in the history
…ts should be same (apache#29315)
  • Loading branch information
starocean999 authored Jan 2, 2024
1 parent 7064637 commit 4692a62
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public void finalize(Analyzer analyzer) throws UserException {
List<Expr> groupingExprs = aggInfo.getGroupingExprs();
for (int i = 0; i < groupingExprs.size(); i++) {
aggInfo.getOutputTupleDesc().getSlots().get(i).setIsNullable(groupingExprs.get(i).isNullable());
aggInfo.getIntermediateTupleDesc().getSlots().get(i).setIsNullable(groupingExprs.get(i).isNullable());
aggInfo.getOutputTupleDesc().computeMemLayout();
}
}
Expand Down
3 changes: 3 additions & 0 deletions regression-test/data/correctness_p0/test_agg_materialize.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
1
qycs

-- !selectx --
1 1

55 changes: 55 additions & 0 deletions regression-test/suites/correctness_p0/test_agg_materialize.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,59 @@ suite("test_agg_materialize") {
ORDER BY SPJ.org_code;
"""
sql """drop table if exists c5749_bug_t;"""

sql """drop table if exists table_test_count_distinct;"""
sql """CREATE TABLE `table_test_count_distinct` (
`special_zone_name` VARCHAR(65532) NULL,
`day` VARCHAR(65532) NOT NULL
) ENGINE=OLAP
DUPLICATE KEY(`special_zone_name`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`special_zone_name`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);"""
sql """insert into
table_test_count_distinct
values
(
'a',
"2023-12-01"
);"""
qt_selectx"""SELECT
(COUNT(DISTINCT descript)) as c475859316,
(COUNT(DISTINCT day)) as c125327027
FROM
(
SELECT
descript,
day
FROM
(
with tmp2 as (
select
special_zone_name as descript,
cast(day as datev2) as day
from
table_test_count_distinct
union
all
select
special_zone_name as descript,
cast(day as datev2) as day
from
table_test_count_distinct
)
select
t1.descript,
t1.day
from
tmp2 t1
) t665446993
) t1600566476
GROUP BY
day;"""
sql """drop table if exists table_test_count_distinct;"""
}

0 comments on commit 4692a62

Please sign in to comment.