feat(functions): implement VSTACK and HSTACK (HF-71)#1698
Open
marcin-kordas-hoc wants to merge 3 commits into
Open
feat(functions): implement VSTACK and HSTACK (HF-71)#1698marcin-kordas-hoc wants to merge 3 commits into
marcin-kordas-hoc wants to merge 3 commits into
Conversation
Add the VSTACK and HSTACK array-manipulation functions to ArrayPlugin, mirroring the existing FILTER implementation pattern. - VSTACK stacks input arrays vertically: result height = sum of input heights, width = max input width. Narrower rows are padded on the right with #N/A. - HSTACK stacks input arrays horizontally: result width = sum of input widths, height = max input height. Shorter columns are padded at the bottom with #N/A. - Both are variadic (repeatLastArgs: 1) and accept ranges, array literals and scalars (FunctionArgumentType.RANGE, enableArrayArithmeticForArguments). - Result dimensions are declared at parse time via the sizeOfResultArrayMethod (vstackArraySize / hstackArraySize) so the result spills correctly, consistent with HyperFormula's parse-time array sizing. Padding uses ErrorType.NA (HyperFormula has no #CALC!). - Add translations for all 17 built-in language packs (English name in every locale, matching Excel/Sheets, which do not localize these functions). enUS inherits enGB. - Document both functions in the built-in functions guide and add a changelog entry. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
Task linked: HF-71 Implement VSTACK and HSTACK functions |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4abdae5. Configure here.
Performance comparison of head (a61573b) vs base (72205bd) |
…(HF-71) HSTACK indexed sourceRow[col] directly, trusting every row to be as wide as the range. A jagged SimpleRangeValue (a row shorter than range.width(), reachable via a custom function) produced an empty cell where VSTACK produces #N/A. Reuse padRowToWidth so both functions pad identically. Reported by Cursor Bugbot on PR #1698. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1698 +/- ##
========================================
Coverage 97.16% 97.16%
========================================
Files 176 176
Lines 15322 15364 +42
Branches 3387 3392 +5
========================================
+ Hits 14887 14929 +42
Misses 435 435
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Implements two new array-spilling functions,
VSTACKandHSTACK, inArrayPlugin.#N/A.#N/A.Behaviour matches Excel 365 / Google Sheets, with the documented HyperFormula nuances below.
Scope
src/interpreter/plugin/ArrayPlugin.ts—VSTACK/HSTACKmetadata, methods, and*ArraySizeparse-time size calculations (sharedstackSubChecks+padRowToWidthhelpers).src/i18n/languages/*.ts— function-name entries for all 18 language packs (enUSinherits fromenGB). The names are identical across locales, matching Excel's convention for these functions.docs/guide/built-in-functions.md— entries for both functions.CHANGELOG.md—Addedentry under[Unreleased].HyperFormula nuances vs. Excel
null) rather than coercing to0. HyperFormula preserves the empty value; Excel (which has no empty-result cell) displays0. The stacked structure is identical.runFunction-based function behaves (e.g.ABS,FILTER). Errors located inside an input range pass through per cell, preserving their type (matches Excel).Test coverage
Unit tests live in the private tests repository: handsontable/hyperformula-tests#18 (54 cases: 27 VSTACK + 27 HSTACK), mirroring a validated Excel 365 oracle. They cover same-width/height stacks, dimension mismatch with
#N/Apadding, scalars, single-arg passthrough, mixed types, error passthrough, empty cells, nestedVSTACK/HSTACK, and integration withSEQUENCE/TRANSPOSE.🤖 Generated with Claude Code
Note
Low Risk
Additive feature in the array plugin with localized names and docs only; no changes to auth, persistence, or core calculation infrastructure.
Overview
Adds VSTACK and HSTACK as new array-manipulation functions in
ArrayPlugin, aligned with Excel 365 / Google Sheets behavior.VSTACK concatenates ranges vertically (total height = sum of heights, width = max width); narrower inputs get #N/A padding on the right. HSTACK concatenates horizontally (total width = sum of widths, height = max height); shorter inputs get #N/A padding at the bottom. Both accept one or more range arguments via
repeatLastArgs, use sharedstackSubChecksandpadRowToWidthhelpers, and register*ArraySizemethods so spill dimensions are computed at parse time.Documentation and localization are updated:
built-in-functions.md,CHANGELOG.mdunder Unreleased, andVSTACK/HSTACKentries in all language packs (names kept asVSTACK/HSTACKper Excel convention).Reviewed by Cursor Bugbot for commit a61573b. Bugbot is set up for automated code reviews on this repo. Configure here.