Skip to content

Commit 2f96e97

Browse files
committed
fix regressions
1 parent 630e548 commit 2f96e97

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

docs/source/contributor-guide/jvm_shuffle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ JVM shuffle (`CometColumnarExchange`) is used instead of native shuffle (`CometE
4949
3. **Unsupported partitioning type**: Native shuffle only supports `HashPartitioning`, `RangePartitioning`,
5050
and `SinglePartition`. JVM shuffle additionally supports `RoundRobinPartitioning`.
5151

52-
4. **Unsupported partition key types**: For `HashPartitioning` and `RangePartitioning`, native shuffle
53-
only supports primitive types as partition keys. Complex types (struct, array, map) cannot be used
54-
as partition keys in native shuffle, though they are fully supported as data columns in both implementations.
52+
4. **Unsupported partition key types**: For `RangePartitioning`, native shuffle only supports primitive
53+
types as partition keys. Complex types (struct, array, map) are supported as hash partition keys in
54+
native shuffle.
5555

5656
## Input Handling
5757

docs/source/contributor-guide/native_shuffle.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ Native shuffle (`CometExchange`) is selected when all of the following condition
5555

5656
`RoundRobinPartitioning` requires JVM shuffle.
5757

58-
4. **Supported partition key types**: For `HashPartitioning` and `RangePartitioning`, partition
59-
keys must be primitive types. Complex types (struct, array, map) as partition keys require
60-
JVM shuffle. Note that complex types are fully supported as data columns in native shuffle.
58+
4. **Supported partition key types**: For `HashPartitioning`, both primitive and complex types
59+
(struct, array, map) are supported as partition keys. For `RangePartitioning`, only primitive
60+
types are supported as partition keys.
6161

6262
## Architecture
6363

docs/source/user-guide/latest/tuning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ back to Spark for shuffle operations.
141141
#### Native Shuffle
142142

143143
Comet provides a fully native shuffle implementation, which generally provides the best performance. Native shuffle
144-
supports `HashPartitioning`, `RangePartitioning` and `SinglePartitioning` but currently only supports primitive type
145-
partitioning keys. Columns that are not partitioning keys may contain complex types like maps, structs, and arrays.
144+
supports `HashPartitioning`, `RangePartitioning` and `SinglePartitioning`. Complex types (structs, arrays, and maps)
145+
are supported as hash partition keys. Range partitioning only supports primitive types as partition keys.
146146

147147
#### Columnar (JVM) Shuffle
148148

spark/src/test/scala/org/apache/comet/CometFuzzTestSuite.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class CometFuzzTestSuite extends CometFuzzTestBase {
179179
df.createOrReplaceTempView("t1")
180180
val columns = df.schema.fields.filter(f => isComplexType(f.dataType)).map(_.name)
181181
for (col <- columns) {
182-
// DISTRIBUTE BY is equivalent to df.repartition($col) and uses
182+
// DISTRIBUTE BY is equivalent to df.repartition($col)
183183
val sql = s"SELECT $col FROM t1 DISTRIBUTE BY $col"
184184
val df = spark.sql(sql)
185185
df.collect()
@@ -191,13 +191,7 @@ class CometFuzzTestSuite extends CometFuzzTestBase {
191191
// native_comet does not support reading complex types
192192
0
193193
case _ =>
194-
CometConf.COMET_SHUFFLE_MODE.get() match {
195-
case "jvm" =>
196-
1
197-
case "native" =>
198-
// native shuffle does not support complex types as partitioning keys
199-
0
200-
}
194+
1
201195
}
202196
assert(cometShuffleExchanges.length == expectedNumCometShuffles)
203197
}

spark/src/test/scala/org/apache/comet/CometHashExpressionSuite.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
package org.apache.comet
2121

22+
import org.scalactic.source.Position
23+
import org.scalatest.Tag
24+
2225
import org.apache.spark.sql.CometTestBase
2326
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
2427

@@ -30,6 +33,15 @@ import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
3033
*/
3134
class CometHashExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
3235

36+
override protected def test(testName: String, testTags: Tag*)(testFun: => Any)(implicit
37+
pos: Position): Unit = {
38+
super.test(testName, testTags: _*) {
39+
withSQLConf(CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_AUTO) {
40+
testFun
41+
}
42+
}
43+
}
44+
3345
test("hash - boolean") {
3446
withTable("t") {
3547
sql("CREATE TABLE t(c BOOLEAN) USING parquet")

0 commit comments

Comments
 (0)