Skip to content

[2.0] Fixes #37896: Data Insights categorical axis lists only the categories its chart counts (#37897) - #37898

Merged
pmbrull merged 1 commit into
2.0from
pmbrull/2.0-di-scoped-terms-axis
Nov 16, 2026
Merged

pmbrull merged 1 commit into
2.0from
pmbrull/2.0-di-scoped-terms-axis

Conversation

@pmbrull

@pmbrull pmbrull commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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's filter matches. A breakdown scoped to tables no longer lists every category held by other asset types at 0. The PR on main gives the rules, design, scope of change and decision record, and they are the same here.

2.0 adaptation:

  • DataInsightSystemChartRepository.combineFilters is package-private on 2.0.
  • The real-engine case for a built-in chart read for one service therefore passes the service filter directly.
  • That is what combineFilters(null, serviceFilter) returns for a metric that declares no filter.

Type of change:

  • Bug fix

Tests:

  • Red/green, the self-review and the use cases are on Fixes #37896: Data Insights categorical axis lists only the categories its chart counts #37897.
  • On 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:apply and the decision record check are clean.
  • Not run locally: openmetadata-integration-tests and the UI.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have added tests that prove my fix is effective or that my feature works.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The filter change appears sound, but the explicit Java requirements must be satisfied before merging.

Findings

  1. P2 Helpers miss Java requirements ▶

Summary

Categorical Data Insights charts now draw categories from documents matched by at least one metric’s filter.

  • Categorical Data Insights charts list only categories their metrics count.

Intentional behavior recorded by pmbrull: categories outside every metric’s filter disappear, including scopes that match no documents. Formula conditions in q= still preserve zero-valued categories.

Reviews (1) · Last reviewed commit: "fix(data-insights): draw a categorical a..." · Reviewed by Greptile

…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>
@pmbrull
pmbrull requested a review from a team as a code owner November 16, 2026 12:41
@pmbrull
pmbrull requested review from harshach and removed request for a team November 16, 2026 12:41
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Filtering 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.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +99 to +104
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")));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

@pmbrull
pmbrull merged commit 5a519e5 into 2.0 Nov 16, 2026
65 of 75 checks passed
@pmbrull
pmbrull deleted the pmbrull/2.0-di-scoped-terms-axis branch November 16, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant