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/02/11 08:30:42 UTC

[GitHub] mgaido91 commented on a change in pull request #22957: [SPARK-25951][SQL] Ignore aliases for distributions and orderings

mgaido91 commented on a change in pull request #22957: [SPARK-25951][SQL] Ignore aliases for distributions and orderings
URL: https://github.com/apache/spark/pull/22957#discussion_r255408898
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/physical/partitioning.scala
 ##########
 @@ -284,6 +298,19 @@ case class RangePartitioning(ordering: Seq[SortOrder], numPartitions: Int)
       }
     }
   }
+
+  override private[spark] def pruneInvalidAttribute(invalidAttr: Attribute): Partitioning = {
+    if (this.references.contains(invalidAttr)) {
+      val validExprs = this.children.takeWhile(!_.references.contains(invalidAttr))
+      if (validExprs.isEmpty) {
+        UnknownPartitioning(numPartitions)
+      } else {
+        RangePartitioning(validExprs, numPartitions)
 
 Review comment:
   Why doesn't it satisfy `ClusteredDistribution('a1)`? I don't agree with what you stated. If `b` is not in the output, it is useless to have it there. Moreover, when ordering we order always for the first attribute, then for the second, ... So if something is partitioned by `RangePartitioning('a1.ASC, 'b.ASC)`, it is also true that its partitioning is `RangePartitioning('a1.ASC, )`. So I think that in that case `RangePartitioning('a1.ASC)` is the right one.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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