a2l007 opened a new pull request, #19534:
URL: https://github.com/apache/druid/pull/19534
Fixes #19190
### Description
This PR fixes Iceberg delete semantics which was previously broken for v2
tables. No spec changes are required. The same ingestion spec works for V1 and
V2 tables. Delete detection is automatic at planning time.
In the V2 path, each `FileScanTask` is encoded as an
`IcebergFileTaskInputSource` , containing the data file path, format, size,
delete file metadata (paths, content type, equality field IDs), and the table
schema captured as JSON at planning time.
IcebergNativeRecordReader processes each split:
1. Delete metadata is loaded upfront. For each associated delete file is
processed based on whether it is a position delete file or an equality delete
file.
- Position delete files: Rows to skip are read and filtered to only
positions matching the current data file path.
- Equality delete files : Rows of key tuples are read per equality
delete file.
2. The data file is streamed lazily using Iceberg's Parquet.read() builder
with GenericParquetReaders.
3. Deletes are applied per record: each record's position is checked
against the position delete set; its field values are checked against each
equality delete set. Matching records are skipped.
4. Surviving records are converted to `MapBasedInputRow` via
`IcebergRecordConverter`
FileIO is resolved per path: local paths use `WarehouseFileIO`, non-local
paths (HDFS, S3) fall back to `catalog.loadTable().io()` using the namespace
and table name passed through the split.
#### Release note
<!-- Give your best effort to summarize your changes in a couple of
sentences aimed toward Druid users.
If your change doesn't have end user impact, you can skip this section.
For tips about how to write a good release note, see [Release
notes](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#release-notes).
-->
The `druid-iceberg-extensions` input source now correctly handles Iceberg V2
tables that contain row-level delete files. Previously, position deletes and
equality deletes were silently ignored, causing deleted rows to appear in
ingested segments. Druid now auto-detects delete files at planning time and
applies them during ingestion with no spec changes required.
<hr>
##### Key changed/added classes in this PR
* `IcebergCatalog`
* `IcebergInputSource`
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added documentation for new or modified features or behaviors.
- [x] a release note entry in the PR description.
- [x] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
- [x] been tested in a test Druid cluster.
--
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]