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


##########
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:
   Fixed in 832702a. Switched from Number() to BigInt() for the integer-string 
comparison so sort order is fully precise beyond Number.MAX_SAFE_INTEGER. Also 
moved the check inside the string-string branch (as you noted in the separate 
"unreachable branch" comment) so it actually takes effect. Thanks for catching 
both!



-- 
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