sarutak opened a new pull request, #60636:
URL: https://github.com/apache/spark/pull/60636
### What changes were proposed in this pull request?
This is a follow-up of #60557. It fixes the test that #60557 extended. The
shape `n + r > 0 AND f + 1 > 0 AND f + 1 < 100` of `SPARK-61377: FilterExec CSE
computes an input column just before the first conjunct that reads it` in
`WholeStageCodegenSuite` relied on `InferFiltersFromConstraints` inferring
`IsNotNull(n)`, and asserted that it did. Since SPARK-61823 (#60574), the
`Filter` case of that rule does not infer a filter over a column that can fail,
and `n` is a column of a Scala UDF, so the check is no longer inferred and the
test fails on master and `branch-4.x`, as reported in #60557.
This PR writes the check instead: the shape becomes `n IS NOT NULL AND n + r
> 0 AND f + 1 > 0 AND f + 1 < 100`. The assertion that the check is inferred is
replaced with one that the check and `n + r > 0` are in the filter over the
projection, and the `Shape` class, which existed only to pair each condition
with that flag, is removed. The check is still generated among the checks of `n
+ r > 0`, so the shape tests the same thing.
### Why are the changes needed?
To fix the test, which fails on master and `branch-4.x` after both changes
went in, e.g.:
```
- SPARK-61377: FilterExec CSE computes an input column just before the first
conjunct that reads it *** FAILED ***
methodSplitThreshold 2147483647, n + r > 0 AND f + 1 > 0 AND f + 1 < 100:
... was false IsNotNull(n) should be inferred: ((((n#655990L + r#655978L) > 0)
AND ((f#655975L + 1) > 0)) AND ((f#655975L + 1) < 100))
```
### Does this PR introduce _any_ user-facing change?
No, test only.
### How was this patch tested?
`WholeStageCodegenSuite` passes on master. The `SPARK-61377` test passes on
`branch-4.x` and on `branch-4.4`, which does not have SPARK-61823, so the shape
no longer depends on whether the check is inferred; it also passes with
`SPARK_ANSI_SQL_MODE=false`. Without this PR, the test fails on master and
`branch-4.x` as above. The two mutants of `generatePredicateCode` that #60557
added the shape to catch, which load the columns of a conjunct before its
`IsNotNull` checks, still fail the test on master, on this shape.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Kiro CLI 3.3.0 (Claude Opus 5.5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]