Repository navigation
Conversation
A NaN in the first row of a group became the running result and was never replaced, because every later comparison against it is false. The same values in another row order aggregated normally. v8 skipped NaN in these three aggregations (its `value >= value` guard). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 721ca40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🎯 Changes
min,maxandextentreturnNaNwhen the first value of a group isNaN, and ignore the sameNaNanywhere else in the group. So the aggregate of one set of values depends on row order:(Run on
mainwithconstructTableand therowAggregationFeature+aggregationFnstest fixture.)The first valid value seeds the running result, and
getRangeKindcountsNaNas a valid number. Every latervalueNumber - resultNumber < 0is then false, so the seed is never replaced. A leadingNaNalso fixes the group's kind to'number', so a group of Dates behind it is dropped. Themergepaths go through the same helper.v8 skipped
NaNin all three (min === undefined && value >= value); with the v8 functions both orders above give1,3,[1, 3]. This change makesgetRangeKindreturnundefinedforNaN, which restores that foraggregateandmerge. The JSDoc ofmin/maxsaidNaN"preserves the legacy numeric seeding behavior", so I reworded it to say it is ignored.sumis untouched (it still propagatesNaN, as its test expects).Not included:
medianalso gives order-dependent results withNaN(its sort comparator returnsNaN), but v8 did the same and #6655 is open on that function. The generateddocs/referencepages formin/maxstill carry the old sentence; I left them for the next docs regeneration.Checks run in
packages/table-core:npx vitest run tests/unit/fns/aggregationFns.test.ts— the new test fails onmain(expected NaN to be 1), 9/9 pass with the fixnpx vitest run tests/unit/fns/aggregationFns.test.ts tests/implementation/features/row-aggregation/rowAggregationFeature.test.ts tests/implementation/features/column-grouping tests/unit/features/column-grouping tests/unit/worker/serializeRebuild.test.ts— 80 passednpx eslintandnpx prettier --checkon the changed files,npx tsc— cleanI did not run the full
pnpm test/pnpm test:e2e.✅ Checklist
pnpm testandpnpm test:e2e, or these tests do not apply to this pull request.🚀 Release Impact
🤖 Generated with Claude Code
Summary by CodeRabbit
NaNvalues, including when combining results. Groups with aNaNfirst value can now produce valid results from other values.