Logic for rules validation - #288
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #288 +/- ##
=======================================
Coverage 98.43% 98.44%
=======================================
Files 27 27
Lines 3255 3274 +19
=======================================
+ Hits 3204 3223 +19
Misses 51 51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
RishabGulati7
requested review from
asingamaneni,
ravishikhar and
saiboddu759
February 11, 2026 01:29
Contributor
There was a problem hiding this comment.
Pull request overview
Adds validation to ensure rules_df passed into SparkExpectations includes required columns and that required fields are non-null / non-empty, with accompanying unit tests.
Changes:
- Introduces
_validate_rules()inSparkExpectationsand calls it during initialization. - Adds helper checks for missing columns and NULL/empty values in required columns.
- Adds unit tests + fixtures covering empty DF, missing columns, NULL/empty values, and error message formatting.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
spark_expectations/core/expectations.py |
Adds rules DataFrame validation and wires it into __post_init__. |
tests/unit/core/test_expectations.py |
Adds unit tests validating the new rules validation behavior. |
tests/unit/core/conftest.py |
Adds fixtures for missing-column / NULL / empty-string rules DataFrame scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Currently there is no validation for the rules_df that is provided to SE. This PR adds a function that checks whether the following keys are present in the rules_df and also if they have null values:
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: