Implement semantic rule validation for DQ rules (#1169)#1203
Conversation
|
All commits in PR should be signed ('git commit -S ...'). See https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits |
d9d5ef7 to
379a5ba
Compare
ff01ddc to
f84132b
Compare
ghanse
left a comment
There was a problem hiding this comment.
Hi @Vsatyam013 , the linked issue focuses more on validating the entire ruleset to detect the following issues:
- Detect if a duplicate rule already exists with the same run config
- Detect if a similar rule exists with different arguments (e.g. a narrower threshold of is_in_range)
Can you make some changes to address these more specifically? I think it should be simpler because the check function inputs are mostly structured. We can document any limitations when users execute checks with Spark expressions.
|
@Vsatyam013 do you plan to complete the PR, and address review comments? there was no update since 4 weeks. |
ea0c092 to
da2897a
Compare
|
Hi @mwojtyczka, sorry for the delay. I've reworked the implementation based on @ghanse's feedback. The SQL keyword validation approach has been removed and replaced with ruleset-level semantic checks, duplicate rule detection and conflicting rule detection (same function and column with different arguments). The validation is now integrated into validate_checks, save_checks, and load_checks with a configurable semantic_validation_mode parameter (warn, fail, or None). CHANGELOG changes have also been reverted.Can you review it? |
mwojtyczka
left a comment
There was a problem hiding this comment.
Thank you for the PR. I feft some comments. The engine.py does not compile due to identation issues. Please also update the PR description.
- Fix IndentationError on load_checks/save_checks so the package compiles - Use full-notation import; remove leftover marker comments and trailing whitespace in docstrings; drop backticks in docstrings per AGENTS.md - Rename module to checks_semantic_validator and classes to ChecksSemanticValidator / ChecksSemanticValidationMode - Fix unhashable-list crash in rule key by serializing arguments with json - Harden helpers against malformed checks; handle mode=None in apply() - Expose semantic_validation_mode on the public DQEngine.validate_checks - Add negative integration tests for validate_checks, load_checks and save_checks (duplicate and conflicting rules) Co-authored-by: Isaac
mwojtyczka
left a comment
There was a problem hiding this comment.
LGTM - implemented feedback and increased code coverage
Changes
Implements ruleset-level semantic validation for DQ checks (issue #1169).
Adds a
ChecksSemanticValidator(modulechecks_semantic_validator.py) that inspects a ruleset (declarative check metadata) and reports two classes of issue:is_in_rangechecks on the same column with different thresholds).Semantic validation is integrated into
validate_checks,load_checksandsave_checksvia a newsemantic_validation_modeparameter:"warn"(default)"fail"ValueErrorlisting all issues.NoneDuplicate and conflicting rules are not necessarily invalid (a duplicate is redundant; a conflict may be intentional), so the default mode only warns; use
"fail"to enforce a clean ruleset in CI/CD.Notes on the implementation:
filter, andfor_each_column; column-list comparison is order-insensitive.sql_expression) are not deeply inspected — only structured metadata is compared.Linked issues
Resolves #1169
Tests
validate_checks,load_checksandsave_checks)Documentation and Demos