SEPURI-SAI-KRISHNA commented on PR #59574: URL: https://github.com/apache/spark/pull/59574#issuecomment-6791750389
Thanks @raviston for the review and the NaN check. I merged master and resolved the conflict in `OrcFilters.buildLeafSearchArgument` as you suggest: the zero handling stays in the generic cases, which now have the `canPushValue` guard, and the `TimestampType` cases are unchanged. While rechecking after the merge, I found that a comparison on a field of a shredded Variant (`variant_get(v, '$.a', 'double') = 0`, pushed down to its typed Parquet leaf since SPARK-55817, which is in master and branch-4.x) had the same problem and is fixed by the same code, since it goes through `makeEq`, `makeLt` and so on. I added a test for it in `VariantShreddingFilterPushdownSuite`, which fails without this change, and updated the description. @ariel-miculas, sorry for the late reply. On master, NaN does not need special handling here: - Parquet 1.18.1 (PARQUET-2249) never skips on a NaN literal in the statistics, the column index, the dictionary or the bloom filter, and it keeps a chunk or page that holds NaNs for a range predicate. - ORC uses no statistics of a stripe or row group that holds a NaN (its sum is NaN), and its bloom filter hashes NaN with `doubleToLongBits`, so every NaN has the same hash. I checked this by comparing the results with pushdown on and off. Each check used one file of NaN, one of NaN with the sign bit set, and one of 2.0. The predicates were `=`, `<=>`, `IN` (below and above the InSet threshold), `!=`, `<`, `<=`, `>`, `>=`, `NOT` and `isnan`. I ran them on Parquet (dictionary, plain, and bloom filter) and ORC (with and without a bloom filter), for DOUBLE and FLOAT. None of the 216 cases differ on master. Released versions are different. On 4.0.3 (Parquet 1.15.2), 26 of the 216 cases return fewer rows with pushdown, all because of the Parquet bloom filter. When writing, it hashes the raw bits of a NaN, while the data page stores NaN canonically. So `f = NaN`, `f <=> NaN` and `f IN (NaN, ...)` skip a file written with a NaN that has the sign bit set; Yaoxuan Wu reported the same on SPARK-60322. branch-4.x and branch-4.2 use Parquet 1.17.0, which has the same bloom filter behavior. A backport of this PR there would therefore need to handle NaN too, for example by not pushing down an equality or `IN` with a NaN literal. I can do that in the backport. -- 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]
