-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-10593] [SQL] fix resolve output of Generate #8755
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
Conversation
|
Test build #42442 has finished for PR 8755 at commit
|
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.
Should we do this for transformExpressionsUp, transformAllExpressions too?
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.
Good question, ResolveReferences only uses transformExpressionsUp, also Generate is the only special case that need it. So it's enough for now.
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.
To be safe, I will move this change into Generate.
|
Hi @davies , I think the idea of only transform expressions that defined in What do you think? |
|
Test build #42495 has finished for PR 8755 at commit
|
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.
Duplicating this code is kind of scary to me. I think I like the other fix better. Though ideally, I think that we would just fix the Analyzer to understand that generate is special.
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.
The reason I switched to in way is to isolate the change, because expressions.contains(e) could be expensive for wider tables (there are many columns). Should we improve the previous one (using lazy val and Set)?
|
Test build #1757 has finished for PR 8755 at commit
|
|
Test build #1764 has finished for PR 8755 at commit
|
|
@cloud-fan I tried to change the output to be |
|
|
|
@yhuai @cloud-fan I had changed to use a special case for Generate in ResolveReferrence, please take another look, thanks! |
|
Test build #42772 has finished for PR 8755 at commit
|
|
Test build #1782 has finished for PR 8755 at commit
|
|
This is a simple fix and it works. However, it still seems hacky to me and I'm thinking about introducing an |
|
I think this seems fine for now. Generate has always been a weird case since its one of the few places new attributes just appear in non-leaf nodes. |
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.
It will be good to say that ResolveGenerate will create AttributeReferences for output. I will fix it when merging it.
|
LGTM. Merging to branch 1.5 and master. |
The output of Generate should not be resolved as Reference. Author: Davies Liu <davies@databricks.com> Closes apache#8755 from davies/view. (cherry picked from commit 22d4015) Signed-off-by: Yin Huai <yhuai@databricks.com> (cherry picked from commit c3112a9)
The output of Generate should not be resolved as Reference.