spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] wangyum commented on a change in pull request #27252: [SPARK-29231][SQL] Constraints should be inferred from cast equality constraint
Date Tue, 21 Jan 2020 02:41:42 GMT
wangyum commented on a change in pull request #27252: [SPARK-29231][SQL] Constraints should
be inferred from cast equality constraint
URL: https://github.com/apache/spark/pull/27252#discussion_r368788944
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala
 ##########
 @@ -75,8 +86,10 @@ trait ConstraintHelper {
   private def replaceConstraints(
       constraints: Set[Expression],
       source: Expression,
-      destination: Attribute): Set[Expression] = constraints.map(_ transform {
+      destination: Expression): Set[Expression] = constraints.map(_ transform {
     case e: Expression if e.semanticEquals(source) => destination
+  }).map(_ transform {
+    case Cast(e @ Cast(child, _, _), dt, _) if e == destination && dt == child.dataType
=> child
 
 Review comment:
   To revert these changes `(cast(cast(int_column#2 as bigint) as int) = 2)` to `(int_column#2
= 2)`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


Mime
View raw message