You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "LisaHusband (via GitHub)" <gi...@apache.org> on 2025/08/14 10:26:44 UTC

[PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3191438139

   @msyavuz Processing your ephemeral environment request [here](https://github.com/apache/superset/actions/runs/16990406538). Action: **up**. More information on [how to use or configure ephemeral environments](https://superset.apache.org/docs/contributing/howtos/#github-ephemeral-environments)


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3187958070

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/34694?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `20.00000%` with `8 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 51.50%. Comparing base ([`d79fc92`](https://app.codecov.io/gh/apache/superset/commit/d79fc92a1ad16e7d8ebd6a011b9bb2d5504adabe?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0b3e2f0`](https://app.codecov.io/gh/apache/superset/commit/0b3e2f02f68a72b7853ddf2e247c10e7497a4830?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/34694?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/connectors/sqla/models.py](https://app.codecov.io/gh/apache/superset/pull/34694?src=pr&el=tree&filepath=superset%2Fconnectors%2Fsqla%2Fmodels.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | 33.33% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/34694?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [superset/views/datasource/utils.py](https://app.codecov.io/gh/apache/superset/pull/34694?src=pr&el=tree&filepath=superset%2Fviews%2Fdatasource%2Futils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS91dGlscy5weQ==) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/34694?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #34694       +/-   ##
   ===========================================
   + Coverage        0   51.50%   +51.50%     
   ===========================================
     Files           0      574      +574     
     Lines           0    41677    +41677     
     Branches        0     4393     +4393     
   ===========================================
   + Hits            0    21464    +21464     
   - Misses          0    19621    +19621     
   - Partials        0      592      +592     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/34694/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/34694/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.04% <20.00%> (?)` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/34694/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `50.75% <20.00%> (?)` | |
   | [python](https://app.codecov.io/gh/apache/superset/pull/34694/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `51.49% <20.00%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/34694/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ΓΈ> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/34694?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3248869498

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2333124792


##########
tests/views/datasource/test_replace_verbose_with_column.py:
##########


Review Comment:
   Is this a good place for this file? `/tests/unit_tests/datasource/utils/` seem like a better place to put this



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "LisaHusband (via GitHub)" <gi...@apache.org>.
LisaHusband commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2333231674


##########
tests/views/datasource/test_replace_verbose_with_column.py:
##########


Review Comment:
   because other func in that util.py  have not tests, but i will change its localtion  later.



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "LisaHusband (via GitHub)" <gi...@apache.org>.
LisaHusband commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2304088800


##########
superset/views/datasource/utils.py:
##########
@@ -44,6 +44,35 @@ def get_limit_clause(page: Optional[int], per_page: Optional[int]) -> dict[str,
     return {"row_offset": offset, "row_limit": limit}
 
 
+def replace_verbose_with_column(
+    filters: list[dict[str, Any]],
+    columns: Iterable[Any],
+    verbose_attr: str = "verbose_name",
+    column_attr: str = "column_name",
+) -> None:
+    """
+    Replace filter 'col' values that match column verbose_name with the column_name.
+    Operates in-place on the filters list.
+
+    Args:
+        filters: List of filter dicts, each must have 'col' key.
+        columns: Iterable of column objects with verbose_name and column_name.
+        verbose_attr: Attribute name for verbose/label.
+        column_attr: Attribute name for actual column name.
+    """
+    for f in filters:
+        match = next(
+            (
+                getattr(col, column_attr)
+                for col in columns
+                if getattr(col, verbose_attr) == f["col"]
+            ),
+            None,
+        )
+        if match:
+            f["col"] = match
+
+

Review Comment:
   of course



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2318699656


##########
superset/views/datasource/utils.py:
##########
@@ -44,6 +44,35 @@
     return {"row_offset": offset, "row_limit": limit}
 
 
+def replace_verbose_with_column(
+    filters: list[dict[str, Any]],
+    columns: Iterable[Any],
+    verbose_attr: str = "verbose_name",
+    column_attr: str = "column_name",
+) -> None:
+    """
+    Replace filter 'col' values that match column verbose_name with the column_name.
+    Operates in-place on the filters list.
+
+    Args:
+        filters: List of filter dicts, each must have 'col' key.
+        columns: Iterable of column objects with verbose_name and column_name.
+        verbose_attr: Attribute name for verbose/label.
+        column_attr: Attribute name for actual column name.
+    """
+    for f in filters:
+        match = next(
+            (
+                getattr(col, column_attr)
+                for col in columns
+                if getattr(col, verbose_attr) == f["col"]

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing dictionary key validation</b></div>
   <div id="fix">
   
   The `f["col"]` access will raise `KeyError` if filter dictionaries don't have a 'col' key. Add a check for key existence using `f.get("col")` or `"col" in f` to prevent runtime crashes.
   </div>
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
         for f in filters:
    +        if "col" not in f:
    +            continue
             match = next(
                 (
                     getattr(col, column_attr)
                     for col in columns
    -                if hasattr(col, verbose_attr) and hasattr(col, column_attr)
    -                and getattr(col, verbose_attr) == f["col"]
    +                if hasattr(col, verbose_attr) and hasattr(col, column_attr)
    +                and getattr(col, verbose_attr) == f["col"]
                 ),
                 None,
             )
   ```
   
   </div>
   </details>
   </div>
   
   
   
   <small><i>Code Review Run <a href=https://github.com/apache/superset/pull/34694#issuecomment-3248869498>#cf0842</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
superset/views/datasource/utils.py:
##########
@@ -44,6 +44,35 @@ def get_limit_clause(page: Optional[int], per_page: Optional[int]) -> dict[str,
     return {"row_offset": offset, "row_limit": limit}
 
 
+def replace_verbose_with_column(
+    filters: list[dict[str, Any]],
+    columns: Iterable[Any],
+    verbose_attr: str = "verbose_name",
+    column_attr: str = "column_name",
+) -> None:
+    """
+    Replace filter 'col' values that match column verbose_name with the column_name.
+    Operates in-place on the filters list.
+
+    Args:
+        filters: List of filter dicts, each must have 'col' key.
+        columns: Iterable of column objects with verbose_name and column_name.
+        verbose_attr: Attribute name for verbose/label.
+        column_attr: Attribute name for actual column name.
+    """
+    for f in filters:
+        match = next(
+            (
+                getattr(col, column_attr)
+                for col in columns
+                if getattr(col, verbose_attr) == f["col"]
+            ),
+            None,
+        )

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing attribute existence validation</b></div>
   <div id="fix">
   
   The `getattr(col, column_attr)` and `getattr(col, verbose_attr)` calls on lines 66 and 68 will raise `AttributeError` if column objects don't have the expected attributes. Add `hasattr()` checks before using `getattr()` to prevent runtime crashes.
   </div>
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```suggestion
           match = next(
               (
                   getattr(col, column_attr)
                   for col in columns
                   if hasattr(col, verbose_attr) and hasattr(col, column_attr)
                   and getattr(col, verbose_attr) == f["col"]
               ),
               None,
           )
   ```
   
   </div>
   </details>
   </div>
   
   
   
   <small><i>Code Review Run <a href=https://github.com/apache/superset/pull/34694#issuecomment-3248869498>#cf0842</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3249505496

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2293658837


##########
superset/views/datasource/utils.py:
##########
@@ -44,6 +44,35 @@ def get_limit_clause(page: Optional[int], per_page: Optional[int]) -> dict[str,
     return {"row_offset": offset, "row_limit": limit}
 
 
+def replace_verbose_with_column(
+    filters: list[dict[str, Any]],
+    columns: Iterable[Any],
+    verbose_attr: str = "verbose_name",
+    column_attr: str = "column_name",
+) -> None:
+    """
+    Replace filter 'col' values that match column verbose_name with the column_name.
+    Operates in-place on the filters list.
+
+    Args:
+        filters: List of filter dicts, each must have 'col' key.
+        columns: Iterable of column objects with verbose_name and column_name.
+        verbose_attr: Attribute name for verbose/label.
+        column_attr: Attribute name for actual column name.
+    """
+    for f in filters:
+        match = next(
+            (
+                getattr(col, column_attr)
+                for col in columns
+                if getattr(col, verbose_attr) == f["col"]
+            ),
+            None,
+        )
+        if match:
+            f["col"] = match
+
+

Review Comment:
   Can we get a test for this as well?



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2319186897


##########
tests/views/datasource/test_replace_verbose_with_column.py:
##########
@@ -0,0 +1,83 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+import pytest
+
+from superset.views.datasource.utils import replace_verbose_with_column
+
+
+class Column:
+    def __init__(self, column_name, verbose_name):
+        self.column_name = column_name
+        self.verbose_name = verbose_name
+
+
+class IncompleteColumn:
+    """A column missing required attributes."""
+
+    def __init__(self, only_name):
+        self.only_name = only_name
+
+
+# Test dataset and filters
+columns = [
+    Column("col1", "Column 1"),
+    Column("col3", "Column 3"),
+]
+
+
+@pytest.mark.parametrize(
+    "filters, expected",
+    [
+        # Normal match, should be replaced with the actual column_name
+        ([{"col": "Column 1"}], [{"col": "col1"}]),
+        # Multiple filters, should correctly replace all matching columns
+        (
+            [{"col": "Column 1"}, {"col": "Column 3"}],
+            [{"col": "col1"}, {"col": "col3"}],
+        ),
+        # No matching case, the original value should remain unchanged
+        ([{"col": "Non-existent"}], [{"col": "Non-existent"}]),
+        # Empty filters, no changes should be made
+        ([], []),
+    ],
+)
+def test_replace_verbose_with_column(filters, expected):
+    filters_copy = [dict(f) for f in filters]
+    replace_verbose_with_column(filters_copy, columns)
+    assert filters_copy == expected
+
+
+def test_replace_verbose_with_column_missing_col_key(caplog):
+    """Filter dict missing 'col' should trigger a warning and be skipped."""
+    filters = [{"op": "=="}]  # missing "col"
+    with caplog.at_level("WARNING"):
+        replace_verbose_with_column(filters, columns)
+    assert "Filter missing 'col' key" in caplog.text

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Test assertion mismatch with log message</b></div>
   <div id="fix">
   
   The test assertion will fail because it expects the exact message 'Filter missing 'col' key' but the actual function logs 'Filter missing 'col' key: %s' with the filter dict appended. Update the assertion to check for 'Filter missing 'col' key:' (including the colon) to match the actual log format.
   </div>
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```suggestion
       assert "Filter missing 'col' key:" in caplog.text
   ```
   
   </div>
   </details>
   </div>
   
   
   
   <small><i>Code Review Run <a href=https://github.com/apache/superset/pull/34694#issuecomment-3249505496>#7cd4b6</a></i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3270014809

   πŸŽͺ [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/17579306199) for [138a28b](https://github.com/apache/superset/commit/138a28b)
   
   β€’ **Environment:** http://54.188.69.93:8080 (admin/admin)
   β€’ **Lifetime:** 24h auto-cleanup
   β€’ **Updates:** New commits create fresh environments automatically


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "LisaHusband (via GitHub)" <gi...@apache.org>.
LisaHusband commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2333213742


##########
tests/views/datasource/test_replace_verbose_with_column.py:
##########


Review Comment:
   really?



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3269955180

   πŸŽͺ [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/17579306199) for [138a28b](https://github.com/apache/superset/commit/138a28b)


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "LisaHusband (via GitHub)" <gi...@apache.org>.
LisaHusband commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3251714105

   @msyavuz  it ready for review.


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3250934881

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Default Agent` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34694:
URL: https://github.com/apache/superset/pull/34694#issuecomment-3191455397

   @msyavuz Ephemeral environment spinning up at http://34.215.91.0:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.


-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #34694:
URL: https://github.com/apache/superset/pull/34694#discussion_r2276240580


##########
superset/connectors/sqla/models.py:
##########
@@ -360,6 +360,14 @@ def verbose_map(self) -> dict[str, str]:
 
         return verb_map
 
+    @property
+    def reverse_verbose_map(self) -> dict[str, str]:
+        """label -> column name"""
+        rev_map = {}
+        for k, v in self.verbose_map.items():
+            rev_map[v] = k
+        return rev_map

Review Comment:
   ### Inefficient reverse map property computation <sub>![category Design](https://img.shields.io/badge/Design-0d9488)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The reverse_verbose_map property method is inefficiently recalculating the reverse mapping every time it's accessed by iterating through verbose_map.
   
   
   ###### Why this matters
   Since verbose_map is also a property method, frequent access to reverse_verbose_map will cause repeated unnecessary computations which could impact performance for large datasets.
   
   ###### Suggested change βˆ™ *Feature Preview*
   Cache the reverse_verbose_map or calculate it once when verbose_map changes:
   ```python
   def __init__(self):
       self._reverse_verbose_map = None
   
   @property 
   def verbose_map(self) -> dict[str, str]:
       verb_map = {...}
       self._reverse_verbose_map = None # Invalidate cache
       return verb_map
   
   @property
   def reverse_verbose_map(self) -> dict[str, str]:
       if self._reverse_verbose_map is None:
           self._reverse_verbose_map = {v: k for k, v in self.verbose_map.items()}
       return self._reverse_verbose_map
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/πŸ‘%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e0fb7989-aed0-4041-98fe-0163f636ca0b/upvote) [![Incorrect](https://img.shields.io/badge/πŸ‘Ž%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e0fb7989-aed0-4041-98fe-0163f636ca0b?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/πŸ‘Ž%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e0fb7989-aed0-4041-98fe-0163f636ca0b?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/πŸ‘Ž%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e0fb7989-aed0-4041-98fe-0163f636ca0b?what_not_in_standard=true) [![Other](https://img.shields.io/badge/πŸ‘Ž%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e0fb7989-aed0-4041-98fe-0163f636ca0b)
   </details>
   
   <sub>
   
   πŸ’¬ Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:98afb300-ec62-4a48-8b4a-297a81ededea -->
   
   
   [](98afb300-ec62-4a48-8b4a-297a81ededea)



-- 
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-unsubscribe@superset.apache.org

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


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


Re: [PR] fix(drill-to-detail): ensure axis label filters map to original column names [superset]

Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #34694:
URL: https://github.com/apache/superset/pull/34694


-- 
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-unsubscribe@superset.apache.org

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


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