FrankChen021 commented on code in PR #20384:
URL: https://github.com/apache/druid/pull/20384#discussion_r4053171738
##########
web-console/src/utils/general.tsx:
##########
@@ -41,6 +41,27 @@ export function isNumberLikeNaN(x: NumberLike): boolean {
return isNaN(Number(x));
}
+/**
+ * Query results and API responses are parsed with JSONBig, so any integer
with 16+ digits arrives
+ * as a BigInt. Charting libraries can not do arithmetic on those, so flatten
them back to numbers.
+ */
+export function bigIntsToNumbers<T extends Record<string, any>>(rows: T[]):
T[] {
+ return rows.map(row => {
+ let changed = false;
+ const res: Record<string, any> = {};
+ for (const k of Object.keys(row)) {
+ const v = row[k];
+ if (typeof v === 'bigint') {
+ res[k] = Number(v);
Review Comment:
[P2] Preserve wide integer dimension values
**Finding:** This helper converts every BigInt property in a chart row, not
only values used for arithmetic. The bar chart passes its split dimension
through this helper, so a BIGINT dimension above Number.MAX_SAFE_INTEGER can
round distinct category values to the same Number; the chart can merge buckets
and a click-to-filter can target the rounded value instead of the original
category.
**Suggestion:** Normalize only measure fields that the chart library must
calculate, or preserve BigInt dimensions as exact strings/values and use those
originals for labels and filters.
##########
web-console/src/views/datasources-view/datasources-view.tsx:
##########
@@ -1273,13 +1285,15 @@ GROUP BY 1, 2`;
{pluralIfNeeded(num_segments, 'segment')}
</a>
);
+ if (typeof num_segments_to_load !== 'number' || typeof
num_segments !== 'number') {
Review Comment:
[P2] Render availability for BigInt counts
**Finding:** When JSONBig parses a COUNT result as BigInt, this guard
returns '-' even though the new accessor has already normalized the same fields
for sorting. A datasource with BigInt segment counts therefore loses its
availability percentage, segment link, and zero-replica status instead of
displaying the normalized value.
**Suggestion:** Convert the count fields to local numbers before the
availability calculations and use those normalized values rather than rejecting
non-number inputs.
--
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]