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 2022/11/14 05:51:45 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #38356: [SPARK-40885] `Sort` may not take effect when it is the last 'Transform' operator

cloud-fan commented on code in PR #38356:
URL: https://github.com/apache/spark/pull/38356#discussion_r1021098036


##########
sql/core/src/test/scala/org/apache/spark/sql/sources/PartitionedWriteSuite.scala:
##########
@@ -220,6 +220,23 @@ class PartitionedWriteSuite extends QueryTest with SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-40885: V1 write uses the sort with partitionBy operator") {
+    withTempPath { f =>
+      Seq((20, 30, "partition"), (15, 20, "partition"),
+        (30, 70, "partition"), (18, 40, "partition"))
+        .toDF("id", "sort_col", "p")
+        .repartition(1)
+        .sortWithinPartitions("p", "sort_col")
+        .write
+        .partitionBy("p")

Review Comment:
   I'm not very sure what the problem is. `partitionBy("p")` requires sorting the data by `p` per partition. It should already be satisfied and we don't need to add it.



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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