LisaHusband opened a new pull request, #34694:
URL: https://github.com/apache/superset/pull/34694

   fix(drill-to-detail): map axis labels to original column names in filters
   
   ### SUMMARY
   This PR fixes an issue where the **Drill to Detail** feature in ECharts 
charts fails when the X-axis column has a `verbose_name` defined at the dataset 
level.  
   Previously, the frontend would send the column's label as the `filters.col` 
value in the `/samples` request. The backend did not translate the label back 
to the original column name, causing the filter condition to be ignored and the 
query to return all rows.  
   
   Changes in this PR:
   - Added `reverse_verbose_map` to the `Datasource` object to map labels 
(`verbose_name`) back to their original column names.
   - Updated `get_samples` to preprocess `payload.filters`, replacing 
label-based column names with their original names.
   - Removed the `grain` parameter for non-temporal columns in Drill to Detail 
payloads to ensure correct SQL filtering.
   - Kept the existing `verbose_map` behavior unchanged so UI display is not 
affected.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   **Before:**  
   When drilling to detail on a bar chart, the resulting table displayed all 
rows instead of filtering by the selected axis value.  
   
   **After:**  
   Drill to detail returns only rows matching the selected axis value.
   
   ### TESTING INSTRUCTIONS
   1. In a dataset, add a `verbose_name(Label)` to a column.
   2. Create a bar chart using that column as the X-axis and add a metric.
   3. Save the chart to a dashboard.
   4. In the dashboard, right-click a bar and choose "Drill to Detail by 
$AXIS_VALUE".
   5. Verify that only rows matching the selected axis value are returned.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Fixes #33907 
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to