You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently CometLocalTableScanExec is disabled by default. A lot of Spark SQL tests (UDFs, expressions) don't write their input to sources that Comet reads natively (e.g., Parquet, Iceberg) so they are likely not being exercised through Comet.
What changes are included in this PR?
Enable localTableScan translation to Comet by default.
B1 — NullType rejected by Utils.toArrowType (~600 failures, ~75–85% of Spark SQL)
Stack identical across occurrences:
java.lang.UnsupportedOperationException: Unsupported data type: NullType
at org.apache.spark.sql.comet.util.Utils$.toArrowType(Utils.scala:155)
at CometArrowConverters$ArrowBatchIterBase.<init>(54)
at CometLocalTableScanExec.doExecuteColumnar(78)
Triggers any time Seq(...).toDF / values (..., null) yields a void column, including nested MapType(_, NullType) (e.g. DatasetPrimitiveSuite "special floating point values").
Fix options:
(a) Reject schemas containing NullType (including nested) in the rule that builds CometLocalTableScanExec, so plan falls back. Smallest blast radius.
SparkException: not support type: TimeType(6)
at ArrowWriter$.createFieldWriter(ArrowWriters.scala:89)
Hits Spark 4.1 TIME-type tests (SPARK-51402, SPARK-52883, SPARK-53929, SPARK-53109, SPARK-53107, SPARK-53108, SPARK-52626, SPARK-52660, etc.). Same fix shape as B1; fallback is the immediate move since the rest of Comet does not yet support TIME.
B3 — Nested-type nullability mismatch (~20 Spark SQL + likely root cause of all 220 Iceberg failures)
DataFusion error shape:
Incorrect datatype for StructArray field "nested",
expected Struct("a": Int32, "b": Int64),
got Struct("a": non-null Int32, "b": non-null Int64)
CometArrowConverters derives child nullability from the Spark schema; downstream native operators were planned against schemas with different child-nullability inference. One side has to normalize.
Iceberg connection:
Every failing Iceberg test seeds rows via spark.createDataFrame(input, Employee.class) (TestDelete.java:1526) — a LocalRelation that now becomes CometLocalTableScanExec.
Failures concentrate on the conjunction branch=test, distributionMode=none, fanout=false, vectorized=true (other parameterizations of the same test methods pass).
Symptoms are silent: assertion failures like expected:<199> but was:<200>, [Snapshot property added-data-files has unexpected value], View should have correct data: expected:<2> but was:<0>. No exception, no Comet stack frame.
CometLocalTableScanExec.isFfiSafe = false (line 110) due to array reuse in CometArrowConverters. Safe for Comet-native consumers (the native side copies based on the proto flag). Unsafe for non-Comet consumers that buffer batches across next() calls. The Iceberg branch-write path likely buffers, which combined with B3-style nullability mismatches could produce the silent loss.
Investigate first:
Run TestCopyOnWriteDelete.testSkewDelete with the failing parameterization locally; dump physical plan and per-batch row counts.
Determine whether Iceberg's DSv2 columnar branch write honors isFfiSafe=false, or whether the gap is purely nullability.
B4 — Stale CometWindowExecSuite assertion (8 failures: Comet's own suites, all platforms)
Test: window function: partition and order expressions, all 5 Spark versions on Linux + 3 on macOS. Inverted assertion:
// CometWindowExecSuite.scala:111-119
} else {
// we fall back to Spark for shuffle because we do not support// native shuffle with a LocalTableScan input, and we do not fall// back to Comet columnar shuffle due to// https://github.com/apache/datafusion-comet/issues/1248
assert(cometShuffles.isEmpty)
}
The premise is no longer true; native shuffle now composes with the new local scan.
Action: update the assertion to cometShuffles.length == 1, drop the comment, re-evaluate whether #1248 is still relevant. Grep for siblings: "LocalTableScan input", "issues/1248", "fall back to Spark for shuffle".
Not Comet defects. Either extend the upstream-test skip list or add per-test config disable for localTableScan.
B6 — Subquery not found when plan root is CometLocalTableScan (~8 failures)
CometRuntimeException: Subquery NNN not found for plan MMM
Hits CTEHintSuite "subquery in repartition", SPARK-36447, CTE Predicate push-down and column pruning. Real Comet bug — subquery registration path doesn't handle the new root operator.
B7 — Long tail (~20 failures total)
ULP-level float math diffs in MathFunctionsSuite (asinh, acosh, cosh, tan, cot, cbrt, pow, atan2, etc.). Known JVM-libm vs Rust-libm gap; no Comet carve-out for upstream suite.
bit_length / octet_length on BinaryType rejected by DataFusion's string-only UDF (SPARK-36751).
null IN () returns false in Comet, should be null (EmptyInSuite).
After (1)–(2), failure count should drop from ~1,200 to ~250 and most remaining failures will be the substantive ones.
Open questions
B3: does Iceberg's columnar DSv2 branch-write path honor setArrowFfiSafe(false), or does the contract only apply to native consumers? If only native, CometLocalTableScanExec needs to copy batches before exposing them to non-Comet consumers (or be disallowed as a direct columnar input to non-Comet writers).
B5: skip list vs per-test disable — preference? A skip list is easier to maintain; per-test config keeps Comet exercised.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #4347.
Rationale for this change
Currently
CometLocalTableScanExecis disabled by default. A lot of Spark SQL tests (UDFs, expressions) don't write their input to sources that Comet reads natively (e.g., Parquet, Iceberg) so they are likely not being exercised through Comet.What changes are included in this PR?
Enable
localTableScantranslation to Comet by default.How are these changes tested?
Existing tests.