-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-54669][SQL] Remove redundant casting in rCTEs #53428
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
[SPARK-54669][SQL] Remove redundant casting in rCTEs #53428
Conversation
dongjoon-hyun
left a comment
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.
Please file a JIRA issue due to the number of lines, @Pajaraja . 😄
| if (widerType.isDefined && widerType.get == dt) { | ||
| Alias(Cast(attr, dt), attr.name)() | ||
| if (attr.dataType != dt) { | ||
| Alias(Cast(attr, dt, Some(conf.sessionLocalTimeZone)), attr.name)() |
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 is non-trivial because you are adding Some(conf.sessionLocalTimeZone).
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 added a test with time sensitive CAST in the golden file, but I think it's okay either way since ResolveTimeZone is in the same batch as TypeCoercion.
I changed it here to have parity with how Union/Intersect/Except do it, but it should be no-op.
|
Added a Jira ticket |
dongjoon-hyun
left a comment
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.
| SELECT n+1, stamp FROM t1 WHERE n < 5) | ||
| SELECT * FROM t1 | ||
| -- !query analysis | ||
| [Analyzer test output redacted due to nondeterminism] |
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.
Why is this non-deterministic? If it is really non-deterministic, can you add a deterministic test?
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.
same question
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 was nondeterministic because the original relation was Date. I changed into string now.
It's deterministic now.
peter-toth
left a comment
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.
LGTM. Maybe we could simplify the new test a bit, but that's just a nit.
|
thanks, merging to master! |
What changes were proposed in this pull request?
Change TypeCoercionBase so that the only outputs that are casted are the ones that need to be casted.
Why are the changes needed?
Remove redundant CAST.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing golden file test cte-recursion.
Was this patch authored or co-authored using generative AI tooling?
No.