Skip to content

feat(ui): pivot table bigint support - #480

Merged
rapids-bot[bot] merged 10 commits into
rapidsai:mainfrom
cmatzenbach:pivot-table-bigint-support
Jul 29, 2026
Merged

feat(ui): pivot table bigint support#480
rapids-bot[bot] merged 10 commits into
rapidsai:mainfrom
cmatzenbach:pivot-table-bigint-support

Conversation

@cmatzenbach

@cmatzenbach cmatzenbach commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Modifies pivot table sorting function, gradient background generation, stats computation, and typescript definitions to support BigInt without converting to Number. The only places we are still coercing BigInt are where it is needed - for mean computation and gradient coloring, where precision loss is acceptable. In addition, updates unit tests to test for BigInt without coercing.

Related Issues

Closes #475

Testing

  1. Ensure unit tests pass
  2. If you have a ndjson file with BigInt statistics, ensure the pivot table functions as normal

@cmatzenbach
cmatzenbach marked this pull request as ready for review July 29, 2026 14:54
@cmatzenbach
cmatzenbach requested a review from johallar as a code owner July 29, 2026 14:54
@cmatzenbach cmatzenbach added non-breaking Introduces a non-breaking change ui Pertains to the UI improvement Improves an existing functionality labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Pivot table bigint support

Layer / File(s) Summary
Bigint aggregation precision
ui/packages/@quent/components/src/pivot-table/types.ts, ui/packages/@quent/components/src/pivot-table/utils.ts, ui/packages/@quent/components/src/pivot-table/buildPivotedRows.test.ts
Aggregation fields accept bigint values, bigint-only calculations preserve bigint arithmetic, and tests assert bigint results for sum, minimum, and maximum.
Sorting and gradient integration
ui/packages/@quent/components/src/pivot-table/utils.ts, ui/packages/@quent/components/src/pivot-table/PivotedStatTable.tsx
Sort values retain bigint values, gradient calculations normalize numeric inputs, and stat columns use a numeric comparator with null values ordered last.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • rapidsai/quent#394: Both changes update pivot-table code paths to support bigint stat values across aggregation, sorting, and gradient handling.

Suggested reviewers: johallar

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: bigint support for pivot table values.
Description check ✅ Passed The PR description covers purpose, related issue, and testing; only screenshots are missing, which is non-critical here.
Linked Issues check ✅ Passed The code addresses all linked requirements for bigint sorting, aggregation, gradient scaling, and related column range updates.
Out of Scope Changes check ✅ Passed The changes stay within pivot table bigint support; the remaining edits are test and copyright header updates.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/packages/`@quent/components/src/pivot-table/PivotedStatTable.tsx:
- Around line 45-46: Update the mixed-type comparison branch in the comparator
containing the `typeof a === typeof b` check to compare the original numeric
operands directly with `<` instead of converting either value through
`Number()`. Preserve the existing -1/1 ordering behavior while retaining
precision for mixed number/bigint values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 8db16fd9-d164-4c6d-8f58-e9f388eb96c3

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff193a and 3cba8dc.

📒 Files selected for processing (4)
  • ui/packages/@quent/components/src/pivot-table/PivotedStatTable.tsx
  • ui/packages/@quent/components/src/pivot-table/buildPivotedRows.test.ts
  • ui/packages/@quent/components/src/pivot-table/types.ts
  • ui/packages/@quent/components/src/pivot-table/utils.ts

Comment thread ui/packages/@quent/components/src/pivot-table/PivotedStatTable.tsx Outdated

const HIGHLIGHT_WASH = 'inset 0 0 0 999px hsl(var(--primary) / 0.07)';

const numericSortingFn: SortingFn<PivotedRow> = (rowA, rowB, columnId) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to live in operator table utils

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, moved it over

@johallar johallar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One organization thing, otherwise 🙇 tyty

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/packages/@quent/components/src/pivot-table/utils.ts (1)

297-308: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not silently coerce mixed bigint buckets to number.

Exact aggregation is applied only when every numeric input is bigint. If a bucket contains both number and bigint, the surrounding path converts bigint values with Number() before computing sum/min/max, which can produce incorrect displayed and sorted aggregates above 2^53. Define an exact mixed-type policy instead of silently rounding these values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts around lines 297 -
308, The aggregation branch around onlyBigints must explicitly handle mixed
number/bigint buckets instead of converting bigint values through Number() and
risking precision loss. Preserve exact bigint arithmetic when all inputs are
bigint, and define an explicit policy for mixed values—such as rejecting them or
marking aggregates unsupported—so displayed and sorted sum/min/max results are
never silently rounded above 2^53.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Around line 35-43: Update numericSortingFn’s type annotation to match its
comparator return values: either import TanStack’s SortingFn and export the
function as a typed const, or retain the function declaration with a number
return type. Ensure the chosen approach avoids referencing an unimported
SortingFn.

---

Outside diff comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Around line 297-308: The aggregation branch around onlyBigints must explicitly
handle mixed number/bigint buckets instead of converting bigint values through
Number() and risking precision loss. Preserve exact bigint arithmetic when all
inputs are bigint, and define an explicit policy for mixed values—such as
rejecting them or marking aggregates unsupported—so displayed and sorted
sum/min/max results are never silently rounded above 2^53.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: e021430e-11d4-4f42-90e4-51581d941a7f

📥 Commits

Reviewing files that changed from the base of the PR and between 47d59c6 and b2b4cc3.

📒 Files selected for processing (2)
  • ui/packages/@quent/components/src/pivot-table/PivotedStatTable.tsx
  • ui/packages/@quent/components/src/pivot-table/utils.ts

Comment thread ui/packages/@quent/components/src/pivot-table/utils.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
ui/packages/@quent/components/src/pivot-table/utils.ts (2)

285-287: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Keep bigint inputs out of the stdev path

Casting bigint values to Number loses precision above Number.MAX_SAFE_INTEGER, so variance/stdev can become wrong or even collapse to 0 while sum/min/max stay exact. Keep the variance calculation in exact bigint arithmetic and convert only the final result if needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts around lines 285 -
287, Update the variance/stdev preparation around allNums so bigint inputs are
not converted to Number before calculation. Keep bigint-only variance arithmetic
exact, while preserving the existing mixed-number behavior and converting only
the final stdev result when required by the API.

38-42: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Handle equal mixed numeric values as equal. Mixed number/bigint values like 1n and 1 fall through to the fallback and return 1 in both directions, which breaks sort ordering. Compare with both < and > and return 0 when neither is true.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts around lines 38 - 42,
Update the mixed-type comparison fallback in the comparator around the visible a
and b checks to evaluate both less-than and greater-than relationships,
returning 0 when neither is true. Preserve the existing ordering for unequal
numeric values and the earlier null and same-value handling.
♻️ Duplicate comments (1)
ui/packages/@quent/components/src/pivot-table/utils.ts (1)

35-35: 🎯 Functional Correctness | 🔴 Critical

The previous comparator type error is still present.

numericSortingFn returns -1, 0, or 1, but Line 35 declares the return type as SortingFn<PivotedRow>, which is itself a function type. Change the return type to number, or declare a const comparator typed as SortingFn<PivotedRow>.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts at line 35, Update
numericSortingFn so its declared return type is number, matching the -1/0/1
comparator result it returns; do not use SortingFn<PivotedRow> as the function’s
return type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Around line 285-287: Update the variance/stdev preparation around allNums so
bigint inputs are not converted to Number before calculation. Keep bigint-only
variance arithmetic exact, while preserving the existing mixed-number behavior
and converting only the final stdev result when required by the API.
- Around line 38-42: Update the mixed-type comparison fallback in the comparator
around the visible a and b checks to evaluate both less-than and greater-than
relationships, returning 0 when neither is true. Preserve the existing ordering
for unequal numeric values and the earlier null and same-value handling.

---

Duplicate comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Line 35: Update numericSortingFn so its declared return type is number,
matching the -1/0/1 comparator result it returns; do not use
SortingFn<PivotedRow> as the function’s return type.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: b7458548-030b-4938-90f1-0640c8889990

📥 Commits

Reviewing files that changed from the base of the PR and between b2b4cc3 and 9de4749.

📒 Files selected for processing (2)
  • ui/packages/@quent/components/src/pivot-table/PivotedStatTable.tsx
  • ui/packages/@quent/components/src/pivot-table/utils.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
ui/packages/@quent/components/src/pivot-table/utils.ts (2)

39-43: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Return 0 for numerically equal mixed values.

For example, a = 1 and b = 1n bypass a === b, then the fallback returns 1; the reverse comparison also returns 1. This violates the comparator contract and can produce incorrect sorting. Compare both < and > and return 0 when neither is true.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts around lines 39 - 43,
Update the comparator’s mixed-type fallback after the null and same-type checks
to evaluate both less-than and greater-than relationships, returning 0 when
neither is true. Preserve the existing -1/1 ordering for strictly smaller or
larger values, including numerically equal values such as number and bigint
pairs.

69-81: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve precision when determining bigint gradient ranges.

Distinct large values such as 9007199254740992n and 9007199254740993n both convert to the same Number, causing mn === mx and disabling the gradient for a non-empty range. Keep bigint range comparisons exact and only normalize the interpolation ratio in a way that does not collapse supported values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts around lines 69 - 81,
Update gradientBg so bigint min and max are compared exactly before calculating
the gradient, avoiding Number conversion that collapses distinct large bigint
values. Preserve the existing number behavior, and compute the interpolation
ratio using a precision-safe normalization that supports the accepted bigint
range before passing it to continuousColor.
🟠 Other critical/major comments (1)
ui/packages/@quent/components/src/pivot-table/utils.ts-7-7 (1)

7-7: 🎯 Functional Correctness | 🔴 Critical

Use SortingFn as the function type, not the return type.

SortingFn<PivotedRow> describes the comparator function, but this declaration says numericSortingFn returns a comparator while it returns numbers. This remains a compile-time error; define a typed const or annotate the function parameters and return type as number.

Also applies to: 36-44

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/packages/`@quent/components/src/pivot-table/utils.ts at line 7, Update
numericSortingFn to use SortingFn<PivotedRow> as the comparator function type
rather than its return type, or explicitly type its parameters and numeric
return value. Ensure the declaration matches the function’s actual
number-returning implementation and resolves the compile-time error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Around line 39-43: Update the comparator’s mixed-type fallback after the null
and same-type checks to evaluate both less-than and greater-than relationships,
returning 0 when neither is true. Preserve the existing -1/1 ordering for
strictly smaller or larger values, including numerically equal values such as
number and bigint pairs.
- Around line 69-81: Update gradientBg so bigint min and max are compared
exactly before calculating the gradient, avoiding Number conversion that
collapses distinct large bigint values. Preserve the existing number behavior,
and compute the interpolation ratio using a precision-safe normalization that
supports the accepted bigint range before passing it to continuousColor.

---

Other critical/major comments:
In `@ui/packages/`@quent/components/src/pivot-table/utils.ts:
- Line 7: Update numericSortingFn to use SortingFn<PivotedRow> as the comparator
function type rather than its return type, or explicitly type its parameters and
numeric return value. Ensure the declaration matches the function’s actual
number-returning implementation and resolves the compile-time error.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: a2e9fc87-a993-427d-891d-4e9d3e550727

📥 Commits

Reviewing files that changed from the base of the PR and between 9de4749 and 10b4eb9.

📒 Files selected for processing (1)
  • ui/packages/@quent/components/src/pivot-table/utils.ts

@cmatzenbach

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 7d622c9 into rapidsai:main Jul 29, 2026
15 checks passed
@cmatzenbach
cmatzenbach deleted the pivot-table-bigint-support branch July 29, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change ui Pertains to the UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor pivot table components to accept bigints

2 participants