You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/01 01:39:07 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #24973: [SPARK-28169] Fix Partition table partition PushDown failed by "OR" expression

AngersZhuuuu commented on a change in pull request #24973: [SPARK-28169] Fix Partition table partition  PushDown failed by "OR" expression 
URL: https://github.com/apache/spark/pull/24973#discussion_r298860931
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
 ##########
 @@ -310,3 +310,97 @@ object PhysicalWindow {
     case _ => None
   }
 }
+
+/**
+ * Extract partition push down condition from ExpressionSet
+ * Since origin judge condition is
+ *    {
+ *       !expression.references.isEmpty &&
+ *             expression.references.subsetOf(partitionKeyIds)
+ *    }
+ *
+ *  This can only push down simple condition expression.
+ *  Such as table:
+ *   CREATE TABLE DEFAULT.PARTITION_TABLE(
+ *   A STRING,
+ *   B STRING)
+ *   PARTITIONED BY(DT STRING)
+ *
+ * With SQL:
+ *   SELECT A, B
+ *   FROM DEFAULT.PARTITION_TABLE
+ *   WHERE DT = 20190601 OR (DT = 20190602 AND C = "TEST")
+ *
+ * Where condition "DT = 20190601 OR (DT = 20190602 AND C = "TEST")"
 
 Review comment:
   @cloud-fan  
   In this place it will return (DT = 20190601 OR DT = 20190602). 
   But this whole condition will still return to filter.
   What I want to do is purely to avoid  read unnecessary partitions. When this case we only read partition(dt=20190601 + dt=20190602), If we don't push down this, we will read all data.
   
   In  condition " **(DT = 20190602 AND C = "TEST")** ", **DT = 20190602**  is **C = "TEST"**'s precondition. 
   
   If the whole condition is **DT = 20190601 OR (DT = 20190602 OR C = "TEST")**. We should return null, since **DT = 20190602**  is not  **C = "TEST"**'s  constraint. 

----------------------------------------------------------------
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