Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions dev/diffs/3.4.3.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/pom.xml b/pom.xml
index d3544881af1..aae0ae3b27b 100644
index d3544881af1..ff963395ec3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,6 +148,8 @@
Expand Down Expand Up @@ -260,19 +260,32 @@ index cf40e944c09..bdd5be4f462 100644

test("A cached table preserves the partitioning and ordering of its cached SparkPlan") {
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
index 1cc09c3d7fc..f031fa45c33 100644
index 1cc09c3d7fc..a84939c045b 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
@@ -27,7 +27,7 @@ import org.apache.spark.SparkException
@@ -26,8 +26,9 @@ import org.scalatest.matchers.must.Matchers.the
import org.apache.spark.SparkException
import org.apache.spark.sql.execution.WholeStageCodegenExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+import org.apache.spark.sql.comet.CometHashAggregateExec
import org.apache.spark.sql.execution.aggregate.{HashAggregateExec, ObjectHashAggregateExec, SortAggregateExec}
-import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
+import org.apache.spark.sql.execution.exchange.ShuffleExchangeLike
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
@@ -755,7 +755,7 @@ class DataFrameAggregateSuite extends QueryTest
@@ -691,7 +692,9 @@ class DataFrameAggregateSuite extends QueryTest
case _ => false
}.isDefined)
} else {
- assert(stripAQEPlan(hashAggPlan).isInstanceOf[HashAggregateExec])
+ val strippedPlan = stripAQEPlan(hashAggPlan)
+ assert(strippedPlan.isInstanceOf[HashAggregateExec] ||
+ strippedPlan.exists(_.isInstanceOf[CometHashAggregateExec]))
}

// test case for ObjectHashAggregate and SortAggregate
@@ -755,7 +758,7 @@ class DataFrameAggregateSuite extends QueryTest
assert(objHashAggPlans.nonEmpty)

val exchangePlans = collect(aggPlan) {
Expand Down Expand Up @@ -1532,7 +1545,7 @@ index ac710c32296..2854b433dd3 100644

import testImplicits._
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
index 593bd7bb4ba..32af28b0238 100644
index 593bd7bb4ba..b327d84d5cc 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -26,9 +26,11 @@ import org.scalatest.time.SpanSugar._
Expand Down Expand Up @@ -1923,6 +1936,16 @@ index 593bd7bb4ba..32af28b0238 100644
}
assert(shuffles2.size == 4)
val smj2 = findTopLevelSortMergeJoin(adaptive2)
@@ -2703,7 +2744,8 @@ class AdaptiveQueryExecSuite
}
}

-test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec") {
+test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec",
+ IgnoreComet("https://github.com/apache/datafusion-comet/issues/4412")) {
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/SchemaPruningSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/SchemaPruningSuite.scala
index bd9c79e5b96..2ada8c28842 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/SchemaPruningSuite.scala
Expand Down
35 changes: 29 additions & 6 deletions dev/diffs/3.5.8.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/pom.xml b/pom.xml
index edd2ad57880..a47b7dec672 100644
index edd2ad57880..45f8fd01538 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,6 +152,8 @@
Expand Down Expand Up @@ -241,19 +241,32 @@ index e5494726695..00937f025c2 100644

test("A cached table preserves the partitioning and ordering of its cached SparkPlan") {
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
index 6f3090d8908..c08a60fb0c2 100644
index 6f3090d8908..a0e9309888d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
@@ -28,7 +28,7 @@ import org.apache.spark.sql.catalyst.plans.logical.Expand
@@ -27,8 +27,9 @@ import org.apache.spark.{SparkException, SparkThrowable}
import org.apache.spark.sql.catalyst.plans.logical.Expand
import org.apache.spark.sql.execution.WholeStageCodegenExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+import org.apache.spark.sql.comet.CometHashAggregateExec
import org.apache.spark.sql.execution.aggregate.{HashAggregateExec, ObjectHashAggregateExec, SortAggregateExec}
-import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
+import org.apache.spark.sql.execution.exchange.ShuffleExchangeLike
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
@@ -793,7 +793,7 @@ class DataFrameAggregateSuite extends QueryTest
@@ -729,7 +730,9 @@ class DataFrameAggregateSuite extends QueryTest
case _ => false
}.isDefined)
} else {
- assert(stripAQEPlan(hashAggPlan).isInstanceOf[HashAggregateExec])
+ val strippedPlan = stripAQEPlan(hashAggPlan)
+ assert(strippedPlan.isInstanceOf[HashAggregateExec] ||
+ strippedPlan.exists(_.isInstanceOf[CometHashAggregateExec]))
}

// test case for ObjectHashAggregate and SortAggregate
@@ -793,7 +796,7 @@ class DataFrameAggregateSuite extends QueryTest
assert(objHashAggPlans.nonEmpty)

val exchangePlans = collect(aggPlan) {
Expand Down Expand Up @@ -1498,7 +1511,7 @@ index 5a413c77754..207b66e1d7b 100644

import testImplicits._
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
index 2f8e401e743..dbcf3171946 100644
index 2f8e401e743..7849c685b19 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -27,9 +27,11 @@ import org.scalatest.time.SpanSugar._
Expand Down Expand Up @@ -1904,7 +1917,17 @@ index 2f8e401e743..dbcf3171946 100644
}.size == (if (firstAccess) 2 else 0))
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
@@ -2980,7 +3023,9 @@ class AdaptiveQueryExecSuite
@@ -2938,7 +2981,8 @@ class AdaptiveQueryExecSuite
}
}

- test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec") {
+ test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec",
+ IgnoreComet("https://github.com/apache/datafusion-comet/issues/4412")) {
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
@@ -2980,7 +3024,9 @@ class AdaptiveQueryExecSuite

val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
Expand Down
35 changes: 29 additions & 6 deletions dev/diffs/4.0.2.diff
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ index 6c51bd4ff2e..e72ec1d26e2 100644
withSpark(sc) { sc =>
TestUtils.waitUntilExecutorsUp(sc, 2, 60000)
diff --git a/pom.xml b/pom.xml
index 252cfdf9073..60cb9dcb7cf 100644
index 252cfdf9073..50ec9d6314e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,6 +148,8 @@
Expand Down Expand Up @@ -378,19 +378,32 @@ index 0f42502f1d9..e9ff802141f 100644

withTempView("t0", "t1", "t2") {
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
index 9db406ff12f..245e4caa319 100644
index 9db406ff12f..19b4bb8e39d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
@@ -30,7 +30,7 @@ import org.apache.spark.sql.errors.DataTypeErrors.toSQLId
@@ -29,8 +29,9 @@ import org.apache.spark.sql.catalyst.util.AUTO_GENERATED_ALIAS
import org.apache.spark.sql.errors.DataTypeErrors.toSQLId
import org.apache.spark.sql.execution.WholeStageCodegenExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+import org.apache.spark.sql.comet.CometHashAggregateExec
import org.apache.spark.sql.execution.aggregate.{HashAggregateExec, ObjectHashAggregateExec, SortAggregateExec}
-import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
+import org.apache.spark.sql.execution.exchange.ShuffleExchangeLike
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
@@ -855,7 +855,7 @@ class DataFrameAggregateSuite extends QueryTest
@@ -791,7 +792,9 @@ class DataFrameAggregateSuite extends QueryTest
case _ => false
}.isDefined)
} else {
- assert(stripAQEPlan(hashAggPlan).isInstanceOf[HashAggregateExec])
+ val strippedPlan = stripAQEPlan(hashAggPlan)
+ assert(strippedPlan.isInstanceOf[HashAggregateExec] ||
+ strippedPlan.exists(_.isInstanceOf[CometHashAggregateExec]))
}

// test case for ObjectHashAggregate and SortAggregate
@@ -855,7 +858,7 @@ class DataFrameAggregateSuite extends QueryTest
assert(objHashAggPlans.nonEmpty)

val exchangePlans = collect(aggPlan) {
Expand Down Expand Up @@ -2122,7 +2135,7 @@ index a3cfdc5a240..3793b6191bf 100644
})
checkAnswer(distinctWithId, Seq(Row(1, 0), Row(1, 0)))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
index 272be70f9fe..12daa1f5932 100644
index 272be70f9fe..4a175083adf 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -28,12 +28,14 @@ import org.apache.spark.SparkException
Expand Down Expand Up @@ -2539,7 +2552,17 @@ index 272be70f9fe..12daa1f5932 100644
}.isEmpty)
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
@@ -3129,7 +3173,8 @@ class AdaptiveQueryExecSuite
@@ -3039,7 +3083,8 @@ class AdaptiveQueryExecSuite
}
}

- test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec") {
+ test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec",
+ IgnoreComet("https://github.com/apache/datafusion-comet/issues/4412")) {
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
@@ -3129,7 +3174,8 @@ class AdaptiveQueryExecSuite

val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
Expand Down
35 changes: 29 additions & 6 deletions dev/diffs/4.1.2.diff
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ index 6df8bc85b51..dabb75e2b75 100644
withSpark(sc) { sc =>
TestUtils.waitUntilExecutorsUp(sc, 2, 60000)
diff --git a/pom.xml b/pom.xml
index dc201151999..d5c08f11ded 100644
index dc201151999..20ee0e7482a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,6 +152,8 @@
Expand Down Expand Up @@ -392,19 +392,32 @@ index 0d807aeae4d..6d7744e771b 100644

withTempView("t0", "t1", "t2") {
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
index bfe15b33768..55c23a38ccc 100644
index bfe15b33768..31f8ba4b876 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala
@@ -31,7 +31,7 @@ import org.apache.spark.sql.errors.DataTypeErrors.toSQLId
@@ -30,8 +30,9 @@ import org.apache.spark.sql.catalyst.util.AUTO_GENERATED_ALIAS
import org.apache.spark.sql.errors.DataTypeErrors.toSQLId
import org.apache.spark.sql.execution.WholeStageCodegenExec
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+import org.apache.spark.sql.comet.CometHashAggregateExec
import org.apache.spark.sql.execution.aggregate.{HashAggregateExec, ObjectHashAggregateExec, SortAggregateExec}
-import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
+import org.apache.spark.sql.execution.exchange.ShuffleExchangeLike
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
@@ -856,7 +856,7 @@ class DataFrameAggregateSuite extends QueryTest
@@ -792,7 +793,9 @@ class DataFrameAggregateSuite extends QueryTest
case _ => false
}.isDefined)
} else {
- assert(stripAQEPlan(hashAggPlan).isInstanceOf[HashAggregateExec])
+ val strippedPlan = stripAQEPlan(hashAggPlan)
+ assert(strippedPlan.isInstanceOf[HashAggregateExec] ||
+ strippedPlan.exists(_.isInstanceOf[CometHashAggregateExec]))
}

// test case for ObjectHashAggregate and SortAggregate
@@ -856,7 +859,7 @@ class DataFrameAggregateSuite extends QueryTest
assert(objHashAggPlans.nonEmpty)

val exchangePlans = collect(aggPlan) {
Expand Down Expand Up @@ -2245,7 +2258,7 @@ index a3cfdc5a240..3793b6191bf 100644
})
checkAnswer(distinctWithId, Seq(Row(1, 0), Row(1, 0)))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
index 3e7d26f74bd..7e70e72fa3e 100644
index 3e7d26f74bd..79232dc3664 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -27,12 +27,14 @@ import org.apache.spark.SparkException
Expand Down Expand Up @@ -2662,7 +2675,17 @@ index 3e7d26f74bd..7e70e72fa3e 100644
}.isEmpty)
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
@@ -3310,7 +3354,8 @@ class AdaptiveQueryExecSuite
@@ -3220,7 +3264,8 @@ class AdaptiveQueryExecSuite
}
}

- test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec") {
+ test("SPARK-44040: Fix compute stats when AggregateExec nodes above QueryStageExec",
+ IgnoreComet("https://github.com/apache/datafusion-comet/issues/4412")) {
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
@@ -3310,7 +3355,8 @@ class AdaptiveQueryExecSuite

val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ trait CometAggregateExpressionSerde[T <: AggregateFunction] {
def getSupportLevel(expr: T): SupportLevel = Compatible(None)

/**
* Whether this aggregate's intermediate buffer format is compatible between Spark and Comet,
* making it safe to run the Partial in one engine and the Final in the other. Aggregates with
* simple single-value buffers (MIN, MAX, bitwise) are safe; those with complex or
* differently-encoded buffers (AVG, SUM with decimals, CollectSet, Variance) are not. COUNT is
* intentionally excluded: mixed COUNT partial/final regressed AQE's
* Whether this aggregate's intermediate buffer format is compatible between Spark and Comet for
* the given function instance, making it safe to run the Partial in one engine and the Final in
* the other. Aggregates with simple single-value buffers (MIN, MAX, bitwise) are always safe;
* SUM and non-decimal AVG match Spark's buffer and are safe except where noted per instance
* (e.g. TRY-mode SUM uses a Comet-internal flag column). COUNT is intentionally excluded
* despite a matching buffer: mixed COUNT partial/final regressed AQE's
* PropagateEmptyRelationAfterAQE pattern (which matches BaseAggregateExec only) and the Spark
* 4.0 count-bug decorrelation for correlated IN subqueries.
*/
def supportsMixedPartialFinal: Boolean = false
def supportsMixedPartialFinal(fn: T): Boolean = false

/**
* Convert a Spark expression into a protocol buffer representation that can be passed into
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ object QueryPlanSerde extends Logging with CometExprShim with CometTypeShim {
case Some(handler) =>
handler
.asInstanceOf[CometAggregateExpressionSerde[AggregateFunction]]
.supportsMixedPartialFinal
.supportsMixedPartialFinal(fn)
case None => false
}
}
Expand Down
Loading
Loading