Repository navigation
feat: add NOT, IS NULL and IS NOT NULL expressions - #14
Open
createcentury wants to merge 1 commit into
Open
createcentury wants to merge 1 commit into
createcentury wants to merge 1 commit into
Conversation
Add three boolean-returning expressions to the random expression generator so that generated predicates exercise NULL semantics: - NOT <bool> - <any> IS NULL - <any> IS NOT NULL Integration snapshots are updated because the new BaseExpr variants shift the deterministic generation sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Summary
This PR adds three boolean-returning expressions to the random expression generator, following the existing
BaseExpr/BaseExprWithInfopattern:ExprNOT <bool>[SameAsOutput](Boolean)Expr::Not<any> IS NULL[OneOf(all available types)]Expr::IsNull<any> IS NOT NULL[OneOf(all available types)]Expr::IsNotNullGenerated data already contains NULLs, so these expressions help predicates exercise NULL semantics, which is where the TLP oracles are most useful. The implementation keeps the current best-effort typing approach and adds no validity constraints.
Changes
expr_def.rs: addNot,IsNull,IsNotNulltoBaseExprandto_impl()expr_impl.rs: addNotExpr,IsNullExpr,IsNotNullExpr, update the coverage checklist, and add unit tests for the return types and SQL unparsing (NOT v1,v1 IS NULL,v1 IS NOT NULL)tests/integration_test.rs: snapshots updated withcargo insta test --accept. The new enum variants shift the deterministic generation sequence, so the snapshot diff is expected.Example generated queries
Testing
cargo test: all tests passNoCrash,NestedQueries,TlpWhere,TlpHaving),seed = 7, 20 rounds × 50 queries, compared againstmainwith the same config:mainAll oracle failures in both runs are the existing "mixed outcomes" kind discussed in #6. The PR does not introduce any new failure category.
The single non-whitelisted error happens on both branches and is unrelated to this change. It comes from the existing
NATURAL JOIN ... ONwhitelist entry: the DataFusion 54 parser error now ends withat Line: X, Column: Y, so theContains("...found: ON\")")pattern no longer matches. I'm happy to send a small follow-up PR for that.Thanks for reviewing!