rusackas commented on code in PR #42596:
URL: https://github.com/apache/superset/pull/42596#discussion_r3708020392
##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx:
##########
@@ -354,14 +354,20 @@ export default function PluginFilterSelect(props:
PluginFilterSelectProps) {
return 0; // Preserve the original order from the backend
}
- // Only apply alphabetical sorting when no sortMetric is specified
- const labelComparator = propertyComparator('label');
+ // Only apply sorting when no sortMetric is specified. `label` is always
+ // a formatted string (see getDataRecordFormatter), so comparing by it
+ // never reaches propertyComparator's numeric branch; numeric columns
+ // sort by the raw `value` instead so "2, 10, 100" doesn't collapse
+ // into lexicographic "10, 100, 2".
+ const comparator = propertyComparator(
+ datatype === GenericDataType.Numeric ? 'value' : 'label',
Review Comment:
Good catch, this was a real gap. propertyComparator's numeric branch only
matched `typeof === 'number'`, so a BIGINT column with 16+ digit values
(decoded to native `bigint` via json-bigint) would fall through to the string
fallback and reproduce the exact same "10, 100, 2" bug we just fixed. Added a
bigint-aware branch to propertyComparator (handles bigint/bigint and mixed
bigint/number) in cc3571cf1ec, plus a regression test with
divergent-digit-length bigint values so it actually exercises the bug pattern.
--
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]