rusackas commented on code in PR #42596:
URL: https://github.com/apache/superset/pull/42596#discussion_r3711223384
##########
superset-frontend/packages/superset-ui-core/src/components/Select/utils.tsx:
##########
@@ -91,6 +91,18 @@ 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").
+ if (
+ (typeof propertyA === 'bigint' || typeof propertyA === 'number') &&
+ (typeof propertyB === 'bigint' || typeof propertyB === 'number')
+ ) {
+ if (propertyA < propertyB) return -1;
+ if (propertyA > propertyB) return 1;
+ return 0;
+ }
Review Comment:
Added direct unit tests for propertyComparator's bigint branch in
utils.test.ts (string, number, bigint, diverging-digit-length bigint, and mixed
bigint/number cases) — it was only exercised indirectly through
SelectFilterPlugin.test.tsx before.
--
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]