ulysses-you commented on code in PR #37290:
URL: https://github.com/apache/spark/pull/37290#discussion_r932905836
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/V1WriteCommandSuite.scala:
##########
@@ -214,4 +216,34 @@ class V1WriteCommandSuite extends V1WriteCommandSuiteBase
with SharedSparkSessio
}
}
}
+
+ test("SPARK-37194: Avoid unnecessary sort in v1 write if it's not dynamic
partition") {
+ withPlannedWrite { enabled =>
+ withTable("t") {
+ sql(
+ """
+ |CREATE TABLE t(key INT, value STRING) USING PARQUET
+ |PARTITIONED BY (p1 INT, p2 STRING)
+ |""".stripMargin)
+
+ // partition columns are static
+ executeAndCheckOrdering(hasLogicalSort = false, orderingMatched =
true) {
+ sql(
+ """
+ |INSERT INTO t PARTITION(p1=1, p2='a')
+ |SELECT key, value FROM testData
+ |""".stripMargin)
+ }
+
+ // one static partition column and one dynamic partition column
+ executeAndCheckOrdering(hasLogicalSort = enabled, orderingMatched =
enabled) {
+ sql(
+ """
+ |INSERT INTO t PARTITION(p1=1, p2)
+ |SELECT key, value, value FROM testData
+ |""".stripMargin)
+ }
+ }
+ }
Review Comment:
the previous contains similar test, but I'd like 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]