Fixed issue 11963 - #12007
Conversation
👷 Deploy request for niobium-lead-7998 pending review.Visit the deploys page to approve it
|
|
Thank you for your contribution! Before we can merge this pull request, every committer needs to have signed our Contributor License Agreement (CLA). We could not find a signed CLA for: @mansibrahman03. Please sign the Individual Contributor License Agreement, or the Software Grant and Corporate Contributor License Agreement if you are contributing on behalf of your employer (see CLA.md for details). Once resolved, comment |
|
Hi @joshua-stauffer — this is my first contribution to this project. I've fixed issue #11963 by implementing a new expectation, ExpectColumnTypeToBe, that only checks a column's declared data type at the schema level. Would appreciate a review when you have time! |
…ations/expectations/core/expect_column_type_to_be.py) and added integration test file (file path: tests/integration/data_sources_and_expectations/expectations/test_expect_column_type_to_be.py). Modified great_expectations/expectations/__init__.py and great_expectations/expectations/core/__init__.py to register new expectation.
…ations/core/test_expect_column_type_to_be.py
ce6c615 to
6360959
Compare
|
@cla-bot check |
|
hey @mansibrahman03, thanks for the PR! Looks like we're missing a CLA signature for you (see docs here). Once you submit the CLA, comment |
What does this PR do?
This PR adds a new expectation, ExpectColumnTypeToBe, that checks a column's declared data type at the schema level. It works the same way across every backend — pandas, SQL databases, and Spark — and always returns a simple result of just {"observed_value": ""}, with no row-level details. It reuses the existing type-matching logic from ExpectColumnValuesToBeOfType and the table.column_types metric. Unit and integration tests were added to confirm expected behavior. This PR does not change the implementation for ExpectColumnValuesToBeOfType.
Why was this PR needed?
The existing ExpectColumnValuesToBeOfType is inconsistent across different datasets, validating at row-level for some datasets and schema-level for other datasets. Reproducing the issue confirmed this inconsistent behavior. The purpose of this PR is to include a separate ExpectColumnTypeToBe expectation that always does a schema-level check consistently everywhere, while ExpectColumnValuesToBeOfType is intended to eventually do only row-level checks.
Relevant issue number
Closes #11963
Screenshots / Recordings
Unit Tests:

Relevant Integration Test:

Does this PR meet the acceptance criteria?