This is an automated email from the ASF dual-hosted git repository.
maxgekk pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new ebc8df297364 [SPARK-51246][SQL] Make InTypeCoercion produce resolved
Casts
ebc8df297364 is described below
commit ebc8df2973640bdcd9b10784e8351b43f08838d1
Author: Vladimir Golubev <[email protected]>
AuthorDate: Tue Feb 18 21:59:42 2025 +0100
[SPARK-51246][SQL] Make InTypeCoercion produce resolved Casts
### What changes were proposed in this pull request?
Make `InTypeCoercion` produce resolved `Cast`s.
### Why are the changes needed?
This is important to avoid recursing down the tree in the single-pass
Analyzer.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #49991 from
vladimirg-db/vladimirg-db/make-in-coercion-produce-resolved-casts.
Authored-by: Vladimir Golubev <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
(cherry picked from commit 500bf78e77ca5cc8e414d3b8f40edb4ebfe2e10f)
Signed-off-by: Max Gekk <[email protected]>
---
.../org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala
index 3b3cf748014b..96053904e2fb 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala
@@ -273,11 +273,13 @@ abstract class TypeCoercionHelper {
// IN subquery expression.
if (commonTypes.length == lhs.length) {
val castedRhs = rhs.zip(commonTypes).map {
- case (e, dt) if e.dataType != dt => Alias(Cast(e, dt), e.name)()
+ case (e, dt) if e.dataType != dt =>
+ Alias(Cast(e, dt).withTimeZone(conf.sessionLocalTimeZone),
e.name)()
case (e, _) => e
}
val newLhs = lhs.zip(commonTypes).map {
- case (e, dt) if e.dataType != dt => Cast(e, dt)
+ case (e, dt) if e.dataType != dt =>
+ Cast(e, dt).withTimeZone(conf.sessionLocalTimeZone)
case (e, _) => e
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]