rusackas commented on code in PR #30827:
URL: https://github.com/apache/superset/pull/30827#discussion_r3484004143


##########
superset-frontend/plugins/plugin-chart-table/src/transformProps.ts:
##########
@@ -232,6 +232,7 @@ const processColumns = memoizeOne(function processColumns(
   const metricsSet = new Set(metrics);
   const percentMetricsSet = new Set(percentMetrics);
   const rawPercentMetricsSet = new Set(rawPercentMetrics);
+  const columnConfigs = props.datasource.columns;

Review Comment:
   ```suggestion
     const columnsByName = new Map(
       (props.datasource.columns ?? []).map(col => [col.column_name, col]),
     );
   ```
   Build the lookup once here (pairs with the suggestion below).



##########
superset-frontend/plugins/plugin-chart-table/src/transformProps.ts:
##########
@@ -244,6 +245,9 @@ const processColumns = memoizeOne(function processColumns(
       const config = columnConfig[key] || {};
       // for the purpose of presentation, only numeric values are treated as 
metrics
       // because users can also add things like `MAX(str_col)` as a metric.
+      const isFilterable = columnConfigs.find(
+        c => c.column_name === key,
+      )?.filterable;

Review Comment:
   ```suggestion
         const isFilterable = columnsByName.get(key)?.filterable;
   ```
   ...then it's an O(1) read per column.



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