This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch tdd/issue-27510-bigint-filter-precision
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d13433e0311db814f7bb46d6f240bda637108256
Author: Claude Code <[email protected]>
AuthorDate: Sat Jul 11 11:13:20 2026 -0700

    test(filters): guard BIGINT filter value precision (#27510)
    
    Adds a regression test proving that a large BIGINT column value
    (16+ digits, exceeding Number.MAX_SAFE_INTEGER) is rendered by the
    native filter's label formatter as its exact decimal string, without
    precision loss or a raw BigNumber object reaching React.
    
    Closes #27510
    
    Co-Authored-By: Claude Opus 4.8 <[email protected]>
---
 superset-frontend/src/filters/utils.test.ts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/superset-frontend/src/filters/utils.test.ts 
b/superset-frontend/src/filters/utils.test.ts
index 7da20af89ad..d9c960f6cb1 100644
--- a/superset-frontend/src/filters/utils.test.ts
+++ b/superset-frontend/src/filters/utils.test.ts
@@ -177,6 +177,28 @@ describe('Filter utils', () => {
       );
     });
 
+    test('Regression for #27510: formats large BIGINT column values as exact 
strings without precision loss', () => {
+      // A BIGINT column value with 16+ digits arrives as a native `bigint`
+      // (decoded from the `json-bigint` parse of the chart data response).
+      // Historically the filter UI rendered it as a raw BigNumber object
+      // ({ s, e, c }), throwing React error #31, or coerced it through a JS
+      // number and silently corrupted the trailing digits. The label
+      // formatter must turn it into its exact decimal string so the Select
+      // filter option renders correctly and the value keeps full precision.
+      const formatter = getDataRecordFormatter();
+      const largeBigInt = 1234567890125123456n;
+
+      expect(formatter(largeBigInt, GenericDataType.Numeric)).toEqual(
+        '1234567890125123456',
+      );
+      expect(formatter(largeBigInt, GenericDataType.String)).toEqual(
+        '1234567890125123456',
+      );
+      // Guard: routing the same value through a JS number (the pre-fix
+      // behavior) loses precision, which is exactly what broke the filter.
+      expect(String(Number(largeBigInt))).not.toEqual('1234567890125123456');
+    });
+
     test('formatter with defined formatters returns expected values', () => {
       const formatter = getDataRecordFormatter({
         timeFormatter: getTimeFormatter(TimeFormats.DATABASE_DATETIME),

Reply via email to