Github user marmbrus commented on a diff in the pull request: https://github.com/apache/spark/pull/5208#discussion_r28286620 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/Exchange.scala --- @@ -69,7 +72,16 @@ case class Exchange(newPartitioning: Partitioning, child: SparkPlan) extends Una } } val part = new HashPartitioner(numPartitions) - val shuffled = new ShuffledRDD[Row, Row, Row](rdd, part) + val shuffled = sort match { + case false => new ShuffledRDD[Row, Row, Row](rdd, part) + case true => + val sortingExpressions = expressions.zipWithIndex.map { + case (exp, index) => + new SortOrder(BoundReference(index, exp.dataType, exp.nullable), Ascending) --- End diff -- This is not correct. You don't want to construct your own `BoundReference`s otherwise the expression `a,b,c` will sort the same a `c,b,a`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org