Skip to content

crate: return an error from Range::from_sparse instead of aborting - #697

Closed
krickert wants to merge 1 commit into
tafia:masterfrom
ai-pipestream:fix/from-sparse-bound
Closed

krickert wants to merge 1 commit into
tafia:masterfrom
ai-pipestream:fix/from-sparse-bound

Conversation

@krickert

@krickert krickert commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixed issue where a sheet with distant cells, like A1 and XFD1048576, aborted on allocation in Range::from_sparse().

from_sparse now returns Result<Range<T>, CellLimitExceeded> for ranges over MAX_CELLS (100,000,000), the same limit as the ODS reader. This changes a public signature.

Fixes #693

@jmcnamara

jmcnamara commented Jul 29, 2026 •

Copy link
Copy Markdown
Collaborator

This one also came up in the initial review for #684. I may fix it as part of that. If not I will come back to this.

Possibly this should be handled like issue #594 and fix #596.

Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
@jmcnamara jmcnamara self-assigned this Jul 29, 2026
@jmcnamara jmcnamara added the needs work for merge The PR needs some rework or clarification. No suitable for merge, yet. label Jul 29, 2026
@krickert krickert changed the title fix: reserve fallibly in Range::from_sparse instead of aborting the process crate: return an error from Range::from_sparse instead of aborting Aug 12, 2026
@krickert

krickert commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor Author

from_sparse now returns a Result as requested, let me know what you think.

krickert added a commit to ai-pipestream/calamine that referenced this pull request Aug 20, 2026
Brings pipestream-main from 0.36.0 + the original fix commits to
upstream/master at 0.36.1+ plus the post-review heads of the three open
upstream PRs:

  tafia#695  dimension normalisation (Dimensions::new)
  tafia#696  grid-limit errors from cell reference parsing
  tafia#697  Range::from_sparse returns Result<Range<T>, RangeError>

The tafia#697 head changes a public signature; the tree is byte-identical to
upstream/master with the three fix branches merged (verified by diff),
and the calamine test suite passes on that tree (46+164+65 tests).
@krickert
krickert force-pushed the fix/from-sparse-bound branch from ad7815a to 8536351 Compare October 15, 2026 06:31
@krickert
krickert force-pushed the fix/from-sparse-bound branch from 8536351 to 20c8280 Compare October 27, 2026 05:34
@krickert

Copy link
Copy Markdown
Contributor Author

Bump. Everything is caught up to master. Let me know if there are any next steps.

from_sparse now returns Result<Range, CellLimitExceeded> and rejects ranges over MAX_CELLS (100,000,000) before allocating, matching the ODS limit from #596. The xls, xlsb and xlsx readers return CellLimitExceeded { requested, max }. try_reserve is removed. CI needs workflow approval.

Fixed issue where a sheet with distant cells, like A1 and XFD1048576,
aborted on allocation in Range::from_sparse().

Fixes tafia#693
@krickert
krickert force-pushed the fix/from-sparse-bound branch from 3fbcd8c to d407184 Compare November 22, 2026 11:50
@krickert

Copy link
Copy Markdown
Contributor Author

Rebased on master. I changed from_sparse so it returns an error past the cell limit, as you suggested a bit ago. @jmcnamara ok to check again - apologies I didn't bump it sooner.

@jmcnamara

Copy link
Copy Markdown
Collaborator

@krickert Thanks. I merged this manually with a small fix for a test conflict and a change to make ods.rs also use the new MAX_CELLS.

@jmcnamara jmcnamara closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs work for merge The PR needs some rework or clarification. No suitable for merge, yet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Range::from_sparse densifies without bound: a 2 KB well-formed xlsx aborts the process

2 participants