[GitHub] spark pull request #19725: [DO NOT REVIEW][SPARK-22042] [SQL] Insert shuffle...

2017-12-20 Thread tejasapatil
Github user tejasapatil closed the pull request at:

https://github.com/apache/spark/pull/19725


---

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



[GitHub] spark pull request #19725: [DO NOT REVIEW][SPARK-22042] [SQL] Insert shuffle...

2017-11-17 Thread jaceklaskowski
Github user jaceklaskowski commented on a diff in the pull request:

https://github.com/apache/spark/pull/19725#discussion_r151741374
  
--- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/InjectPlaceholderExchange.scala
 ---
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.exchange
+
+import org.apache.spark.sql.catalyst.expressions.SortOrder
+import org.apache.spark.sql.catalyst.plans.physical._
+import org.apache.spark.sql.catalyst.rules.Rule
+import org.apache.spark.sql.execution.SparkPlan
+import org.apache.spark.sql.internal.SQLConf
+
+case class InjectPlaceholderExchange(conf: SQLConf) extends 
Rule[SparkPlan] {
+  private def defaultNumPreShufflePartitions: Int = 
conf.numShufflePartitions
+
+  /**
+   * Given a required distribution, returns a partitioning that satisfies 
that distribution.
+   * @param requiredDistribution The distribution that is required by the 
operator
+   * @param numPartitions Used when the distribution doesn't require a 
specific number of partitions
+   */
+  private def createPartitioning(requiredDistribution: Distribution,
+ numPartitions: Int): Partitioning = {
+requiredDistribution match {
+  case AllTuples => SinglePartition
+  case ClusteredDistribution(clustering, desiredPartitions) =>
+HashPartitioning(clustering, 
desiredPartitions.getOrElse(numPartitions))
+  case OrderedDistribution(ordering) => RangePartitioning(ordering, 
numPartitions)
+  case dist => sys.error(s"Do not know how to satisfy distribution 
$dist")
+}
+  }
+
+  def apply(plan: SparkPlan): SparkPlan = plan.transformUp {
+case operator @ ShuffleExchangeExec(partitioning, child, _) =>
+  child.children match {
+case ShuffleExchangeExec(childPartitioning, baseChild, _)::Nil =>
--- End diff --

No white spaces around `::` intended?


---

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



[GitHub] spark pull request #19725: [DO NOT REVIEW][SPARK-22042] [SQL] Insert shuffle...

2017-11-11 Thread tejasapatil
GitHub user tejasapatil opened a pull request:

https://github.com/apache/spark/pull/19725

[DO NOT REVIEW][SPARK-22042] [SQL] Insert shuffle nodes in entire tree 
before applying `ReorderJoinPredicates`

trying out suggestion in 
https://github.com/apache/spark/pull/19257#issuecomment-331069250

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tejasapatil/spark SPARK-22042_dummy_shuffle

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/19725.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #19725


commit e333c514bc2f7917cfee69ab6da6c96a673eb53f
Author: Tejas Patil 
Date:   2017-11-12T00:28:41Z

[SPARK-22042] [SQL] Insert shuffle nodes in entire tree before applying 
`ReorderJoinPredicates`




---

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