-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enhance table scan unparsing to avoid unnamed subqueries. #13006
Enhance table scan unparsing to avoid unnamed subqueries. #13006
Conversation
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.
This makes sense to me -- thank you @goldmedal
Perhaps @phillipleblanc and @sgrebnov have some time to review this as well
Let's merge this in and we can address any feedback as a follow on PR |
if alias.is_some() | ||
&& (table_scan.projection.is_some() || !table_scan.filters.is_empty()) | ||
{ | ||
builder = builder.alias(alias.clone().unwrap())?; | ||
} | ||
|
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.
if alias.is_some() | |
&& (table_scan.projection.is_some() || !table_scan.filters.is_empty()) | |
{ | |
builder = builder.alias(alias.clone().unwrap())?; | |
} | |
if let Some(ref alias) = alias { | |
if table_scan.projection.is_some() || !table_scan.filters.is_empty() { | |
builder = builder.alias(alias.clone())?; | |
} | |
} |
I find this to be slightly cleaner
if alias.is_some() | ||
&& (table_scan.projection.is_none() && table_scan.filters.is_empty()) | ||
{ | ||
builder = builder.alias(alias.clone().unwrap())?; | ||
} |
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.
if alias.is_some() | |
&& (table_scan.projection.is_none() && table_scan.filters.is_empty()) | |
{ | |
builder = builder.alias(alias.clone().unwrap())?; | |
} | |
if let Some(alias) = alias { | |
if table_scan.projection.is_some() || !table_scan.filters.is_empty() { | |
builder = builder.alias(alias)?; | |
} | |
} |
No need for a clone here.
Whoops, I had pending feedback that I didn't submit in time. |
I do that far more often than I would like to admit. Maybe it is a good excuse for a follow on PR |
@phillipleblanc I just noticed your reply now 😮. These suggestions make sense to me. I'll submit a follow PR for them soon. |
* init (apache#12453) * Fix unparse table scan with the projection pushdown (apache#12534) * unparse the projection base on the source schema * refactor and enhance the test * Fix unparsing OFFSET (apache#12539) * Unparse Sort with pushdown limit to SQL string (apache#12873) * unparse Sort with push down limit * cargo fmt * set query limit directly * Unparse `SubqueryAlias` without projections to SQL (apache#12896) * change pub function comment to doc * unparse subquery alias without projections * fix tests * rollback the empty line * rollback the empty line * exclude the table_scan with pushdown case * fmt and clippy * simplify the ast to string and remove unused debug code * enhance unparsing plan with pushdown to avoid unnamed subquery (apache#13006) * Update --------- Co-authored-by: Lordworms <[email protected]> Co-authored-by: Jax Liu <[email protected]> Co-authored-by: Justus Flerlage <[email protected]>
Which issue does this PR close?
It's a follow-up PR of #12896
Rationale for this change
from #12896 (comment)
What changes are included in this PR?
Are these changes tested?
Enhance the original tests
Are there any user-facing changes?