-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix:22477 any all schema error #22915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HairstonE
wants to merge
3
commits into
apache:main
Choose a base branch
from
HairstonE:fix/22477-any-all-schema-error
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+77
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -1598,6 +1598,25 @@ logical_plan | |
| 21)----------Projection: column1 AS v | ||
| 22)------------Values: (Int64(5)), (Int64(NULL)) | ||
|
|
||
| # same-table `= ANY` / `<> ALL` must plan without | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without the code change in this PR, this test fails as expected cargo test --profile=ci --test sqllogictests
...
Completed 475 test files in 9 seconds External error: 2 errors in file /Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt
1. query failed: DataFusion error: Optimizer rule 'optimize_projections' failed
caused by
Schema error: Schema contains duplicate unqualified field name mark
[SQL] select id from set_cmp_self where age = any(select age from set_cmp_self);
at /Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt:1606
2. query failed: DataFusion error: Optimizer rule 'optimize_projections' failed
caused by
Schema error: Schema contains duplicate unqualified field name mark
[SQL] select id from set_cmp_self where age <> all(select age from set_cmp_self);
at /Users/andrewlamb/Software/datafusion3/datafusion/sqllogictest/test_files/subquery.slt:1613
|
||
| # "duplicate unqualified field name mark". | ||
| statement ok | ||
| create table set_cmp_self(id int, age int) as values (1, 20), (2, 30), (3, 40); | ||
|
|
||
| query I rowsort | ||
| select id from set_cmp_self where age = any(select age from set_cmp_self); | ||
| ---- | ||
| 1 | ||
| 2 | ||
| 3 | ||
|
|
||
| query I | ||
| select id from set_cmp_self where age <> all(select age from set_cmp_self); | ||
| ---- | ||
|
|
||
| statement count 0 | ||
| drop table set_cmp_self; | ||
|
|
||
| # correlated_recursive_scalar_subquery_with_level_3_exists_subquery_referencing_level1_relation | ||
| query TT | ||
| explain select c_custkey from customer | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this code was added in #21265 from @buraksenn
@buraksenn do you have some time to help review this proposed change?
I think it would help if we can also document in comments why
[0]is being appendedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we only need to add the column in some cases -- why does this code add it unconditionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I traced the error there and that change guaranteed the column would be non-empty. Typing that out makes me think I shouldn't assume they are empty? So I should only deal with the empty case.