Repository navigation
fix: preserve sparse map row values during export - #1299
qiaolezi001 wants to merge 2 commits into
Conversation
|
I independently verified this fix. Reproduction of #1296 on my local pre-fix I also ran a full reactor build on the PR branch ( Environment: Windows, Microsoft OpenJDK 21.0.10, Maven 3.6.3. Happy to help verify anything else if useful. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the sparse-map export fix.
No open issues 🎉
What changed in this PR
Fixes #1296 by preserving values after gaps in integer-keyed map rows during spreadsheet export, while retaining existing collection-row and indexed-head behavior.
Changes:
- Capture each map row’s indexed extent once, including gaps, and reject spans that would overflow.
- Add boundary and round-trip regression tests across XLS, XLSX and CSV, including headers, memory modes and row callbacks.
- Clarify the row-size contract and document sparse-map usage in English and Chinese.
| File | Description |
|---|---|
website/i18n/zh-cn/docusaurus-plugin-content-docs/current/sheet/write/pojo.md |
Adds Chinese sparse-map guidance and an example. |
website/docs/sheet/write/pojo.md |
Adds English sparse-map guidance and an example. |
fesod-sheet/src/test/java/org/apache/fesod/sheet/write/metadata/MapRowDataTest.java |
Tests sparse extents, null values and integer boundaries. |
fesod-sheet/src/test/java/org/apache/fesod/sheet/core/SparseMapDataTest.java |
Adds cross-format export regressions and compatibility checks. |
fesod-sheet/src/main/java/org/apache/fesod/sheet/write/metadata/RowData.java |
Documents size as the exclusive upper bound of data indexes. |
fesod-sheet/src/main/java/org/apache/fesod/sheet/write/metadata/MapRowData.java |
Caches the indexed row extent and guards against overflow. |
Review effort: Balanced
Purpose of the pull request
Fixes #1296.
A sparse row such as
{0: "FIRST", 2: "THIRD"}silently loses its third-column value becauseMapRowData.size()reports entry count while the writer consumes numeric data positions. Preserve the complete logical row span without requiring explicit null entries for gaps.What's changed?
RowData.size()contract and add English/Chinese sparse-map examples.The row extent is captured when the map is wrapped; adding/removing input columns from a later per-cell callback does not recalculate it. This matches collection rows' fixed extent and avoids rescanning all keys for every head entry.
Validation
JDK 25, project Java 8 source/target:
./mvnw clean package -pl fesod-common,fesod-shaded,fesod-sheet: 1,875 tests, zero failures/errors/skips, no test groups excluded; normal fuzz seed regressions included.spotless:check, Checkstyle, Hawkeye 7.0.0, cached/offline Apache RAT 0.15 andgit diff --checkpass.No local five-JDK matrix, website build or timed fuzzing campaign is claimed; the project CI covers the JDK matrix. RAT's initial online dependency lookup failed on DNS and the same goal was then run successfully across all six reactor projects using the existing local cache.
Checklist
Generated-by: AI