Skip to content

Logic for rules validation - #288

Merged
RishabGulati7 merged 4 commits into
mainfrom
TLE-1159
Feb 13, 2026
Merged

Logic for rules validation#288
RishabGulati7 merged 4 commits into
mainfrom
TLE-1159

Conversation

@RishabGulati7

Copy link
Copy Markdown
Collaborator

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:

  • product_id
  • table_name
  • rule
  • rule_type

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@RishabGulati7
RishabGulati7 requested a review from a team as a code owner February 10, 2026 21:02
@codecov

codecov Bot commented Feb 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.44%. Comparing base (11f52a9) to head (0f91260).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

saiboddu759
saiboddu759 previously approved these changes Feb 12, 2026

@saiboddu759 saiboddu759 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in SparkExpectations and 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.

Comment thread spark_expectations/core/expectations.py
Comment thread spark_expectations/core/expectations.py
Comment thread spark_expectations/core/expectations.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@AmaniG77 AmaniG77 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ravishikhar ravishikhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, Thanks

@RishabGulati7
RishabGulati7 merged commit 0259bc1 into main Feb 13, 2026
6 checks passed
@RishabGulati7
RishabGulati7 deleted the TLE-1159 branch February 13, 2026 22:09
@RishabGulati7 RishabGulati7 linked an issue Mar 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validation on row_dq expectations

5 participants