Skip to content

Data Quality undercounts table assets and inflates coverage by using FQN cardinality #37506

Closed

Description

@TeddyCr

Bug

Data Quality undercounts the total number of tables, causing its asset total and coverage denominator to disagree with Data Insights.

User-reported observations for the same catalog:

  • Data Insights → Total Data Assets: 10,233 tables (correct).
  • Data Quality → Summary → Data Assets Coverage: 10,206 tables.
  • Data Quality → Test Cases: the same 10,206 denominator is used for the displayed 3.95% coverage.
  • Replacing the total-count aggregation with value_count returns 10,233, according to the reported investigation.

The total is understated by 27 tables, which also inflates the coverage percentage. The expected denominator is the exact number of matching table documents.

Root cause, grounded in code

fetchTotalEntityCount queries the table index using:

bucketName=count:aggType=cardinality:field=fullyQualifiedName

This estimates the number of distinct indexed fully qualified names (FQNs—the full service/database/schema/table name), rather than counting tables.

Both affected views consume this helper:

Two effects explain the reported discrepancy:

  1. Case normalization: 1 table. The table index mapping applies lowercase_normalizer to fullyQualifiedName; the normalizer definition lowercases values. The reported pair of Snowflake tables whose names differ only by case therefore contributes one distinct indexed name instead of two table documents.
  2. Approximate cardinality: 26 tables. The Elasticsearch cardinality builder sets only the field, with no precision override. Elasticsearch documents cardinality as approximate, with a default precision threshold of 3,000. The reported remaining difference is estimation error at this catalog size. The threshold is an accuracy/memory tradeoff, not a guarantee of exactness below 3,000.

Thus the reported breakdown is 10,233 documents → 10,232 distinct normalized names → 10,206 estimated distinct names. The numerical breakdown and successful user-index query are supplied by the reporter; the code inspection independently confirms the mechanisms and shared callers.

This aggregation was introduced with the DQ dashboard in PR #18146: original implementation at the merge commit. The total-count expression remains unchanged.

Proposed fix

Change the aggregation type in fetchTotalEntityCount:

- aggregationQuery: `bucketName=count:aggType=cardinality:field=fullyQualifiedName`,
+ aggregationQuery: `bucketName=count:aggType=value_count:field=fullyQualifiedName`,

value_count counts values without deduplicating them. With one populated, single-valued FQN per table document, this gives the exact table count, including case-colliding names, without cardinality estimation. It preserves the bucket name, field, filters, domain scope, and response consumed by both views.

The backend already implements this aggregation for Elasticsearch and OpenSearch.

Scope this change to the table denominator. fetchEntityCoveredWithDQ counts distinct assets across test-case documents, where multiple tests can belong to one table; replacing that aggregation with a value count would count tests rather than assets.

Reproduction and acceptance criteria

  1. Compare the three views with equivalent catalog scope and filters.
  2. On the affected catalog, confirm the existing cardinality query returns 10,206 and the proposed value-count query returns 10,233.
  3. Confirm Summary and Test Cases both use 10,233 after the fix and recalculate coverage using that denominator.
  4. Add regression coverage for two distinct table documents with case-only FQN differences and for a catalog above 3,000 tables; verify exact totals on Elasticsearch and OpenSearch.
  5. Update the API helper tests to expect value_count, retaining filter/domain coverage. Confirm the field remains populated and single-valued for counted table documents.

User deployment version was not supplied. This issue records the diagnosis and proposed fix; no implementation or user-environment test was performed while filing it.

Source rationale: Repository code and the introducing PR establish the actual request, mapping, consumers, and history. Elasticsearch's implementation documentation establishes aggregation semantics and precision defaults. user-specific counts are explicitly attributed to the report.

Activity

  1. self-assigned this
    on Nov 10, 2026
  2. added theissue type on Nov 10, 2026
  3. moved this to Release Backlog 🚧 in Shippingon Nov 10, 2026
  4. moved this from Release Backlog 🚧 to In Progress 🏗️ in Shippingon Nov 10, 2026
  5. moved this from In Progress 🏗️ to Done ✅ in Shippingon Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions