-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Set existing location for view when replacing view for Iceberg Rest #26736
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
base: master
Are you sure you want to change the base?
Set existing location for view when replacing view for Iceberg Rest #26736
Conversation
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.
Please update the test and shorten the commit title: https://trino.io/development/process.html#pull-request-and-commit-guidelines-
1233e1b
to
82b5c3b
Compare
Added a new test with useUniqueTableLocations=true and made the commit title shorter. |
f0c00e9
to
f8f7dae
Compare
|
||
@Test | ||
@Override | ||
public void testViewUnique() |
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.
update name sth like testCreateReplaceViewUniqueLocation
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.
update name sth like
testCreateReplaceViewUniqueLocation
Fixed
ViewBuilder viewBuilder = restSessionCatalog.buildView(convert(session), toRemoteView(session, schemaViewName, true)); | ||
String tableLocation = defaultTableLocation(session, schemaViewName); | ||
if (replace && useUniqueTableLocation) { | ||
Optional<View> view = getIcebergView(session, schemaViewName, true); |
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.
will we fail to get the view if it isn't in the view cache?
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.
will we fail to get the view if it isn't in the view cache?
I believe it will attempt to return from the cache, and if missing it will load it.
It reaches CacheUtils.uncheckedCacheGet, where it does "return cache.get(key, loader::get);"
17f408d
to
30ffe4c
Compare
try { | ||
catalog.dropNamespace(SESSION, namespace); | ||
} | ||
catch (Exception e) { |
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.
Remove this
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.
Removed
.doesNotContain(renamedSchemaTableName); | ||
} | ||
finally { | ||
try { |
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.
Remove this try catch
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.
Removed
String namespace = "test_create_view_" + randomNameSuffix(); | ||
String viewName = "viewName"; | ||
String renamedViewName = "renamedViewName"; | ||
SchemaTableName schemaTableName = new SchemaTableName(namespace, viewName); |
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.
Where is the logic to check the location is the same before and after the "create or replace"
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.
Couldn't find a way to get the view location, as that is a property from apache iceberg view (org.apache.iceberg.view).
Moved the test to TestTrinoRestCatalog, where I could inspect the temporary folder and extract the view name.
6927de5
to
8f5b537
Compare
If replace and useUniqueTableLocation, load the existing view and reuse its location.
8f5b537
to
9748f78
Compare
Set existing location for view when replacing view for Iceberg Rest catalog
Fixes #25425
Description
If replace and useUniqueTableLocation, load the existing view and reuse its location.
Additional context and related issues
Release notes
(X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: