-
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
Iceberg test improvements around time travel #13823
Iceberg test improvements around time travel #13823
Conversation
`getCurrentSnapshotId` and `getLatestSnapshotId` were equivalent.
Currently, the way how the system tables are implemented makes it impossible for `getTableHandleForExecute` to be executed on a non-DATA table, so it's just a sanity check.
cc1e2e9
to
26a59e1
Compare
assertThatThrownBy(() -> query(session, "ALTER TABLE \"%s@%d\" EXECUTE OPTIMIZE".formatted(tableName, snapshotId))) | ||
.hasMessage("Cannot execute table procedure OPTIMIZE on old snapshot " + snapshotId); |
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.
nit: How about assertQueryFails
to ensure TrinoException
?
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.
assertThatThrownBy(() -> query(...))
is a pattern we use very widely.
if we want to deprecate it in favor of assertQueryFails
, we should have a discussion about this first.
assertThat(query("SELECT * FROM " + tableName)) | ||
.matches("VALUES 11, 22"); |
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.
nit: No change requested. assertQuery
looks better for simple query assertion.
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.
agree. i think i perhaps did this more for consistency reasons.
public void testExpireSnapshotsSystemTable() | ||
{ | ||
assertThatThrownBy(() -> query("ALTER TABLE \"nation$files\" EXECUTE EXPIRE_SNAPSHOTS")) | ||
.hasMessage("This connector does not support table procedures"); |
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.
I know it is not in the scope of this PR but I find this error message missleading for this particular case.
This connector actually supports table procedures just not on the system tables.
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.
I agree.
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.
Adding io.trino.connector.system.SystemTablesMetadata#getTableHandleForExecute
with a more meaningful exception message would be a solution.
@@ -5117,13 +5117,13 @@ public void testModifyingOldSnapshotIsNotPossible() | |||
assertUpdate(format("INSERT INTO %s VALUES 4,5,6", tableName), 3); | |||
assertQuery(sessionWithLegacySyntaxSupport, format("SELECT * FROM \"%s@%d\"", tableName, oldSnapshotId), "VALUES 1,2,3"); | |||
assertThatThrownBy(() -> query(sessionWithLegacySyntaxSupport, format("INSERT INTO \"%s@%d\" VALUES 7,8,9", tableName, oldSnapshotId))) |
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.
nit: There are a few more ."
occurrences in the exception messages within IcebergMetadata
This could lead to unexpected state.
26a59e1
to
defbf87
Compare
I'm guessing |
@alexjo2144 correct. |
Extracted from #13636 where they were added thanks to @alexjo2144 's #13636 (comment)