Commit 467a293
ORC-1898: When column is all null, NULL_SAFE_EQUALS pushdown doesn't get evaluated correctly
### What changes were proposed in this pull request?
When all values in column `col_0` are `NULL`s within a row group, and we attempt to apply the predicate pushdown `col_0 <=> 'xxx'`, the `evaluatePredicateProto` function returns `TruthValue.NULL`. In this case, we can directly determine the result based on the literal value: if the literal is `NULL`, return `TruthValue.YES`, otherwise, return `TruthValue.NO`.
### Why are the changes needed?
See [SPARK-52032](https://issues.apache.org/jira/projects/SPARK/issues/SPARK-52032).
When we pushdown the NULL_SAFE_EQUALS predicate, all values of the column are `NULL`. The `evaluatePredicateProto` returns `TruthValue.NULL`, whose `isNeeded` returns false so that the whole row group is skipped by `SargApplier.pickRowGroups`, which actually is incorrect.
### How was this patch tested?
There already exists unit test -- `TestOrcTimezonePPD.testTimestampAllNulls`
### Was this patch authored or co-authored using generative AI tooling?
Co-authored using generative AI tooling.
Closes #2223 from jayhan94/fix_null_safe_equals_pred_push.
Authored-by: Jay Han <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>1 parent b716d81 commit 467a293
File tree
2 files changed
+8
-1
lines changed- java/core/src
- java/org/apache/orc/impl
- test/org/apache/orc
2 files changed
+8
-1
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
766 | 773 | | |
767 | 774 | | |
768 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
0 commit comments