feat: implement UNIQUE dynamic array function (HF-68)#1708
Open
marcin-kordas-hoc wants to merge 1 commit into
Open
feat: implement UNIQUE dynamic array function (HF-68)#1708marcin-kordas-hoc wants to merge 1 commit into
marcin-kordas-hoc wants to merge 1 commit into
Conversation
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
Task linked: HF-28 Modern dynamic array functions |
Add UNIQUE(array, [by_col], [exactly_once]) as a dynamic array function, mirroring the FILTER machinery for data-dependent result size. Deduplication preserves first-occurrence order and reuses ArithmeticHelper for equality (case-insensitive by default, honoring the caseSensitive config). Supports by_col (unique columns) and exactly_once (values occurring exactly once). Errors in the input range propagate; an empty exactly_once result yields #N/A. Includes i18n for all 17 language packs, docs (built-in-functions, known-limitations), a changelog entry, and the shared ADR. Source: https://app.clickup.com/t/86c89q1tq ADR: docs/adr/2026-07-13-sort-unique-array-functions.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
728efaf to
994b88e
Compare
7 tasks
Performance comparison of head (994b88e) vs base (033f8ac) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1708 +/- ##
===========================================
+ Coverage 97.15% 97.16% +0.01%
===========================================
Files 176 177 +1
Lines 15404 15471 +67
Branches 3409 3426 +17
===========================================
+ Hits 14966 15033 +67
Misses 438 438
🚀 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 & why
Implements UNIQUE (
HF-68, child of HF-28 "Modern dynamic array functions", sibling of the shipped SEQUENCE and of VSTACK/HSTACK). AddsUNIQUE(array, [by_col], [exactly_once])as a dynamic array function.Tests: handsontable/hyperformula-tests#25 (paired).
Sibling PR: #1707 (SORT / HF-69).
ADR:
docs/adr/2026-07-13-sort-unique-array-functions.md.Behavior
by_colisTRUE) of the input, preserving first-occurrence order.by_col:FALSE(default) compares rows;TRUEcompares columns.exactly_once:TRUEreturns only rows/columns occurring exactly once;FALSE(default) returns all distinct.ArithmeticHelper.eq→ case-insensitive by default (honorscaseSensitive), matching Excel's UNIQUE.Design
Mirrors the FILTER machinery for dynamic-size results:
sizeOfResultArrayMethod+vectorizationForbidden: true, runtime viarunFunction, parse-time size method returning a freshArraySize(drops the input'sisRefflag). Deduplication is O(n²) in the number of vectors because locale-aware equality is not trivially hashable — noted in code; acceptable for v1.Notes — divergences from Excel (surfaced here + inline + in tests)
exactly_oncewhen nothing occurs exactly once) →#N/A. Excel returns#CALC!, which HyperFormula has no type for; mirrors FILTER's empty-result mapping (ADRdec_8).con_1).dec_7).Definition of Done
UniquePlugin.ts, registered viaplugin/index.ts)built-in-functions.md,known-limitations.mdSource: https://app.clickup.com/t/86c89q1tq