Visorgood commented on issue #6414:
URL:
https://github.com/apache/datafusion-comet/issues/6414#issuecomment-7065020160
**Reproduction**
I opened a draft PR, #7735, with a test that reproduces this:
`CometShuffleRowChecksumSuite`. It turns on
`spark.sql.shuffle.orderIndependentChecksum.enabled` (full retry off, so the
test can read what the driver records) and runs the same query through each
shuffle path. Results on Spark 4.2.0 (same on 4.1.3):
| Shuffle path | `MapStatus.checksumValue` | Recomputed map output with
changed rows |
|---|---|---|
| Spark | non-zero | mismatch recorded |
| Comet JVM columnar | `0, 0, 0, 0, 0` | no mismatch recorded |
| Comet native | `0, 0, 0, 0, 0` | not tested (needs a native
nondeterministic child) |
The second test drops the map outputs with `unregisterAllMapAndMergeOutput`
(what losing an executor does) and recomputes them, with a nondeterministic UDF
in the projection. Spark marks that map stage `DETERMINATE`, so the legacy
rollback doesn't cover it either: with Comet shuffle, the changed output goes
unnoticed.
**Cause**
- `CometShuffleDependency` calls the 7-argument `ShuffleDependency`
constructor, so `rowBasedChecksums` is empty and
`checksumMismatchFullRetryEnabled` is false.
- Comet's shuffle writers build `MapStatus` without a checksum, so the
driver always sees 0.
Because the flag is false, `DAGScheduler` keeps the legacy rollback for
statically indeterminate stages, so nothing regresses compared to Spark 4.0.
Comet shuffles just miss the new protection, which 4.2 turns on by default.
**Plan**
1. One PR for the JVM columnar path, no Rust changes:
- a per-Spark-version shim parent between `CometShuffleDependency` and
`ShuffleDependency` (3.5/4.0: today's 7 arguments; 4.1: checksums and the
full-retry flag; 4.2: also the query-level rollback flag);
- `prepareJVMShuffleDependency` creates `numPartitions` checksums when
either flag is on, as `ShuffleExchangeExec` does, using Spark's
`UnsafeRowChecksum` so the values match Spark's;
- `CometBypassMergeSortShuffleWriter` and `CometUnsafeShuffleWriter`
update the checksum for each row, and `MapStatusHelper` passes the aggregated
value;
- native shuffle dependencies keep no checksums and the full-retry flag
off, explicitly and with a guard test: setting the flag without a real checksum
would turn off the legacy rollback with nothing in its place;
- tests: the suite above, plus removing `IgnoreComet` from
`MapStatusEndToEndSuite` in the 4.1.3 and 4.2.0 diffs (it should run through
the JVM columnar path; I'll confirm).
2. A follow-up issue for native shuffle (Rust): hash rows in the native
writer, return per-map checksums with the partition lengths, then pass the
flags for native dependencies. Checksum-based retry could then also relax the
in-order replay requirement for positional round robin, as you mentioned.
If the shim parent class works for you, I'll push the implementation to
#7735. Or would you prefer another way to pass the new constructor arguments?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]