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

   <!-- Bito Reply -->
   The flagged issue is correct. When a `sankey_v2` chart receives a 
single-column group-by override, the current implementation updates `source` 
but fails to clear stale `target` and `intermediate_levels` values, which can 
lead to incorrect query results. 
   
   To resolve this, you should explicitly clear these fields when the group-by 
length is 1. Here is the corrected implementation for 
`superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts`:
   
   ```typescript
     } else if (chartType === 'sankey_v2') {
       groupByFormData.source = groupByColumns[0];
       if (groupByColumns.length > 1) {
         groupByFormData.target = groupByColumns[groupByColumns.length - 1];
         groupByFormData.intermediate_levels = groupByColumns.slice(1, -1);
       } else {
         groupByFormData.target = undefined;
         groupByFormData.intermediate_levels = [];
       }
     } else if (['chord'].includes(chartType)) {
   ```
   
   I have checked the PR comments and diff. There are no other pending review 
comments in the provided context. Would you like me to implement this fix for 
you?
   
   
**superset-frontend/src/dashboard/util/charts/getFormDataWithExtraFilters.ts**
   ```
   if (groupByColumns.length > 1) {
         groupByFormData.target = groupByColumns[groupByColumns.length - 1];
         groupByFormData.intermediate_levels = groupByColumns.slice(1, -1);
       } else {
         groupByFormData.target = undefined;
         groupByFormData.intermediate_levels = [];
       }
   ```


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