piyushraj001 commented on code in PR #44044:
URL: https://github.com/apache/superset/pull/44044#discussion_r4017651067


##########
superset-frontend/packages/superset-ui-core/src/components/Select/utils.tsx:
##########
@@ -91,16 +91,21 @@ export const propertyComparator =
     if (typeof propertyA === 'number' && typeof propertyB === 'number') {
       return propertyA - propertyB;
     }
-    // BIGINT columns can decode to native `bigint` values (see json-bigint
-    // parsing of large numeric values). Compare numerically rather than
-    // falling through to the string fallback below, which would sort them
-    // lexicographically (e.g. "10", "100", "2").
+    // BIGINT columns can decode to native `bigint` values or decimal strings
+    // (see parseResponse.ts). Compare numerically rather than falling through
+    // to the string fallback below, which would sort lexicographically.
     if (
-      (typeof propertyA === 'bigint' || typeof propertyA === 'number') &&
-      (typeof propertyB === 'bigint' || typeof propertyB === 'number')
+      (typeof propertyA === 'bigint' ||
+        typeof propertyA === 'number' ||
+        (typeof propertyA === 'string' && /^-?\d+$/.test(propertyA))) &&
+      (typeof propertyB === 'bigint' ||
+        typeof propertyB === 'number' ||
+        (typeof propertyB === 'string' && /^-?\d+$/.test(propertyB)))
     ) {
-      if (propertyA < propertyB) return -1;
-      if (propertyA > propertyB) return 1;
+      const a = Number(propertyA);
+      const b = Number(propertyB);

Review Comment:
   Thanks for confirming. The fix in 832702a takes a slightly different 
approach than your suggestion to avoid a RangeError — BigInt(propertyA) would 
throw for float number values (e.g. BigInt(3.14) throws RangeError).
   
   Our implementation separates the cases:
   
   string + string → integer-string check via /^-?\d+$/ first, then BigInt() 
(safe because regex guarantees no decimals)
   number + number → plain propertyA - propertyB (no BigInt involved)
   bigint + bigint → direct </> comparison
   This avoids passing float numbers into BigInt() entirely.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to