Skip to content

Unexpected_rows_expectation doesn't give element_count in the validation results #11045

Open
@ayaan-ak-1

Description

@ayaan-ak-1

Is your feature request related to a problem? Please describe.
When running a validation for unexpected_rows_expectation it is just giving unexpected_rows_list and the observed_value ( which has unexpected row count ). But it does not have element_count which can tell how many rows it evaluated.

Solution
Can there be any way i can see other values (like element_count) in the validation results

Additional context

In the UnexpectedRowsExpectation class (great_expectations/expectations/core/unexpected_rows_expectation.py)
the _validate function returns very few metrics as shown below

@override
def _validate(
    self,
    metrics: dict,
    runtime_configuration: dict | None = None,
    execution_engine: ExecutionEngine | None = None,
) -> Union[ExpectationValidationResult, dict]:
    metric_value = metrics["unexpected_rows_query.table"]
    unexpected_row_count = metrics["unexpected_rows_query.row_count"]
    observed_value = f"{unexpected_row_count} unexpected "
    if unexpected_row_count == 1:
        observed_value += "row"
    else:
        observed_value += "rows"
    return {
        "success": unexpected_row_count == 0,
        "result": {
            "observed_value": observed_value,
            "details": {"unexpected_rows": metric_value},
        },
    }

so can we update this to return even more important information in the results

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions