Skip to content

Commit

Permalink
fix: Unsupported types for SinglePartition should fallback to Spark (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya authored Aug 2, 2024
1 parent 65f22a2 commit 39e030b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2931,8 +2931,8 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
msg = s"unsupported Spark partitioning expressions: $expressions"
}
supported
case SinglePartition => true
case RoundRobinPartitioning(_) => true
case SinglePartition => inputs.forall(attr => supportedDataType(attr.dataType))
case RoundRobinPartitioning(_) => inputs.forall(attr => supportedDataType(attr.dataType))
case RangePartitioning(orderings, _) =>
val supported =
orderings.map(QueryPlanSerde.exprToProto(_, inputs)).forall(_.isDefined) &&
Expand Down Expand Up @@ -2980,7 +2980,7 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
msg = s"unsupported Spark partitioning expressions: $expressions"
}
supported
case SinglePartition => true
case SinglePartition => inputs.forall(attr => supportedDataType(attr.dataType))
case _ =>
msg = s"unsupported Spark partitioning: ${partitioning.getClass.getName}"
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ abstract class CometColumnarShuffleSuite extends CometTestBase with AdaptiveSpar

setupTestData()

test("Unsupported types for SinglePartition should fallback to Spark") {
checkSparkAnswer(spark.sql("""
|SELECT
| AVG(null),
| COUNT(null),
| FIRST(null),
| LAST(null),
| MAX(null),
| MIN(null),
| SUM(null)
""".stripMargin))
}

test("Disable Comet shuffle with AQE coalesce partitions enabled") {
Seq(true, false).foreach { coalescePartitionsEnabled =>
withSQLConf(
Expand Down

0 comments on commit 39e030b

Please sign in to comment.