Support row level deletes in the Iceberg connector#11886
Support row level deletes in the Iceberg connector#11886findepi merged 3 commits intotrinodb:masterfrom
Conversation
15df4e5 to
b096e2d
Compare
b096e2d to
6ab810c
Compare
6ab810c to
edfb55a
Compare
5a2e8da to
a28a32c
Compare
|
@alexjo2144 can you PTAL at the CI output? |
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java
Outdated
Show resolved
Hide resolved
1723c49 to
8ebba99
Compare
|
Should be ready for review now |
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergPageSourceProvider.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
We likely should have some follow up here. If an entire file is deleted this code will write a position delete file marking every row as deleted. Instead I think we could use transaction.newDelete()
That's kinda hard to do right now though, because a file may be separated into several Splits, handled by different workers.
25a3e3a to
4a24328
Compare
...roduct-tests/src/main/java/io/trino/tests/product/iceberg/TestIcebergSparkCompatibility.java
Outdated
Show resolved
Hide resolved
87d5d67 to
dde16e6
Compare
There was a problem hiding this comment.
if deleteMode==null (no specific mode request), it seems correct to carry out the delete operation.
-- we're fulfilling the v2 spec, and not violating any explicit request.
Let's just do this change.
furthermore, when delete mode is set !- merge-on-read. Can this be for performance reasons?
If so, that would be "a soft preference", perhaps set for Spark's benefit (which supports multiple delete modes). In such case ignoring it and carrying out the delete would be OKish too (best option currently possible).
Can this be set for compatibility reasons? I don't know.
There was a problem hiding this comment.
Actually, i came to a conclusion that this should be viewed as a tuning property only, i.e. advisory. We don't support two modes, so there is nothing to tune, we just just proceed.
There was a problem hiding this comment.
I agree that this should be advisory. This is a preferred mode.
If a user were to need to enforce this, I think it would only be for the eager rewrite / copy-on-write mode. But that can be enforced by using a v1 table instead of a v2.
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java
Outdated
Show resolved
Hide resolved
dde16e6 to
5899dd3
Compare
|
Added a change in |
|
(forced re-run after #11980 merged) |
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableHandle.java
Outdated
Show resolved
Hide resolved
4a3c2b5 to
589b670
Compare
There was a problem hiding this comment.
I think this is unclear. The format is not supported by Trino. But Avro, for example, is supported by Iceberg.
There was a problem hiding this comment.
Removed "for Iceberg".
2653df7 to
4cf6070
Compare
b5f70de to
413578d
Compare
|
Test PR: #12105 (cc @ilfrin @nineinchnick for potentially streamlining this) |
413578d to
d83a9d4
Compare
|
Rebased for merge conflicts |
| assertMetastoreInvocations("SELECT * FROM test_select_from", | ||
| ImmutableMultiset.builder() | ||
| .add(GET_TABLE) | ||
| .addCopies(GET_TABLE, 2) |
There was a problem hiding this comment.
Why does "Improve Iceberg commit to HMS" change the invocation counts on the read path?
There was a problem hiding this comment.
The first one is TrinoHiveCatalog getting the table to check if the table is a view/materialized view. The second call is AbstractMetastoreTableOperations loading the Iceberg table, when it does that the cache is invalidated to get the most recent Snapshot.
I couldn't find a good way to invalidate the cache only during commit retries and not during initial table loading, they use the same code path. getRefreshedLocation
There was a problem hiding this comment.
Updated to include an invalidateCaches parameter, which is set to true when refresh is called, and false when current is called. That meets the expectations of the Iceberg library
plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java
Outdated
Show resolved
Hide resolved
Support removing individual rows by writing positional delete files compatible with v2 of the Iceberg specification. Co-authored-by: Jack Ye <yzhaoqin@amazon.com>
The Iceberg library has a built in commit retry, but in order to use it the TableOperations must throw the right kind of exception, and AbstractMetastoreTableOperations#getRefreshedLocation must refresh the metastore cache.
d83a9d4 to
af51789
Compare
Description
Support removing individual rows by writing positional delete files
compatible with v2 of the Iceberg specification.
New feature
Iceberg connector
Allow deleting individual rows from an Iceberg table
Related issues, pull requests, and links
Documentation
( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
(x) Documentation PR is available with #12061
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
( ) No release notes entries required.
(x) Release notes entries required with the following suggested text: