Skip to content

Commit 91ef592

Browse files
authored
fix: Mark WindowsExec as incompatible (#2748)
1 parent e77998a commit 91ef592

File tree

148 files changed

+308
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+308
-306
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ this can be overridden by setting `spark.comet.regexp.allowIncompatible=true`.
7070

7171
## Window Functions
7272

73-
Comet's support for window functions is incomplete and known to be incorrect. It is disabled by default and
73+
Comet's support for window functions is incomplete and known to be incorrect. It is disabled by default and
7474
should not be used in production. The feature will be enabled in a future release. Tracking issue: [#2721](https://github.com/apache/datafusion-comet/issues/2721).
7575

7676
## Cast

spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ object QueryPlanSerde extends Logging with CometExprShim {
7171
classOf[ShuffledHashJoinExec] -> CometShuffleHashJoin,
7272
classOf[SortMergeJoinExec] -> CometSortMergeJoin,
7373
classOf[SortExec] -> CometSort,
74-
classOf[LocalTableScanExec] -> CometLocalTableScan)
74+
classOf[LocalTableScanExec] -> CometLocalTableScan,
75+
classOf[WindowExec] -> CometWindow)
7576

7677
private val arrayExpressions: Map[Class[_ <: Expression], CometExpressionSerde[_]] = Map(
7778
classOf[ArrayAppend] -> CometArrayAppend,
@@ -929,7 +930,6 @@ object QueryPlanSerde extends Logging with CometExprShim {
929930
* converted to a native operator.
930931
*/
931932
def operator2Proto(op: SparkPlan, childOp: Operator*): Option[Operator] = {
932-
val conf = op.conf
933933
val builder = OperatorOuterClass.Operator.newBuilder().setPlanId(op.id)
934934
childOp.foreach(builder.addChildren)
935935

@@ -953,10 +953,6 @@ object QueryPlanSerde extends Logging with CometExprShim {
953953
case scan: CometScanExec if scan.scanImpl == CometConf.SCAN_NATIVE_DATAFUSION =>
954954
CometNativeScan.convert(scan, builder, childOp: _*)
955955

956-
case _: WindowExec if CometConf.COMET_EXEC_WINDOW_ENABLED.get(conf) =>
957-
withInfo(op, "Window expressions are not supported")
958-
None
959-
960956
case op if isCometSink(op) =>
961957
val supportedTypes =
962958
op.output.forall(a => supportedDataType(a.dataType, allowComplex = true))
@@ -1084,7 +1080,6 @@ object QueryPlanSerde extends Logging with CometExprShim {
10841080
case _: CollectLimitExec => true
10851081
case _: UnionExec => true
10861082
case _: TakeOrderedAndProjectExec => true
1087-
case _: WindowExec => true
10881083
case _ => false
10891084
}
10901085
}

spark/src/main/scala/org/apache/comet/serde/operator/CometWindow.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.apache.spark.sql.execution.window.WindowExec
2727

2828
import org.apache.comet.{CometConf, ConfigEntry}
2929
import org.apache.comet.CometSparkSessionExtensions.withInfo
30-
import org.apache.comet.serde.{CometOperatorSerde, OperatorOuterClass}
30+
import org.apache.comet.serde.{CometOperatorSerde, Incompatible, OperatorOuterClass, SupportLevel}
3131
import org.apache.comet.serde.OperatorOuterClass.Operator
3232
import org.apache.comet.serde.QueryPlanSerde.{exprToProto, windowExprToProto}
3333

@@ -36,6 +36,10 @@ object CometWindow extends CometOperatorSerde[WindowExec] {
3636
override def enabledConfig: Option[ConfigEntry[Boolean]] = Some(
3737
CometConf.COMET_EXEC_WINDOW_ENABLED)
3838

39+
override def getSupportLevel(op: WindowExec): SupportLevel = {
40+
Incompatible(Some("Native WindowExec has known correctness issues"))
41+
}
42+
3943
override def convert(
4044
op: WindowExec,
4145
builder: Operator.Builder,

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q12.native_iceberg_compat/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q12/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q20.native_iceberg_compat/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q20/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q36.native_iceberg_compat/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q36/extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TakeOrderedAndProject [COMET: ]
22
+- Project
3-
+- Window [COMET: Window expressions are not supported]
3+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
44
+- CometColumnarToRow
55
+- CometSort
66
+- CometExchange

spark/src/test/resources/tpcds-plan-stability/approved-plans-v1_4-spark3_5/q47.native_iceberg_compat/extended.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
: : +- Filter
88
: : +- Window
99
: : +- Filter
10-
: : +- Window [COMET: Window expressions are not supported]
10+
: : +- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
1111
: : +- CometColumnarToRow
1212
: : +- CometSort
1313
: : +- CometExchange
@@ -39,7 +39,7 @@
3939
: : +- CometScan [native_iceberg_compat] parquet spark_catalog.default.store
4040
: +- BroadcastExchange
4141
: +- Project
42-
: +- Window [COMET: Window expressions are not supported]
42+
: +- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
4343
: +- CometColumnarToRow
4444
: +- CometSort
4545
: +- CometExchange
@@ -71,7 +71,7 @@
7171
: +- CometScan [native_iceberg_compat] parquet spark_catalog.default.store
7272
+- BroadcastExchange
7373
+- Project
74-
+- Window [COMET: Window expressions are not supported]
74+
+- Window [COMET: WindowExec is not fully compatible with Spark (Native WindowExec has known correctness issues). To enable it anyway, set spark.comet.operator.WindowExec.allowIncompatible=true. For more information, refer to the Comet Compatibility Guide (https://datafusion.apache.org/comet/user-guide/compatibility.html).]
7575
+- CometColumnarToRow
7676
+- CometSort
7777
+- CometExchange

0 commit comments

Comments
 (0)