rusackas opened a new pull request, #40617: URL: https://github.com/apache/superset/pull/40617
### SUMMARY This is a **test-only PR** opened as a TDD-style validation of issue #30330. #30330 reports that the Histogram chart fails with a database error when a "filter by metric" (HAVING clause) is added. rusackas confirmed the bug is still live on master. **Root cause:** `buildQuery.ts` unconditionally sets `metrics: undefined`. Any HAVING-clause `adhoc_filter` therefore produces SQL with a `HAVING` clause but no aggregated metric or `GROUP BY` — invalid SQL that Druid (and most databases) reject. This PR adds a `buildQuery` test with three cases: 1. **`should build query with column and no metrics`** — baseline: histogram sends no metrics (passes today). 2. **`should include groupby columns in query columns`** — groupby passthrough (passes today). 3. **`Regression for #30330`** — asserts that when a HAVING `adhoc_filter` is present, `query.metrics` is defined and non-empty. **Fails today** (metrics is always `undefined`). ### How to interpret CI - **CI red** → bug is live. Fix target: `buildQuery.ts` — detect HAVING `adhoc_filters` and preserve or synthesise a `COUNT(*)` metric so the HAVING clause has an aggregated value to filter on. - **CI green** → bug fixed; merge closes #30330 and locks in the regression guard. ### TESTING INSTRUCTIONS ```bash cd superset-frontend npm run test -- plugins/plugin-chart-echarts/test/Histogram/buildQuery.test.ts --no-coverage ``` ### ADDITIONAL INFORMATION - [x] Has associated issue: closes #30330 - [ ] Required feature flags: N/A - [ ] Changes UI: No - [ ] Includes DB Migration: No - [ ] Introduces new feature or API: No 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
