amaannawab923 opened a new pull request, #38369: URL: https://github.com/apache/superset/pull/38369
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY Two issues with AG Grid Table server-side filtering: 1. **Saved filters re-injecting on re-render:** When a chart had a saved `chartState.filterModel`, it was being re-injected into `gridInitialState` on every re-render. This caused AND filter conditions to reset — applying a second filter condition would trigger a re-render that overwrote the filter model with the original saved state. Fixed by tracking which slice_ids have already applied their saved filter on initial mount, and stripping the filter model from chartState on subsequent renders. 2. **Saved metric and calculated column labels not resolved to SQL:** AG Grid filters generate WHERE/HAVING clauses using display labels (e.g. `highest_degree_earned`), but these labels aren't valid SQL when they refer to saved metrics (`COUNT(*)`) or calculated columns (`CASE WHEN ... END`). The backend rejects these as unknown columns. Fixed by building a label-to-SQL expression map from the datasource's metrics and columns, then resolving labels before sending the query. Complex expressions like CASE statements are wrapped in parentheses for valid SQL. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### 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 -- 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]
