Metin Hatipogullari created ORC-2238:
----------------------------------------

             Summary: SearchArgument IS_NULL on a field nested in a struct 
skips row groups where the struct is null
                 Key: ORC-2238
                 URL: https://issues.apache.org/jira/browse/ORC-2238
             Project: ORC
          Issue Type: Bug
          Components: Java, Reader
    Affects Versions: 1.9.8, 2.1.4, 2.3.1
            Reporter: Metin Hatipogullari


A SearchArgument {{IS_NULL}} on a field nested in a struct skips row groups 
whose only nulls for that field come from a null parent struct.

ORC writes a struct field only in rows where all of its ancestors are present, 
so the field's column statistics do not count rows where the parent is null, 
and {{hasNull}} stays false when the field itself is never null. 
{{SargApplier}} evaluates {{IS_NULL}} on those statistics, gets {{NO}}, and 
skips the row group.

{code:java}
// struct<id:int,s:struct<x:int>> with rows (1, NULL) and (2, {x: 5})
SearchArgument sarg = SearchArgumentFactory.newBuilder()
    .isNull("s.x", PredicateLeaf.Type.LONG)
    .build();
// reads 0 rows; row 1 has s = NULL, so s.x IS NULL matches it
reader.rows(reader.options().searchArgument(sarg, null));
{code}

Statistics for {{s.x}}: {{count: 1 hasNull: false}}. Reproduced on 1.9.8, 2.1.4 
and 2.3.1. Spark fixes the same case on its side in SPARK-60362, and Iceberg in 
https://github.com/apache/iceberg/issues/19064.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to