cloud-fan commented on a change in pull request #35574:
URL: https://github.com/apache/spark/pull/35574#discussion_r813492318
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
##########
@@ -1453,6 +1455,57 @@ class DataFrameAggregateSuite extends QueryTest
val df = Seq(1).toDF("id").groupBy(Stream($"id" + 1, $"id" + 2):
_*).sum("id")
checkAnswer(df, Row(2, 3, 1))
}
+
+ test("SPARK-38237: require all cluster keys for child required
distribution") {
+ def partitionExpressionsColumns(expressions: Seq[Expression]): Seq[String]
= {
+ expressions.flatMap {
+ case ref: AttributeReference => Some(ref.name)
+ }
+ }
+
+ def isShuffleExecByRequirement(
+ plan: ShuffleExchangeExec,
+ desiredClusterColumns: Seq[String],
+ desiredNumPartitions: Int): Boolean = plan match {
+ case ShuffleExchangeExec(op: HashPartitioning, _, ENSURE_REQUIREMENTS)
+ if partitionExpressionsColumns(op.expressions) ===
desiredClusterColumns &&
+ op.numPartitions === desiredNumPartitions => true
+
+ case _ => false
+ }
+
+ val df = Seq(("a", 1, 1), ("a", 2, 2), ("b", 1, 3), ("b", 1,
4)).toDF("key1", "key2", "value")
+
+ withSQLConf(
+ SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "false",
+ SQLConf.REQUIRE_ALL_CLUSTER_KEYS_FOR_DISTRIBUTION.key -> "false") {
Review comment:
hmm, shall we test when this conf is true?
--
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]