deniskuzZ opened a new pull request, #6972:
URL: https://github.com/apache/hive/pull/6972
### What changes were proposed in this pull request?
`HiveIcebergStorageHandler.acidSortColumns(DELETE)` returns no sort columns
for any table. Before, a V2 table with `write.fanout.enabled=false` got
(`PARTITION__SPEC__ID`, `PARTITION__HASH`, `FILE__PATH`, `ROW__POSITION`).
### Why are the changes needed?
With fanout disabled, a merge-on-read DELETE, split UPDATE or MERGE on a V2
table sorted its deleted records by spec ID, partition, file path and position
in a reducer, so that `ClusteredPositionDeleteWriter` could write them. That
writer is chosen only when `FileSinkOperator` marks the input sorted, which it
does only for a file sink with a `DynamicPartitionCtx` that has custom
partition or sort expressions. The file sink of a merge-on-read delete has
none. So `HiveIcebergWriterBase.newDeleteWriter` always built
`FanoutPositionOnlyDeleteWriter`, and every such statement paid for a reducer
stage and a full sort that nothing used.
`FanoutPositionOnlyDeleteWriter` keeps one position bitmap per data file and
writes the positions in order when it closes, so it takes them in any order, as
`PartitioningDVWriter` does for V3. Without the sort, such a statement plans
and writes as it does with fanout enabled, the default.
```sql
create external table ice_v2_nofanout (id int, name string, amount int)
partitioned by spec (bucket(2, id))
stored by iceberg tblproperties ('format-version'='2',
'write.fanout.enabled'='false');
insert into ice_v2_nofanout values (1, 'a', 10), (2, 'b', 20), (3, 'c', 30),
(4, 'd', 40);
explain delete from ice_v2_nofanout where id = 1;
-- before: Map 1 -> Reducer 2, Reduce Output Operator sorted (++++) by the
spec ID, partition hash, file path and position
-- after: Map 1 only
```
### Does this PR introduce _any_ user-facing change?
No. The plans of DELETE, UPDATE and MERGE on V2 tables with
`write.fanout.enabled=false` lose the delete sort, and the same delete writer
runs as before.
### How was this patch tested?
- New `iceberg_v2_deletes_fanout_disabled.q` (`TestIcebergCliDriver`): the
DELETE and the split UPDATE are map-only, and the rows after a DELETE, a split
UPDATE and a MERGE are as expected. On master both plans have a Reducer 2 with
the `++++` sort, and the rows are the same.
- `delete_iceberg_partitioned_{orc,parquet}`,
`update_iceberg_partitioned_parquet`, `merge_iceberg_partitioned_orc`,
`vectorized_iceberg_merge_mixed`, `dynamic_partition_writes` and
`ctas_iceberg_partitioned_orc` 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]