-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(optimizer): can't apply pull_up_correlated_predicate_agg_rule wit…
…h non-null-propagating expr (#20012) Signed-off-by: xxchan <[email protected]>
- Loading branch information
Showing
4 changed files
with
220 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
CREATE TABLE foo ( | ||
id int | ||
); | ||
|
||
statement ok | ||
CREATE TABLE bar ( | ||
id int, | ||
foo_id int | ||
); | ||
|
||
statement ok | ||
insert into foo values (1),(2); | ||
|
||
query I rowsort | ||
select | ||
foo.id, array( | ||
select | ||
1 | ||
from bar | ||
where bar.foo_id = foo.id | ||
) | ||
from foo; | ||
---- | ||
1 {} | ||
2 {} | ||
|
||
|
||
query I rowsort | ||
select foo.id, (select count(id) from bar where bar.foo_id = foo.id) from foo; | ||
---- | ||
1 0 | ||
2 0 | ||
|
||
query I rowsort | ||
select foo.id, (select avg(id) from bar where bar.foo_id = foo.id) from foo; | ||
---- | ||
1 NULL | ||
2 NULL | ||
|
||
query I rowsort | ||
select foo.id, (select max(id) from bar where bar.foo_id = foo.id) from foo; | ||
---- | ||
1 NULL | ||
2 NULL | ||
|
||
query I rowsort | ||
select foo.id, (select coalesce( max(id), 114514) from bar where bar.foo_id = foo.id) from foo; | ||
---- | ||
1 114514 | ||
2 114514 | ||
|
||
statement ok | ||
drop table foo; | ||
|
||
statement ok | ||
drop table bar; |
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
Oops, something went wrong.