forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: unparser generates wrong sql for derived table with columns #17
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
Merged
+96
−10
Conversation
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
903ffd1 to
37fc43f
Compare
37fc43f to
51156f1
Compare
51156f1 to
9ab73c5
Compare
peasee
approved these changes
Jul 17, 2024
Sevenannn
approved these changes
Jul 17, 2024
phillipleblanc
approved these changes
Jul 17, 2024
y-f-u
added a commit
that referenced
this pull request
Jul 17, 2024
* fix unparser for derived table with columns * refactoring * renaming * case in tests
y-f-u
added a commit
that referenced
this pull request
Jul 22, 2024
apache#11505) * fix unparser for derived table with columns * refactoring * renaming * case in tests
phillipleblanc
pushed a commit
that referenced
this pull request
Apr 22, 2025
… ParquetOpener (apache#15561) * parquet reader: move pruning predicate creation from ParquetSource to ParquetOpener * use file schema, avoid loading page index if unecessary * Add comment * add comment * Add comment * remove check * fix clippy * update sqllogictest * restore to explain plans * reverted * modify access * Fix ArrowReaderOptions should read with physical_file_schema so we do… (#17) * Fix ArrowReaderOptions should read with physical_file_schema so we don't need to cast back to utf8 * Fix fmt * Update opener.rs * Always apply per-file schema during parquet read (#18) * Update datafusion/datasource-parquet/src/opener.rs --------- Co-authored-by: Qi Zhu <821684824@qq.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why this happens:
ast parser will generate a logic plan for derived table with columns
However the unparser wasn't able to understand the context of two projections are a result of derived table columns.
In contract, the other type of derived table will generate plan like below which unparser was capable to handle.
The fix is to have a strict rule to detect if a subquery plan matches the derived table with columns pattern, then unwrap the first layer
aliasprojection into table alias with columns which ast has already supported.Background
The error was detected from the roundtrip of tpch-13 query
related to the issue in spiceai/datafusion-federation#11