adiranjan25 opened a new pull request, #19200:
URL: https://github.com/apache/iceberg/pull/19200

   Fixes #19189.
   
   ## Problem
   
   When a Parquet-backed Iceberg table is partitioned by a
   nested field, projecting only that partition field can
   cause a NULL parent struct to be reconstructed as a
   non-NULL struct containing NULL fields.
   
   This changes IS NULL predicate results and can lead
   to incorrect query results.
   
   ## Root cause
   
   ParquetValueReaders.structReader replaces applicable
   physical field readers with partition constant readers.
   
   However, presenceColumn checks readersById without
   accounting for fields replaced by constants.
   
   Consequently, the presence-column mechanism can be
   bypassed even when no projected field reader supplies
   the physical definition levels required to determine
   parent struct nullability.
   
   ## Changes
   
   - Pass idToConstant to presence-column selection.
   - Exclude fields replaced by constants when checking
     whether a physical field reader is available.
   - Reuse the existing PresenceReader mechanism.
   - Add Spark SQL regression coverage for nested
     identity partition field projection.
   
   ## Regression coverage
   
   - Non-NULL struct containing actual values.
   - NULL parent struct.
   - Non-NULL struct containing NULL children.
   - Correct row selection using IS NULL.
   
   ## Validation
   
   The original regression failed in both executions
   before the fix and passed in both after the fix.
   
   Broader validation with JDK 17 and Spark 3.5:
   
   | Module | Total | Passed | Failed | Skipped |
   |--------|------:|-------:|-------:|--------:|
   | Parquet | 787 | 778 | 0 | 9 |
   | Spark | 85 | 85 | 0 | 0 |
   | Total | 872 | 863 | 0 | 9 |
   
   Spark validation included TestFilterPushDown and
   TestSparkReadProjection.
   
   Spotless checks and git diff --check passed.
   
   DELETE and rewrite-specific behavior have not been
   independently validated.
   


-- 
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]

Reply via email to