fix(table-chart): support where for adhoc columns with server-side pagination#38716
Conversation
Code Review Agent Run #13397cActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Sequence DiagramThis PR updates table query building so search and sorting references that use adhoc column labels are resolved to their SQL expressions. It ensures server side paginated table requests apply WHERE logic correctly for renamed or custom SQL columns. sequenceDiagram
participant User
participant TableAPI
participant QueryBuilder
participant Database
User->>TableAPI: Request paginated table data with search by custom label
TableAPI->>QueryBuilder: Build query from columns filters and sort
QueryBuilder->>QueryBuilder: Resolve adhoc label to SQL expression
QueryBuilder->>Database: Execute paginated query with resolved where and order
Database-->>QueryBuilder: Return filtered result page
QueryBuilder-->>User: Return paginated filtered table rows
Generated by CodeAnt AI |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #38716 +/- ##
==========================================
- Coverage 65.12% 64.32% -0.81%
==========================================
Files 1819 2532 +713
Lines 72690 129738 +57048
Branches 23235 29997 +6762
==========================================
+ Hits 47339 83448 +36109
- Misses 25351 44837 +19486
- Partials 0 1453 +1453
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes server-side pagination table-chart search/sort when users filter/order by renamed adhoc (SQL expression) columns, by resolving label-based references back to their underlying SQL expressions in get_sqla_query.
Changes:
- Add
find_adhoc_column_and_convert_to_sqla()helper to resolve adhoc columns by label to SQLAlchemy expressions. - Use the helper to support label-based adhoc references in both
ORDER BYand filter (WHERE) handling. - Add unit tests covering adhoc label lookup and filter behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
superset/models/helpers.py |
Introduces a helper and wires it into query generation so filters/orderby can resolve adhoc columns by label. |
tests/unit_tests/models/helpers_test.py |
Adds unit tests for filtering and helper lookup behavior with adhoc column labels. |
You can also share your feedback on Copilot code review. Take the survey.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #4a35ceActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
User description
SUMMARY
When using server-side pagination in table charts, filter by custom SQL expression columns (adhoc columns) returns all records.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
table-search-issue.webm
After:
table-search-fix.webm
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
CodeAnt-AI Description
Allow table chart filters to work with renamed ad hoc columns
What Changed
Impact
✅ Working table chart filters with renamed columns✅ Fewer failed searches in server-side pagination✅ Clearer results when filtering custom SQL columns💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.