bito-code-review[bot] commented on PR #30827:
URL: https://github.com/apache/superset/pull/30827#issuecomment-4396297918

   <!-- Bito Reply -->
   The flagged performance issue is correct: the code performs a linear search 
through datasource columns for each result column, resulting in O(N*M) 
complexity. To resolve, build a one-time lookup map. Here's the concise fix.
   
   **superset-frontend/plugins/plugin-chart-table/src/transformProps.ts**
   ```
   const columnConfigs = props.datasource.columns;
     const columnConfigMap = new Map(columnConfigs.map(c => [c.column_name, 
c]));
   
     const columns: DataColumnMeta[] = (colnames || [])
       .filter(
         ...
       )
       .map(key => {
         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 = columnConfigMap.get(key)?.filterable;
         ...
   ```


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