Skip to content

Incomplete rendering of results when unexpected_index_column_names is provided #11933

Description

@NathanJM

Hi - apologies I was away on leave when you reached out. I don't have a screenshot, but the error should be easy to recreate. The conditions that lead to the error:

  1. Have an expectation / expectation suite validation result object that was created with result_format = COMPLETE
  2. Have specified unexpected_index_column_names in the result_format

Under these conditions, the following code branch is executed within render/util.py:_convert_unexpected_indices_to_df() , which is invoked by build_count_and_index_table():

Starting on line 414:
if unexpected_index_column_names:
# if we have defined unexpected_index_column_names for ID/PK
unexpected_index_df: pd.DataFrame = pd.DataFrame(unexpected_index_list, dtype="string")
unexpected_index_df = unexpected_index_df.fillna(value="null")
first_unexpected_index = unexpected_index_list[0]
if isinstance(first_unexpected_index, dict):
domain_column_name_list = list(
set(first_unexpected_index.keys()).difference(set(unexpected_index_column_names))
)

the problem is that for all scenarios I tested with, this results in domain_column_name_list being an empty list, [] because there is no difference between first_unexpected_index_keys() and unexpected_index_column_names.

later on, line 448 tries to execute:
all_unexpected_indices: pd.DataFrame = unexpected_index_df.groupby(domain_column_name_list).agg(
_agg_func
)

This throws an exception, because domain_column_name_list is empty, and further rendering steps are aborted.

Originally posted by @NathanJM in #10427

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions