forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](nereids) window function with grouping sets work not well (apac…
…he#31475) ```sql select a, c, sum(sum(b)) over(partition by c order by c rows between unbounded preceding and current row) from test_window_table2 group by grouping sets((a),( c)) having a > 1 order by 1,2,3; ``` for this kind of case: sum(sum(col)) over, nereids has cannot find slot problem. the output slot of repeat and aggregate is computed wrongly. Only collecting the trival-agg in NormalizeRepeat can fix this problem. Co-authored-by: feiniaofeiafei <[email protected]>
- Loading branch information
1 parent
bd4bb58
commit d615624
Showing
5 changed files
with
76 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
regression-test/data/nereids_rules_p0/grouping_sets/window_agg_grouping_sets.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select1 -- | ||
2 \N 46.0000000000 | ||
|
40 changes: 40 additions & 0 deletions
40
regression-test/suites/nereids_rules_p0/grouping_sets/window_agg_grouping_sets.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
suite("window_agg_grouping_sets") { | ||
sql "SET enable_nereids_planner=true" | ||
sql "SET enable_fallback_to_original_planner=false" | ||
sql """ | ||
DROP TABLE IF EXISTS test_window_table2 | ||
""" | ||
|
||
sql """ | ||
create table test_window_table2 ( a varchar(100) null, b decimalv3(18,10) null, c int, ) ENGINE=OLAP | ||
DUPLICATE KEY(`a`) DISTRIBUTED BY HASH(`a`) BUCKETS 1 PROPERTIES | ||
( "replication_allocation" = "tag.location.default: 1" ); | ||
""" | ||
|
||
sql """ | ||
insert into test_window_table2 values("1", 1, 1),("1", 1, 2),("1", 2, 1),("1", 2, 2), | ||
("2", 11, 1),("2", 11, 2),("2", 12, 1),("2", 12, 2); | ||
""" | ||
|
||
qt_select1 """ | ||
select a, c, sum(sum(b)) over(partition by c order by c rows between unbounded preceding and current row) | ||
from test_window_table2 group by grouping sets((a),( c)) having a > 1 order by 1,2,3; | ||
""" | ||
|
||
} |