[Iceberg] Fix querying data_sequence_number with equality deletes#25293
Merged
hantangwangd merged 1 commit intoprestodb:masterfrom Jun 15, 2025
Merged
[Iceberg] Fix querying data_sequence_number with equality deletes#25293hantangwangd merged 1 commit intoprestodb:masterfrom
hantangwangd merged 1 commit intoprestodb:masterfrom
Conversation
hantangwangd
requested changes
Jun 12, 2025
Member
hantangwangd
left a comment
There was a problem hiding this comment.
Thanks for this fix, the main logic looks reasonable to me. Considering that the variables in table scan node's assignment might also have suffixes (e.g. when a single SQL statement involves $data_sequence_number columns from multiple tables), we need to make some adjustments to support such scenarios.
presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedTestBase.java
Show resolved
Hide resolved
...iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergEqualityDeleteAsJoin.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergEqualityDeleteAsJoin.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/com/facebook/presto/iceberg/optimizer/IcebergEqualityDeleteAsJoin.java
Outdated
Show resolved
Hide resolved
Contributor
|
Thanks for the release note! Formatting nit: |
4a4bb15 to
f4b5975
Compare
Member
Author
|
Thanks, I've edited the release note with the correct format. |
Member
hantangwangd
left a comment
There was a problem hiding this comment.
Thanks for the fix, overall looks good to me. Just one thing for discussing.
f4b5975 to
96bf02e
Compare
hantangwangd
approved these changes
Jun 14, 2025
6 tasks
This was referenced Jul 4, 2025
This was referenced Jul 24, 2025
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the error "Duplicate key $data_sequence_number" when trying to query "$data_sequence_number" on an Iceberg table that has equality deletes. Because Presto implicitly adds a data_sequence_number column in IcebergEqualityDeleteAsJoin already, when this column is explicitly added to the query the column is duplicated and the error occurs.
Motivation and Context
Closes #24629.
Impact
Allows querying "$data_sequence_number" in tables with equality deletes.
Test Plan
Since Presto does not generate equality deletes (only position deletes), use Apache Flink to create the table following the steps outlined in the original issue comments. Then use
call iceberg.system.register_table('schemaName', 'tableName', 'metadataDir')to import the table to Presto and run the queryselect "$data_sequence_number", * from sample;This query fails before this change and successfully returns rows after.
A unit test was added IcebergDistributedTestBase.
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.