You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "Kwafoor (via GitHub)" <gi...@apache.org> on 2023/03/29 13:13:24 UTC

[GitHub] [spark] Kwafoor commented on a diff in pull request #40294: [SPARK-40610][SQL] Support unwrap date type to string type

Kwafoor commented on code in PR #40294:
URL: https://github.com/apache/spark/pull/40294#discussion_r1151924388


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/UnwrapCastInBinaryComparison.scala:
##########
@@ -133,6 +133,11 @@ object UnwrapCastInBinaryComparison extends Rule[LogicalPlan] {
         if canImplicitlyCast(fromExp, toType, literalType) =>
       simplifyNumericComparison(be, fromExp, toType, value)
 
+    case be @ BinaryComparison(
+      Cast(fromExp, _, timeZoneId, evalMode), date @ Literal(value, DateType))
+        if fromExp.dataType == StringType && value != null =>
+      be.withNewChildren(Seq(fromExp, Cast(date, StringType, timeZoneId, evalMode)))

Review Comment:
    `UnwrapCastInBinaryComparison` class is only responsible for processing casts related to numeric types, and it is dangerous to cast date types. Can we add the related conversion of partition columns to the `PruneHiveTablePartitions` rule?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org