Repository navigation
[2.0] Fixes #37896: Data Insights categorical axis lists only the categories its chart counts (#37897) #37898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...ons/2026-11-16-a-categorical-axis-lists-only-the-categories-its-chart-counts.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # A categorical Data Insights axis lists only the categories its chart counts | ||
|
|
||
| - **Status:** Accepted | ||
| - **Revisions:** v1 2026-11-16 (initial) | ||
| - **Deciders:** pmbrull | ||
| - **Guard:** `OpenSearchCategoricalAxisRealEngineTest` and `ElasticSearchCategoricalAxisRealEngineTest` (`theAxisHoldsExactlyTheServicesTheChartCounts`, `aServiceTheChartCountsKeepsItsBucketWhenTheMetricFindsNothingThere`, `aMetricReportsZeroForAServiceOnlyAnotherMetricCounts`, `aGroupedChartListsOnlyTheGroupsItsMetricCounts`, `aBuiltInChartReadForOneServiceListsOnlyThatService`); `OpenSearchLineChartAggregatorTest` and `ElasticSearchLineChartAggregatorTest` (`aFilteredCategoricalChartQueriesOnlyTheDocumentsItCounts`, `metricsThatDisagreeQueryTheDocumentsEitherCounts`, `aMetricWithoutAFilterKeepsTheRequestWide`, `aTimestampAxisIsNeitherRankedNorNarrowed`); `DataInsightMetricFilterTest` (`aMetricThatCountsEveryDocumentLeavesNoPopulation`) | ||
| - **Related:** #32115, open-metadata/ai-platform#2269 | ||
|
|
||
| ## Context | ||
|
|
||
| A categorical (terms) x-axis bucketed every document in range and applied each metric's `filter` | ||
| only inside the bucket. #32115 ranked the axis by that filter, so the categories a chart counts are | ||
| picked first. It kept the request wide so that a category the filter empties still reports 0. | ||
|
|
||
| When the filter is the chart's scope, those zero rows are categories held only outside the scope. | ||
| For example, a "tables per owner" chart listed every owner of a dashboard at 0. On one instance, | ||
| 28 of its 45 rows were such zeros, and an AI chat answer built on the chart said 45 owners hold | ||
| tables when 17 do. These zeros never formed a complete list either: | ||
| - they appeared only while fewer than 100 categories held matching documents; | ||
| - which ones appeared depended on how the engine broke ties; | ||
| - a category that no document of the day holds never appeared at all. | ||
|
|
||
| ## Decision | ||
|
|
||
| For a categorical x-axis, the request queries the chart's population: the documents that at least | ||
| one metric's `filter` matches (`DataInsightMetricFilter.populationFilters`). That is one `should` | ||
| clause per distinct filter, with `minimum_should_match: 1`, combined with the snapshot range when | ||
| the request is not live. | ||
|
|
||
| - **A category the chart counts keeps its bucket.** A term's own `q=` never narrows the population, | ||
| so a real 0 stays. With several metrics, a metric reads 0 for a category that only another metric | ||
| counts. | ||
| - **A `groupBy` on a categorical chart draws its groups from the same population.** | ||
| - **A metric with no filter counts every document**, so the request stays wide. An unreadable filter | ||
| counts as no filter, as before. | ||
| - **An `@timestamp` axis stays wide, groups included.** A date histogram has no top N to align, and | ||
| narrowing it would move the first and last days it plots. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Breakdowns with metric filters stop showing zero bars for categories outside their scope. That | ||
| covers custom charts, AI chat charts and Collate's pinned-chart refresh. | ||
| - **Built-in categorical charts are narrowed when read for a scope.** They declare no filter of | ||
| their own, but `DataInsightSystemChartRepository` merges the caller's filter and the navbar domain | ||
| into every metric. So a built-in chart read for one service or domain no longer lists other | ||
| services, tag groups or entity types at 0. That applies to the service page's PII and tier | ||
| distributions, and to the total data assets chart under a domain. | ||
| - **A scope that matches no document returns no buckets**, instead of a breakdown of zeros. | ||
| - **A filter can carry a condition rather than a scope.** Collate's chart builder in function mode | ||
| puts its advanced filter in `metrics[i].filter`. In that case a category where nothing matches the | ||
| condition gets no bucket. To keep its 0, use formula mode: the scope goes in `filter` and the | ||
| condition in the formula's `q=`. | ||
| - A complete list of categories, such as every tier whether held or not, needs an explicit list of | ||
| values. A terms axis cannot provide one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new helpers violate three directives in
CLAUDE.md: usegetFirst()instead ofget(0), mark unchanged locals and parametersfinal, and share logic that does not depend on the engine. Both engines repeat this pattern.Update
anyOfto follow the collection andfinalrules, and move the duplicatedhasCategoricalAxischeck 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!