[bug] Fix filter-pushdown correctness bugs in DNF/set visitors #87
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 413 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.361
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #87"
general
weight: 0.35
timkpaine
Description
The DNF (
dnf_visitor) and valid-value (set_visitor) conversions turn a Polars predicate into a filter that is applied before data is read. That filter may keep extra rows, since the full predicate runs afterwards, but it must never drop a row the predicate keeps. Several conversions broke this rule, soscan_deltaandpushdown_combinecould return fewer rows than the predicate selects:set_visitorhad the same problem: NOT now excludes values only when the inner result is exact.eq_missing/ne_missingwere mapped to=/!=.ne_missing(v)keeps nulls, andeq_missing(None)/ne_missing(None)meanis null/is not null.is_in(..., nulls_equal=True): a null-matchingis_innow emitsin OR is null, and its negation is no longer pushed down.pl.col("a").cast(pl.Int8, wrap_numerical=True) == 1pusheda == 1and droppeda == 257. A cast is now looked through only when the schema shows it keeps values and order: identity, integer widening, or decimal widening at the same scale. Dtype identity is strict, soDatetime("us") -> Datetime("ms")does not count.when(P).then(T).otherwise(F)dropped rows wherePis null. Polars takes theotherwisebranch for those rows, so they are now included.str.containsdefaults to a regex search, but the pattern was escaped as a literal. Onlyliteral=Truepatterns are escaped now.lit(1) < col) are now flipped instead of failing to convert, and horizontal OR no longer drops unconvertible branches.Each fix has a regression test that fails on
main. Several tests check the pushed filter against the real predicate on data containing nulls.Things to note for review:
pushdown_combine, partition pruning,pushdown_unpivot) now refuse every column cast. The result is still correct but may prune less.is nullclauses, so the expected outputs of several existing ternary tests changed.range_visitorstill usesextract_column_name, which looks through lossy casts such asDatetime("us") -> Datetime("ms"). It intentionally looks throughDatetime -> Datefor date-range pruning, so a correct fix needs to widen bounds for truncating casts. I'd rather do that in a separate PR.Type of Change
Checklist
make lint):make lint-pypassed. No Rust or docs changes, solint-rsandlint-docswere not run.make test):make test-pypassed (2186 passed, 73 skipped, 6 xfailed). No Rust changes, sotest-rswas not run.