Skip to content

fix: [AI-1838] map BigInteger to string in Perspective for large int precision#1851

Open
ralphstodomingo wants to merge 1 commit intomasterfrom
fix/1838-int64-precision
Open

fix: [AI-1838] map BigInteger to string in Perspective for large int precision#1851
ralphstodomingo wants to merge 1 commit intomasterfrom
fix/1838-int64-precision

Conversation

@ralphstodomingo
Copy link
Copy Markdown
Contributor

@ralphstodomingo ralphstodomingo commented Mar 26, 2026

Summary

  • Map new BigInteger agate type to Perspective string for full precision rendering
  • Keep Integer mapped to integer for normal numeric behavior (sorting, aggregation)

Context

Fixes #1838

The Python bridge now flags columns containing values > 2^53-1 as BigInteger instead of Number/Integer. This PR adds the frontend mapping so only those columns use string rendering. Normal integer columns retain numeric type with proper sorting and aggregation.

Trade-offs: BigInteger columns support count/distinct count aggregation only — no sum/avg. This is preferable to showing incorrect rounded values.

Companion PR: AltimateAI/altimate-dbt-integration#39 (Python-side precision preservation)

Test plan

  • Large integer column (9203817354237048492) displays with full precision
  • Small integer column sorts numerically (1, 2, 10, 20) not lexicographically
  • Text columns unaffected
  • Aggregation: string-only aggregations for BigInteger, full numeric for Integer

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Corrected Integer column handling so numeric data displays accurately in perspectives.
  • New Features

    • Added support for BigInteger columns in data perspectives.
  • Chores

    • Improved viewer add-on and theme loading order for more consistent styling and minor internal cleanup.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d789d832-a534-4228-bbf7-8bc33a0ca53e

📥 Commits

Reviewing files that changed from the base of the PR and between 418b917 and 84aa752.

📒 Files selected for processing (1)
  • webview_panels/src/modules/queryPanel/components/perspective/PerspectiveViewer.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • webview_panels/src/modules/queryPanel/components/perspective/PerspectiveViewer.tsx

Walkthrough

Reordered side-effect imports and CSS theme load order for Perspective viewer; changed column type mapping so Integer maps to Perspective "integer" (was "float") and added BigInteger"string" to avoid precision loss.

Changes

Cohort / File(s) Summary
Perspective viewer
webview_panels/src/modules/queryPanel/components/perspective/PerspectiveViewer.tsx
Reordered side-effect imports (@finos/perspective-viewer-datagrid, @finos/perspective-viewer-d3fc) and swapped sequence of bundled theme CSS imports. Updated mapType schema mapping: Integer"integer" (previously "float"); added BigInteger"string". Minor whitespace cleanup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • mdesmet
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: mapping BigInteger to string in Perspective to preserve large integer precision. It is concise, specific, and directly related to the primary change.
Description check ✅ Passed The PR description covers the key aspects: problem (BigInteger precision), solution (mapping to string), context (companion PR), and test plan. However, it deviates from the repository template which requires an 'Overview' section with 'Problem' and 'Solution' subsections, and a 'Checklist' with specific items.
Linked Issues check ✅ Passed The code changes directly address #1838 by mapping BigInteger to string type to prevent truncation of large INT64 values, preserving full precision while maintaining numeric behavior for normal Integer columns.
Out of Scope Changes check ✅ Passed All changes are scoped to the BigInteger precision fix: reordering imports, updating column type mappings (Integer to 'integer', adding BigInteger to 'string'), and minor cleanup. No unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1838-int64-precision

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@mdesmet
Copy link
Copy Markdown
Contributor

mdesmet commented Mar 26, 2026

Is there any impact on the perspective features (sidebar) because we mark it to string, what about aggregation?

@mdesmet
Copy link
Copy Markdown
Contributor

mdesmet commented Mar 26, 2026

Is there any upgrades we can do of perspective that would support bigint type?

Only columns flagged as BigInteger (containing values > 2^53-1) use
string rendering. Normal integer columns retain numeric type for
proper sorting and aggregation.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@ralphstodomingo ralphstodomingo force-pushed the fix/1838-int64-precision branch from 418b917 to 84aa752 Compare March 26, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INT64 values lose precision in query results (large integers truncated to float)

2 participants