[VL] Spark 4.2: preserve per-split keyed partition slots for native SPJ (KeyGroupedPartitioning) scans
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- scala
- Domain
- backend, data-engineering, distributed-systems
Research direction
Start by reading shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala, especially filteredPartitions, alongside Spark 4.2's GroupPartitionsExec behavior. Review the gluten-ut/spark42 UT module and the deferred discussion on #13126. Done means preserving one slot per original split or falling back to vanilla Spark, with tests covering partition counts and results on an offloaded scan, timezone, and worker reuse.
Written by the indexing model from the issue text.
Description
Umbrella: GLUTEN-12569 (Spark 4.2 support)
Background
Spark 4.2 restructured Storage-Partitioned Join (SPJ) partitioning. Verified against the Spark jars:
GroupPartitionsExecis new in Spark 4.2.0 (absent in 4.1.1). In 4.2 the scan (BatchScanExec) emits ungrouped partitions — one per split, duplicate keys retained — and grouping is deferred toGroupPartitionsExec. In 4.1 the scan produced the key-grouped layout itself.
Problem
The Spark 4.2 shim (shims/spark42/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExecShim.scala, filteredPartitions) still rebuilds the old 4.1 layout via groupBy(InternalRowComparableWrapper(key)), collapsing duplicate-key splits. For keys [A, A, B] it advertises 3 partitions but builds only 2 native RDD partitions; Spark 4.2's GroupPartitionsExec then derives parent indices assuming the ungrouped count → index mismatch / wrong per-key multiplicity.
Scope / why deferred
Only reachable via scans reporting KeyGroupedPartitioning (DSv2 SupportsReportPartitioning). Verified FileScan (Parquet/ORC/CSV) does not implement it, and Delta does not use DSv2 SPJ. The only native consumer is the Iceberg transformer, which is not enabled on Spark 4.2 (dependency unavailable). It is therefore currently dormant / non-triggerable and cannot be behaviorally tested yet.
Required work (when enabling native keyed DSv2 / Iceberg on Spark 4.2)
- Preserve one slot per original sorted split (pad filtered-out splits) and let
GroupPartitionsExecperform grouping — target layout:
or explicitly fall native keyed scans back to vanilla Spark until (1) is implemented.original [A1,A2,B1] -> [[A1],[A2],[B1]] filter removes A2 -> [[A1],[],[B1]] filter removes A1 and A2 -> [[],[],[B1]] - Add SPJ tests over an actually offloaded scan with partition-count and result assertions (including a nondefault timezone and worker reuse) — belongs with the
gluten-ut/spark42UT module.
Reference
Deferred from review discussion on #13126.
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 679
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 84
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/gluten
-
[CORE] Selecting a cost model the backend has no coster for fails with ClassNotFoundExceptionPossibly taken @LuciferYang claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
bug unit testing velox backend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/gluten#13463 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 3 days
-
[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching lengthMay be free again A pull request for this issue was closed without being merged. Openbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rchillyard/TableParser#206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
? - Needs Triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
NVIDIA/cudf-spark#17063 ·
Maintainers usually reply within 2 days
-
bug 🐞 User issue 🚨
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
valkey-io/valkey-glide#7813 · 2 comments ·
Maintainers usually reply within 1 day