Repository navigation
Fix whole-column and whole-row references to an empty sheet (HF-604) - #1908
Tobiadefami wants to merge 2 commits into
Conversation
A whole-column or whole-row reference to a sheet with no cells threw an exception in array functions, LEN and operators, or returned an error in TAKE, SORT, UNIQUE and similar functions, because its value was sized by the sheet's height of 0. AbsoluteColumnRange and AbsoluteRowRange now keep the value's size (at least 1) apart from the cells the range depends on (none on an empty sheet), so such a column or row reads as one blank cell, as on a sheet with one row or column, without creating a cell. The empty-source checks that can no longer fire are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Medium risk: The change touches core range-sizing semantics (effectiveHeight/effectiveWidth and range materialization via addressesArrayMap) on the main calculation path, but I verified the new limits coincide exactly with the old ones for every bounded range and for whole-column/row ranges on non-empty sheets, so the behavioural blast radius is confined to whole-column/row references on empty sheets plus the
Full review: no issues found.
Want a deeper review? Comment /review improve on its own line: a full review of the latest commit with an extra fix-oriented pass (about 2x the cost).
Performance comparison of head (70f5ec4) vs base (462cf9b) |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 70f5ec4 | Commit Preview URL Branch Preview URL |
Nov 23 2026, 01:53 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1908 +/- ##
===========================================
- Coverage 97.64% 97.63% -0.01%
===========================================
Files 212 212
Lines 18328 18322 -6
Branches 4258 4287 +29
===========================================
- Hits 17896 17889 -7
- Misses 424 433 +9
+ Partials 8 0 -8
🚀 New features to boost your workflow:
|
Context
A whole-column or whole-row reference to a sheet with no cells, such as
=VSTACK(Data!A:A), throws an exception in VSTACK, TRANSPOSE and other array functions, and in LEN and operators with array arithmetic on. TAKE, SORT, UNIQUE and similar functions return an error instead. The reference is sized by the sheet's height, which is 0, and an array can't be empty. #1346 made empty ranges safe for SUM and MATCH, but not for code that builds an array from them.Now such a column or row reads as one blank cell, as on a sheet with one row or column.
AbsoluteColumnRangeandAbsoluteRowRangekeep two things apart:effectiveHeight,effectiveWidth) is at least 1;effectiveEndRow,effectiveEndColumn) stop at the sheet's last row or column, so on an empty sheet there are none.No cell is created,
getSheetDimensions()still returns 0×0, and a value entered later is picked up. The empty-source checks in CHOOSECOLS, CHOOSEROWS, TAKE, EXPAND, WRAPROWS, WRAPCOLS and SORT can no longer fire, so I removed them and the docs lines about them.I rejected two alternatives:
getSheetDimensions(), INDEX, MEDIAN, COUNTIF and ISBLANK.How did you test your changes?
npx jestinhyperformula/with the paired branchfix/hf-604-empty-sheet-whole-column(handsontable/hyperformula-tests#127): 14,903 passed, 3 skipped.npm run lintandnpm run verify:typingspass.AI assistance
Claude Code wrote the change, docs and tests, compared the alternatives and ran the Excel checks.
Compatibility with Excel and Google Sheets
With the
Datasheet empty. Google Sheets not checked.=VSTACK(Data!A:A)0in 1,048,576 rows=TAKE(Data!A:A, 1)0#N/A=UNIQUE(Data!A:A)0#CALC!=SUM(CHOOSECOLS(Data!A:A, 1))0#N/A0=MMULT(TRANSPOSE(Data!A:A), Data!A:A)#VALUE!0#VALUE!=COUNTBLANK(Data!A:A)1048576#N/A1=COUNTIF(Data!A:A, "")104857601=AND(Data!A:A)#VALUE!#N/AFALSE=MEDIAN(Data!A:A)#NUM!#NUM!0=INDEX(Data!A:A, 2)00#REF!Every "now" value is what develop already returns on a sheet with one blank row.
Public API changes
None.
Out of scope and follow-ups
Types of changes
Related issues
Checklist
dev-docs/pages this change affects – or none needed it.🤖 Generated with Claude Code