Skip to content

[BUGFIX] Render id/pk-only unexpected indices instead of raising (fixes #11933)#11935

Open
anxkhn wants to merge 1 commit into
fivetran:developfrom
anxkhn:loop/great-expectations__001
Open

[BUGFIX] Render id/pk-only unexpected indices instead of raising (fixes #11933)#11935
anxkhn wants to merge 1 commit into
fivetran:developfrom
anxkhn:loop/great-expectations__001

Conversation

@anxkhn

@anxkhn anxkhn commented Jun 30, 2026

Copy link
Copy Markdown

Fixes #11933.

Description

When a COMPLETE validation result provides unexpected_index_column_names and the
unexpected-index records carry only the id/pk columns, Data Docs rendering
aborts with ValueError: No group keys passed!.

render/util.py::_convert_unexpected_indices_to_df derives the domain column(s)
to group on as set(record.keys()) - set(unexpected_index_column_names). When the
records hold only the pk columns, that set difference is empty, so the code calls
unexpected_index_df.groupby([]), which raises. This happens on the Spark/SQL
paths and whenever exclude_unexpected_values=True (the metric builders emit
records with only the pk columns). The exception propagates out of the unexpected
table renderer and breaks the result page.

This change handles the empty-domain case: instead of groupby([]), it aggregates
every record into a single row (groupby(by=lambda _: "")) and then flows through
the unchanged count / index-truncation / head() steps, so the count+index table
renders. The normal domain-column path is byte-for-byte unchanged.

Tests

tests/render/test_util.py gains two tests that fail-first with
ValueError: No group keys passed! on the pre-fix code and pass after the change:

  • test_convert_unexpected_indices_to_df_only_id_pk_columns
  • test_build_count_and_index_table_only_id_pk_columns

The module already sets pytestmark = pytest.mark.unit. tests/render/ runs
169 passed, 2 xfailed (pre-existing).

Open question

The no-domain row has no distinct unexpected value, so the value cell renders
"EMPTY" (the caller's existing unexpected_value == "" branch). That reuses
existing prior art (test_build_count_and_index_table_with_empty_string) and is
the minimal, consistent choice, but if you'd prefer a different label here (blank,
or something like "(all rows)") I'm happy to adjust.


  • Description of PR changes above includes a link to an existing GitHub issue
  • PR title is prefixed with one of: [BUGFIX], [FEATURE], [DOCS], [MAINTENANCE], [CONTRIB], [MINORBUMP]
  • Code is linted - run invoke lint (uses ruff format + ruff check)
  • Appropriate tests and docs have been updated

@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

👷 Deploy request for niobium-lead-7998 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 378edd4

@anxkhn

anxkhn commented Jun 30, 2026

Copy link
Copy Markdown
Author

@cla-bot check

fivetran#11933)

When a COMPLETE result provides unexpected_index_column_names and the unexpected
index records carry only the id/pk columns (Spark/SQL paths, and when
exclude_unexpected_values=True), _convert_unexpected_indices_to_df computed an
empty domain_column_name_list and called unexpected_index_df.groupby([]), which
raises ValueError: No group keys passed! and aborted Data Docs rendering.

Aggregate all records into a single row in that case so the count/index table
renders. The domain-column path is unchanged.
@anxkhn anxkhn force-pushed the loop/great-expectations__001 branch from c658c0e to 378edd4 Compare July 1, 2026 07:40
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.

Incomplete rendering of results when unexpected_index_column_names is provided

1 participant