Skip to content
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

Disable support for snapshot id within the Iceberg table name #13414

Conversation

findinpath
Copy link
Contributor

Description

Disable the possibility of specifying the snapshot id
within the Iceberg table name.

With the introduction of the syntax

table1 FOR VERSION AS OF 123

there is no more need of supporting the
deprecated syntax:

table1@123

Is this change a fix, improvement, new feature, refactoring, or other?

Other.

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

Iceberg connector

How would you describe this change to a non-technical end user or system administrator?

Use table1 FOR VERSION AS OF 123 instead of table1@123 for retrieving the snapshot 123 of table.

Related issues, pull requests, and links

Documentation

(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) 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:

# Iceberg
* Disable support for specifying the snapshot id within the Iceberg table name

@cla-bot cla-bot bot added the cla-signed label Jul 29, 2022
@findinpath
Copy link
Contributor Author

@findepi @phd3 @electrum PTAL on this PR

@findinpath findinpath requested review from findepi, phd3 and electrum and removed request for findepi July 29, 2022 12:51
@findepi findepi requested a review from alexjo2144 July 29, 2022 13:20
return Optional.of(new SnapshotsTable(systemTableName, typeManager, table));
case PARTITIONS:
return Optional.of(new PartitionTable(systemTableName, typeManager, table, getSnapshotId(table, name.getSnapshotId(), isAllowLegacySnapshotSyntax(session))));
return Optional.of(new PartitionTable(systemTableName, typeManager, table, Optional.empty()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a regression to me, does the AS OF syntax work as a replacement for select * from abc$manifests@456?

Copy link
Contributor Author

@findinpath findinpath Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR for supporting time travel queries on system tables but it is unfortunately not ready yet.

#12737

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it is best to introduce the ability to perform time travel queries on system tables before continuing with this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shown in the PRs:

time travel on system tables incurs added complexity to the Iceberg connector code.

Without concrete demand from the community for time travel functionality on system tables, we leave the above mentioned PRs on hold and go further with disabling support for snapshot id within the Iceberg table name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a regression to me

correct

does the AS OF syntax work as a replacement for select * from abc$manifests@456?

no

The reason we're not pursing the above linked PRs is because we believe there is little community interest in these.
If there isn't general demand on time travel on system tables, we should be OK with carrying out removal of this (already deprecated) functionality.

@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch from 80a5cca to 89b53dd Compare July 29, 2022 19:45
@findinpath findinpath marked this pull request as draft July 29, 2022 20:00
@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch from 89b53dd to c31a47e Compare September 6, 2022 14:46
@findinpath findinpath marked this pull request as ready for review September 6, 2022 14:47
@findinpath
Copy link
Contributor Author

In the context of deprecating the tableName@snapshotId syntax, maybe it is worth also rewriting io.trino.plugin.iceberg.IcebergTableHandle#toString to use tableName FOR VERSION AS OF snapshotId syntax.

@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch from c31a47e to 2c58a97 Compare September 6, 2022 16:00
@findepi
Copy link
Member

findepi commented Sep 7, 2022

@findinpath there is a test failure. is it related?

@findepi
Copy link
Member

findepi commented Sep 7, 2022

In the context of deprecating the tableName@snapshotId syntax, maybe it is worth also rewriting io.trino.plugin.iceberg.IcebergTableHandle#toString to use tableName FOR VERSION AS OF snapshotId syntax.

This is used in EXPLAIN.
Let's keep it terse (no change), since this will always be there, for every SELECT, not only for time travel queries.

@findinpath
Copy link
Contributor Author

@findepi failure of the tests was related to my changes. I fixed the failing test failure and rebased on master due to conflicts which appeared in the meantime.

@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch from 2c58a97 to 3300dee Compare September 7, 2022 13:02
@findinpath findinpath self-assigned this Sep 7, 2022
@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch 2 times, most recently from 2c07399 to 3a85f75 Compare September 9, 2022 14:06
long snapshotId = endVersion.map(connectorTableVersion -> getSnapshotIdFromVersion(table, connectorTableVersion))
.orElseGet(() -> resolveSnapshotId(table, name.getSnapshotId().get(), isAllowLegacySnapshotSyntax(session)));
if (endVersion.isPresent()) {
long snapshotId = endVersion.map(connectorTableVersion -> getSnapshotIdFromVersion(table, connectorTableVersion)).get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
long snapshotId = endVersion.map(connectorTableVersion -> getSnapshotIdFromVersion(table, connectorTableVersion)).get();
long snapshotId = getSnapshotIdFromVersion(table, endVersion.get());

}

private long resolveSnapshotId(Table table, long id, boolean allowLegacySnapshotSyntax)
private Optional<Long> getSnapshotId(Table table)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCurrentSnapshotId

Disable the possibility of specifying the snapshot id
within the Iceberg table name.

With the introduction of the syntax

```
table1 FOR VERSION AS OF 123
```
there is no more need of supporting the
deprecated syntax:

```
table1@123
```
@findinpath findinpath force-pushed the iceberg-disable-usage-of-snapshotid-in-table-name branch from 3a85f75 to 51187fb Compare September 12, 2022 04:18
@findinpath findinpath requested a review from findepi September 12, 2022 04:22
@findepi findepi merged commit 7360b11 into trinodb:master Sep 12, 2022
@findepi
Copy link
Member

findepi commented Sep 12, 2022

No release notes since the functionality was already deprecated.

@findepi findepi added the no-release-notes This pull request does not require release notes entry label Sep 12, 2022
@github-actions github-actions bot added this to the 396 milestone Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

3 participants