EnxDev commented on code in PR #43453:
URL: https://github.com/apache/superset/pull/43453#discussion_r3850895774


##########
superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx:
##########
@@ -779,6 +780,43 @@ function EditorsSelector({
 const ResultTable =
   extensionsRegistry.get('sqleditor.extension.resultTable') ?? FilterableTable;
 
+// D3's '%' type is a valid spec that multiplies by 100, so it never trips
+// the "Invalid format" fallback even when applied to a raw count. Parsing
+// via the same registry the chart uses excludes garbage like "foo%" that
+// merely ends in '%' without being a valid D3 spec.
+export const isPercentD3Format = (d3format?: string): boolean => {
+  const trimmed = d3format?.trim();
+  return (
+    !!trimmed && trimmed.endsWith('%') && 
!getNumberFormatter(trimmed).isInvalid

Review Comment:
   Confirmed and fixed: isPercentD3Format now parses via d3-format's own 
formatSpecifier and checks type === '%' || type === 'p', so .1p on COUNT(*) is 
caught the same as .0%. 
[DatasourceEditor.tsx:840](vscode-webview://03msa8759m0ieil9fgknfejjnv98udeg1o5qi9olm6r74uil1bk4/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx#L840)



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