[BUGFIX] ExpectColumnValuesToBeOfType returns full map-format result for all backends#11868
Open
EshwarCVS wants to merge 7 commits into
Open
[BUGFIX] ExpectColumnValuesToBeOfType returns full map-format result for all backends#11868EshwarCVS wants to merge 7 commits into
EshwarCVS wants to merge 7 commits into
Conversation
…ations#11206) Pydantic coerces False/True to "False"/"True" when str appears before Literal[False]/Literal[True] in a Union. Fix _get_annotation_type to sort bool-like types to the front of generated Union types, so index_col=False (and similar bool flags) are preserved correctly. https://claude.ai/code/session_01ETHG72BuUQaQWWdtWDcQJM
for more information, see https://pre-commit.ci
…s full map-format result
For non-map backends (Pandas non-object dtype, SQLAlchemy, Spark), the
expectation previously returned only {"observed_value": ...}. It now returns
the complete ColumnMapExpectation result structure (element_count,
unexpected_count, unexpected_percent, missing_count, etc.) alongside
observed_value, matching the documented output schema.
Also confirmed great-expectations#11026 (accented chars in row_conditions) is already resolved
via alphas8bit in legacy_row_conditions.py.
https://claude.ai/code/session_014PRzTm8HD61UpoyPvE3ciH
👷 Deploy request for niobium-lead-7998 pending review.Visit the deploys page to approve it
|
Contributor
Author
Member
|
thanks for the PR @EshwarCVS . This expectation is unusual in that the Pandas implementation behaves as a row level check, while the Spark and SQL implementations behave as a schema level check. We'll address the gap, but haven't settled on a solution yet. I'll leave this open, but will hold off reviewing for the time being. |
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.
Summary
Fixes #11076 —
ExpectColumnValuesToBeOfTypewas returning only{"observed_value": <type>}for non-object Pandas dtypes, SQLAlchemy,and Spark backends instead of the standard
ColumnMapExpectationresultstructure documented in the expectation.
Also confirms #11026 (accented characters in
row_conditionstrings) isalready resolved via
alphas8bitinlegacy_row_conditions.py.Changes
expect_column_values_to_be_of_type.pytable.row_countandcolumn_values.nonnull.unexpected_countto
get_validation_dependenciesfor all backends so missing/nullstats are always available.
_build_map_result()helper that wraps aggregate type-checkresults through
_format_map_output, computingnonnull_countfromthe null metric and preserving
observed_value._validate()to route non-map paths through_build_map_result.test_expect_column_values_to_be_of_type.pycolumns containing nulls.
Before / After
Before:
{ "success": false, "result": { "observed_value": "StringType" } }After:
{ "success": false, "result": { "element_count": 5, "unexpected_count": 4, "unexpected_percent": 100.0, "partial_unexpected_list": [], "missing_count": 1, "missing_percent": 20.0, "unexpected_percent_total": 80.0, "unexpected_percent_nonmissing": 100.0, "observed_value": "StringType" } }