Skip to content

Fix SQL check tolerance for negative expected values#69736

Open
steveahnahn wants to merge 1 commit into
apache:mainfrom
steveahnahn:fix-sql-check-tolerance-negative-thresholds
Open

Fix SQL check tolerance for negative expected values#69736
steveahnahn wants to merge 1 commit into
apache:mainfrom
steveahnahn:fix-sql-check-tolerance-negative-thresholds

Conversation

@steveahnahn

Copy link
Copy Markdown
Contributor

Split out of #69675 per review feedback there (the change is unrelated to that PR's asset-event topic).

SQLColumnCheckOperator / SQLTableCheckOperator tolerance scaled check bounds by (1 ± tolerance), which moves the bound the wrong way when the expected value is negative: with geq_to=-1000 and tolerance=0.1 the bound became -900, so a record equal to the threshold (-1000) failed the check, and equal_to=-100 produced an empty acceptance band ([-90, -110]). The fix computes the margin from the magnitude (abs(expected) * tolerance), so tolerance always widens the bound outward. Bounds for positive expected values are unchanged.

Adds parametrized regression tests covering negative thresholds for all five comparators, unchanged positive-threshold behavior, and the no-tolerance exact path.

related: #69675


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5)

Generated-by: Claude Code (Fable 5) following the guidelines

@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 11, 2026
@steveahnahn
steveahnahn force-pushed the fix-sql-check-tolerance-negative-thresholds branch from 409be8e to 35e4541 Compare July 11, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants