You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add metric category filtering for EXPLAIN ANALYZE (#21160)
## Summary
- Adds `MetricCategory` enum (`Rows`, `Bytes`, `Timing`) classifying
metrics by what they measure and, critically, their **determinism**:
rows/bytes are deterministic given the same plan+data; timing varies
across runs.
- Each `Metric` can now declare its category via
`MetricBuilder::with_category()`. Well-known builder methods
(`output_rows`, `elapsed_compute`, `output_bytes`, etc.) set the
category automatically. Custom counters/gauges default to "always
included".
- New session config `datafusion.explain.analyze_categories` accepts
`all` (default), `none`, or comma-separated `rows`, `bytes`, `timing`.
- This is orthogonal to the existing `analyze_level` (summary/dev) which
controls verbosity.
## Motivation
Running `EXPLAIN ANALYZE` in `.slt` tests currently requires liberal use
of `<slt:ignore>` for every non-deterministic timing metric. With this
change, a test can simply:
```sql
SET datafusion.explain.analyze_categories = 'rows';
EXPLAIN ANALYZE SELECT ...;
-- output contains only row-count metrics — fully deterministic, no <slt:ignore> needed
```
In particular, for dynamic filters we have relatively complex
integration tests that exist mostly to assert the plan shapes and state
of the dynamic filters after the plan has been executed. For example
#21059. With this change I think most of those can be moved to SLT
tests. I've also wanted to e.g. make assertions about pruning
effectiveness without having timing information included.
## Test plan
- [x] New Rust integration test `explain_analyze_categories` covering
all combos (rows, none, all, rows+bytes)
- [x] New `.slt` tests in `explain_analyze.slt` for `rows`, `none`,
`rows,bytes`, and `rows` with dev level
- [x] Existing `explain_analyze` integration tests pass (24/24)
- [x] Proto roundtrip test updated and passing
- [x] `information_schema` slt updated for new config entry
- [x] Full `core_integration` suite passes (918 tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments