-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Iceberg $history table when using REST Catalog #17470
Merged
findepi
merged 1 commit into
trinodb:master
from
findinpath:findinpath/iceberg-history-table-bugfix
May 15, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,6 +595,33 @@ public void testDropTableWithNonExistentTableLocation() | |
assertFalse(getQueryRunner().tableExists(getSession(), tableName)); | ||
} | ||
|
||
// Verify the accuracy of Trino metadata tables while retrieving Iceberg table metadata from the underlying `TrinoCatalog` implementation | ||
@Test | ||
public void testMetadataTables() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a code comment why this is in SmokeTest. |
||
{ | ||
try (TestTable table = new TestTable( | ||
getQueryRunner()::execute, | ||
"test_metadata_tables", | ||
"(id int, part varchar) WITH (partitioning = ARRAY['part'])", | ||
ImmutableList.of("1, 'p1'", "2, 'p1'", "3, 'p2'"))) { | ||
List<Long> snapshotIds = computeActual("SELECT snapshot_id FROM \"" + table.getName() + "$snapshots\" ORDER BY committed_at DESC") | ||
.getOnlyColumn() | ||
.map(Long.class::cast) | ||
.collect(toImmutableList()); | ||
List<Long> historySnapshotIds = computeActual("SELECT snapshot_id FROM \"" + table.getName() + "$history\" ORDER BY made_current_at DESC") | ||
.getOnlyColumn() | ||
.map(Long.class::cast) | ||
.collect(toImmutableList()); | ||
long filesCount = (long) computeScalar("SELECT count(*) FROM \"" + table.getName() + "$files\""); | ||
long partitionsCount = (long) computeScalar("SELECT count(*) FROM \"" + table.getName() + "$partitions\""); | ||
|
||
assertThat(snapshotIds).hasSize(4); | ||
assertThat(snapshotIds).hasSameElementsAs(historySnapshotIds); | ||
assertThat(filesCount).isEqualTo(3L); | ||
assertThat(partitionsCount).isEqualTo(2L); | ||
} | ||
} | ||
|
||
protected abstract boolean isFileSorted(Location path, String sortColumnName); | ||
|
||
private String getTableLocation(String tableName) | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a bug in the library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please see the discussion https://apache-iceberg.slack.com/archives/C03LG1D563F/p1683871245426989
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@findinpath unfortunately the discussion is no longer visible in slack (thread is a bit old).
We recently hit an issue here because we made the assumption that
$history
table only contained snapshots that were at some point or another the current snapshot of a table.I wonder what is the difference now between
$snapshots
and$history
? Since I can get pretty much anything from$history
using only$snapshots
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gustavoatt i don't see the replies anymore on the slack thread and lost context :(