-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
Hi all,
I've noticed an inconsistency when doing a CREATE OR REPLACE
on a table vs a view when using trino with iceberg. With tables, trino will reuse the location of the table it's replacing, IcebergMetadata::beginCreateTable
:
...
String tableLocation = null;
...
if (replace) {
...
tableLocation = icebergTable.location();
...
}
if (tableLocation == null) {
tableLocation = getTableLocation(tableMetadata.getProperties())
.orElseGet(() -> catalog.defaultTableLocation(session, tableMetadata.getTable()));
}
...
transaction = newCreateTableTransaction(catalog, tableMetadata, session, replace, tableLocation, allowedExtraProperties);
When replacing a view, a new location is always generated TrinoRestCatalog::createView
:
viewBuilder = viewBuilder.withSchema(schema)
.withQuery("trino", definition.getOriginalSql())
.withDefaultNamespace(toRemoteNamespace(session, toNamespace(schemaViewName.getSchemaName())))
.withDefaultCatalog(definition.getCatalog().orElse(null))
.withProperties(properties.buildOrThrow())
.withLocation(defaultTableLocation(session, schemaViewName));
which in presence of "iceberg.unique-table-location" = 'true'
ends up generating a new view location for every replace view.
Is there a reason to generate a new location for every new view version?
Kind regards & thanks for the effort!
Metadata
Metadata
Assignees
Labels
No labels