amaannawab923 opened a new pull request, #35683: URL: https://github.com/apache/superset/pull/35683
## **User description** FEATURE_AG_GRID_TABLE_ENABLED=true <!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY This PR adds **server-side filtering** for AG Grid Table V2, allowing users to filter large datasets efficiently directly from column headers. **What it does:** Currently, when server pagination is enabled, AG Grid column filters only work on the current page's data (e.g., filtering 50 rows instead of the full 100,000 rows in the database). This PR changes that by converting AG Grid filter conditions into SQL queries that execute on the backend. **Key Points:** - Column filters now work across the **entire dataset**, not just the current page - Supports all common filter types: text (contains, equals, starts with), numbers (greater than, less than, ranges), dates, and blank/not blank checks - Handles complex conditions with AND/OR logic (e.g., "state equals CA OR NY") - Automatically separates dimension filters (→ WHERE clause) from metric filters (→ HAVING clause) for optimal SQL performance - Works in Parity with the Permalink feature and doesn't break Chart State - UX enhancement: filter popover auto-reopens after server refresh so users don't lose their place ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] 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 ___ ## **CodeAnt-AI Description** Server-side column filtering for AG Grid table with metric/dimension separation and robust date handling ### What Changed - Column header filters run on the server for server-pagination tables so filters apply to the entire dataset (not just the current page) and support text, number, date, set, boolean, and blank/not-blank conditions. - Filters on metric columns are moved to HAVING clauses while dimension filters go to WHERE (so metric and dimension filters are applied in the correct SQL context). - Date filters produce full-day ranges and temporal-range expressions so date comparisons behave as users expect (equals → entire day range, inRange → start/end of days). - Complex AND/OR and multi-condition filters are converted into combined SQL WHERE/HAVING expressions; set filters become IN clauses. - Filter inputs sync immediately to chart state and ownState, reset pagination to the first page when filtering, and avoid applying AG Grid WHERE filters to the totals query so totals remain correct. - Improved filter UX: the code detects which filter input is active (first/second) so popovers and focus can be preserved, and client-side date filter predicates are no-ops when server-side filtering is used. - Validation and escaping added for column names and values to prevent injection; invalid or overly long column names are ignored. - Extensive unit tests added for filter conversion, initial filter state selection, and filter state management. ### Impact `✅ Filters apply to full dataset (not just current page)` `✅ Accurate totals unaffected by column-level filters` `✅ Clearer date filter behavior and consistent metric/dimension filtering` <details> <summary><strong>💡 Usage Guide</strong></summary> ### 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: <pre> <code>@codeant-ai ask: Your question here</code> </pre> This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code. #### Example <pre> <code>@codeant-ai ask: Can you suggest a safer alternative to storing this secret?</code> </pre> ### 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: <pre> <code>@codeant-ai: Your feedback here</code> </pre> This helps CodeAnt AI learn and adapt to your team's coding style and standards. #### Example <pre> <code>@codeant-ai: Do not flag unused imports.</code> </pre> ### Retrigger review Ask CodeAnt AI to review the PR again, by typing: <pre> <code>@codeant-ai: review</code> </pre> ### Check Your Repository Health To analyze the health of your code repository, visit our dashboard at [https://app.codeant.ai](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. </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: [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]
