-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove inline table scan analyzer rule #15201
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
83a3956
add inline table scan
jayzhan211 6a2e63d
fix test
jayzhan211 c3f92e6
rm rule
jayzhan211 e1b1d8a
rm code
jayzhan211 6bb67af
dataframe
jayzhan211 b88374f
remove logic in plan_from_tables
jayzhan211 446d652
fix query
jayzhan211 33582cf
Merge branch 'main' of github.com:apache/datafusion into inline-table-mv
jayzhan211 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 |
---|---|---|
|
@@ -465,9 +465,7 @@ impl LogicalPlanBuilder { | |
projection: Option<Vec<usize>>, | ||
filters: Vec<Expr>, | ||
) -> Result<Self> { | ||
TableScan::try_new(table_name, table_source, projection, filters, None) | ||
.map(LogicalPlan::TableScan) | ||
.map(Self::new) | ||
Self::scan_with_filters_inner(table_name, table_source, projection, filters, None) | ||
} | ||
|
||
/// Convert a table provider into a builder with a TableScan with filter and fetch | ||
|
@@ -478,9 +476,37 @@ impl LogicalPlanBuilder { | |
filters: Vec<Expr>, | ||
fetch: Option<usize>, | ||
) -> Result<Self> { | ||
TableScan::try_new(table_name, table_source, projection, filters, fetch) | ||
.map(LogicalPlan::TableScan) | ||
.map(Self::new) | ||
Self::scan_with_filters_inner( | ||
table_name, | ||
table_source, | ||
projection, | ||
filters, | ||
fetch, | ||
) | ||
} | ||
|
||
fn scan_with_filters_inner( | ||
table_name: impl Into<TableReference>, | ||
table_source: Arc<dyn TableSource>, | ||
projection: Option<Vec<usize>>, | ||
filters: Vec<Expr>, | ||
fetch: Option<usize>, | ||
) -> Result<Self> { | ||
let table_scan = | ||
TableScan::try_new(table_name, table_source, projection, filters, fetch)?; | ||
|
||
// Inline TableScan | ||
if table_scan.filters.is_empty() { | ||
if let Some(p) = table_scan.source.get_logical_plan() { | ||
let sub_plan = p.into_owned(); | ||
// Ensures that the reference to the inlined table remains the | ||
// same, meaning we don't have to change any of the parent nodes | ||
// that reference this table. | ||
return Self::new(sub_plan).alias(table_scan.table_name); | ||
} | ||
} | ||
|
||
Ok(Self::new(LogicalPlan::TableScan(table_scan))) | ||
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. seems like the same logic should apply to scan_with_filters_fetch below |
||
} | ||
|
||
/// Wrap a plan in a window | ||
|
This file was deleted.
Oops, something went wrong.
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
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
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.
I am concerned about this change -- it seems like a regression to me.
Maybe it is ok, but I don't understand the difference/ why there are a bunch of projections / SubqueryAlias nows
If these are fixed by physical plan time it is fine, but from here it looks like something is wrong
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 explain it in the above #15201 (comment)