DamianPendrak opened a new pull request, #42199: URL: https://github.com/apache/superset/pull/42199
### SUMMARY Fixes #38913. A Deck.gl Screen Grid chart whose **Weight** is a **Custom SQL** expression that is *not* an aggregate - e.g. `GREATEST(confirmed, predicted)` - produces a grouped query that selects an expression which is neither grouped nor aggregated: ```sql SELECT longitude, latitude, GREATEST(confirmed, predicted) AS "..." FROM incidents WHERE longitude IS NOT NULL AND latitude IS NOT NULL GROUP BY longitude, latitude ... -- ERROR: column "confirmed" must appear in the GROUP BY clause -- or be used in an aggregate function ``` Rather than silently auto-wrapping in a guessed aggregate - which would invent semantics and risk returning wrong numbers - this raises a clear, actionable validation error: ``` The Custom SQL metric "GREATEST(confirmed, predicted)" is not an aggregate and can't be combined with a GROUP BY. Wrap it in an aggregate function, e.g. MAX(GREATEST(confirmed, predicted)). ``` ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> After: <img width="1906" height="1019" alt="Screenshot 2026-07-18 at 13 21 14" src="https://github.com/user-attachments/assets/024f8804-b6b1-469c-b718-c06e373d85e0" /> ### TESTING INSTRUCTIONS From the issue: 1. Go to Charts → Create Chart 2. Select dataset (e.g., incidents) 3. Choose Deck.gl Screen Grid 4. Choose longitude & latitude 5. Weight - Custom SQL -> GREATEST(confirmed, predicted) 6. Update chart ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: [#38913](https://github.com/DamianPendrak/superset/issues/38913) - [ ] 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]
