[BUGFIX] Fix crash rendering results with unexpected_index_column_names and no domain column#11943
Open
Bharath-970 wants to merge 1 commit into
Conversation
…es and no domain column
_convert_unexpected_indices_to_df computes domain_column_name_list as
whatever keys of an unexpected_index_list entry aren't in
unexpected_index_column_names. When every key IS an ID/PK column (no
separate domain/value column present -- e.g. result_format=COMPLETE with
unexpected_index_column_names covering all tracked keys), that list is
empty and pandas.DataFrame.groupby([]) raises:
ValueError: No group keys passed!
aborting Data Docs rendering for the affected result.
With no domain column to group by, each unexpected row already stands on
its own -- there's nothing to merge across rows. Skip the groupby/agg in
that case and wrap each row's values in a single-item list directly,
matching the same output shape .groupby().agg() would otherwise produce.
Added a regression test exercising the previously-crashing input shape;
confirmed as a true guard (fails without the fix, passes with it). Full
tests/render/ suite: 168 passed.
Closes fivetran#11933.
👷 Deploy request for niobium-lead-7998 pending review.Visit the deploys page to approve it
|
Author
|
Opened against the wrong repo by mistake — this PR targets a fork (fivetran/great_expectations), not upstream. Closing and reopening at great-expectations/great_expectations. |
Author
|
Apologies for the churn — I incorrectly assumed fivetran/great_expectations was a fork rather than the actual current home of this project (renamed/transferred from great-expectations/great_expectations, with GitHub auto-redirecting). Reopening this one; closed the accidental duplicate (#11948). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[BUGFIX]ruff format+ruff checkon the changed files (clean)Closes #11933.
Problem
When
result_format=COMPLETEandunexpected_index_column_namesis specified, but no separate domain/value column is tracked alongside the ID/PK columns, rendering the validation result for Data Docs crashes:Root cause
_convert_unexpected_indices_to_df(great_expectations/render/util.py) computesdomain_column_name_listas whatever keys of anunexpected_index_listentry are not inunexpected_index_column_names. When every key in the dict is an ID/PK column -- i.e. there's no separate domain column present -- that list ends up empty, andpandas.DataFrame.groupby([])raises.Fix
Branch on whether there's actually a domain column to group by:
With no domain column, every unexpected row is already its own group of one -- there's nothing to merge across rows, so this skips straight to the equivalent output shape instead of crashing. The existing grouped path (domain column present) is untouched.
Test
Added
test_convert_unexpected_indices_to_df_no_domain_columnintests/render/test_util.py, directly exercising the previously-crashing input shape (matches the existing test style in that file).Confirmed as a true regression guard: reverting the fix reproduces the exact original
ValueError: No group keys passed!; restoring it passes.Verification
_convert_unexpected_indices_to_dftests/render/test_util.py: 22 passedtests/render/: 168 passed, 2 xfailed (pre-existing, unrelated)ruff check/ruff format --check: clean