deniskuzZ opened a new pull request, #6971:
URL: https://github.com/apache/hive/pull/6971

   ### What changes were proposed in this pull request?
   `HiveIcebergStorageHandler.decomposePredicate` leaves a predicate that reads 
a virtual column (`FILE__PATH`, `PARTITION__SPEC__ID`, `PARTITION__HASH`, 
`PARTITION__NAME`, `ROW__LINEAGE__ID`, `LAST_UPDATED_SEQUENCE_NUMBER`) out of 
the filter pushed to Iceberg only when it is a conjunct of an AND root. Any 
other root that reads a virtual column pushes nothing.
   
   ### Why are the changes needed?
   Iceberg cannot evaluate virtual columns, so `decomposePredicate` removed the 
operands that read one, from the children of whatever the root was. For an AND 
that is right: what remains holds for every row the predicate keeps. For an OR 
it is not: the remaining disjuncts hold for fewer rows, Iceberg prunes the 
files that hold the other qualifying rows, and the residual filter in Hive 
cannot bring them back.
   
   ```sql
   set hive.fetch.task.conversion=none;
   create external table ice_vc (a int) stored by iceberg stored as parquet;
   insert into ice_vc values (1), (2);
   insert into ice_vc values (10), (11);
   insert into ice_vc values (20), (21);
   
   select a from ice_vc where a = 1 or file__path is not null order by a;   -- 
before: 1, 2 (expected all 6 rows)
   select a from ice_vc where a = 1 or partition__spec__id = 0 order by a;  -- 
before: 1, 2 (expected all 6 rows)
   ```
   
   The pushed predicate is also the conflict-detection filter 
(`SessionStateUtil.setConflictDetectionFilter`), which was narrower than the 
rows read in the same way.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes: a filter that ORs a virtual column with a data column returns every 
qualifying row. Such a filter no longer prunes Iceberg files.
   
   ### How was this patch tested?
   - New `iceberg_virtual_column_pushdown.q` (`TestIcebergLlapLocalCliDriver`): 
the two OR queries return all 6 rows and read all 3 files; the AND query still 
reads 1 file. With the fix reverted it fails (2 of 6 rows).
   - The copy-on-write delete/update/merge, `metadata_delete`, 
`query_iceberg_virtualcol` and `iceberg_row_mode_virtual_columns` qtests pass 
unchanged.
   


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

  • [PR] HIVE-30252: Iceberg: A fi... deniskuzZ (via GitHub) via gitbox

Reply via email to