Repository navigation
[2.0] Fixes #37896: Data Insights categorical axis lists only the categories its chart counts (#37897) - #37898
Conversation
…ts chart counts
A categorical (terms) x-axis bucketed every document of the day and applied each metric's filter
only inside each bucket, so a breakdown scoped to tables listed every category held by other asset
types at 0 (an owner of dashboards only, a dashboard-only service). Those rows read as real zeros
in custom charts, pinned charts and AI chat answers ("45 owners hold tables" where 17 do).
The request now queries the chart's population, the documents at least one metric's filter
matches, and a categorical chart's groupBy draws its groups from it too. A category the chart
counts keeps its bucket: a term's own q= never narrows the population, and with several metrics
one metric still reads 0 where only another counts. A metric without a filter keeps the request
wide, and @timestamp charts are untouched. Built-in categorical charts read for one service or
domain are narrowed as well, because the repository merges that filter into every metric.
ADR:2026-11-16-a-categorical-axis-lists-only-the-categories-its-chart-counts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
Code Review ✅ Approved 🟡 Medium riskFiltering categorical chart searches to metric-matching documents may omit previously shown zero-value categories from scoped Data Insights charts. Scopes categorical Data Insights axes to the documents that at least one metric's filter matches, so a tables-only breakdown no longer lists zero-count categories from other asset types. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| private static Query anyOf(List<String> filters) { | ||
| List<Query> clauses = | ||
| filters.stream().map(ElasticSearchDynamicChartAggregatorInterface::queryFromJson).toList(); | ||
| return clauses.size() == 1 | ||
| ? clauses.get(0) | ||
| : Query.of(q -> q.bool(b -> b.should(clauses).minimumShouldMatch("1"))); |
There was a problem hiding this comment.
Helpers miss Java requirements
The new helpers violate three directives in CLAUDE.md: use getFirst() instead of get(0), mark unchanged locals and parameters final, and share logic that does not depend on the engine. Both engines repeat this pattern.
Update anyOf to follow the collection and final rules, and move the duplicated hasCategoricalAxis check into a shared helper. These repository requirements must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Describe your changes:
Fixes #37896
Cherry-pick of #37897 to
2.0. A categorical Data Insights axis now lists only the categories its chart counts: for a terms x-axis, the request queries the documents that at least one metric'sfiltermatches. A breakdown scoped to tables no longer lists every category held by other asset types at 0. The PR onmaingives the rules, design, scope of change and decision record, and they are the same here.2.0 adaptation:
DataInsightSystemChartRepository.combineFiltersis package-private on2.0.combineFilters(null, serviceFilter)returns for a metric that declares no filter.Type of change:
Tests:
2.0, at this commit: 82 run, 0 failures. That covers the line chart aggregators (unit and real engine, OpenSearch 3.4 and Elasticsearch 9.3), chart scope, the chart-scope SQL migration, type coverage, KPI and metric filter tests.mvn spotless:applyand the decision record check are clean.openmetadata-integration-testsand the UI.Checklist:
Fixes <issue-number>: <short explanation>🤖 Generated with Claude Code
The filter change appears sound, but the explicit Java requirements must be satisfied before merging.
Findings
Summary
Categorical Data Insights charts now draw categories from documents matched by at least one metric’s filter.
Intentional behavior recorded by
pmbrull: categories outside every metric’s filter disappear, including scopes that match no documents. Formula conditions inq=still preserve zero-valued categories.Reviews (1) · Last reviewed commit: "fix(data-insights): draw a categorical a..." · Reviewed by Greptile