-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Support renaming materialized views #9492
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.
skimmed so for. Automation errors seem relevant
core/trino-main/src/main/java/io/trino/execution/RenameMaterializedViewTask.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/RenameMaterializedViewTask.java
Show resolved
Hide resolved
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.
some comments added. changes incoming
core/trino-main/src/main/java/io/trino/execution/RenameMaterializedViewTask.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/execution/RenameMaterializedViewTask.java
Outdated
Show resolved
Hide resolved
e00e1ca
to
723f8e6
Compare
changes from comments applied + iceberg test fixed |
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.
lgtm % small comments
core/trino-main/src/main/java/io/trino/execution/RenameMaterializedViewTask.java
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/security/InjectedConnectorAccessControl.java
Outdated
Show resolved
Hide resolved
plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/TestIcebergMaterializedViews.java
Outdated
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Show resolved
Hide resolved
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Show resolved
Hide resolved
@@ -215,8 +216,8 @@ public void testRenameDenyPermission() | |||
assertAccessDenied( | |||
"ALTER MATERIALIZED VIEW materialized_view_rename_deny RENAME TO materialized_view_rename_deny_new", | |||
"Cannot rename materialized view .*.materialized_view_rename_deny.*", | |||
privilege("materialized_view_rename_deny", REFRESH_MATERIALIZED_VIEW)); | |||
assertUpdate("DROP MATERIALIZED VIEW materialized_view_drop_deny"); | |||
privilege("materialized_view_rename_deny", RENAME_MATERIALIZED_VIEW)); |
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.
that should be previous commit
if (metadata.getMaterializedView(session, target).isPresent()) { | ||
throw semanticException(TABLE_ALREADY_EXISTS, statement, "Target materialized view '%s' already exists", target); | ||
} | ||
if (metadata.getView(session, target).isPresent()) { |
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 think this can still fail when there is a Hive view that needs to be translated. I think we can leave with it
723f8e6
to
34dd877
Compare
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.
comments addressed
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Show resolved
Hide resolved
34dd877
to
398ea6e
Compare
There was a dependence |
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.
lgtm % comments
getTestingMaterializedViewsResultRows(view, otherView)); | ||
assertThat(query(listMaterializedViewsSql("catalog_name = '" + view.getCatalogName() + "'"))) | ||
.skippingTypesCheck() | ||
.containsAll(getTestingMaterializedViewsResultRows(view, otherView)); | ||
|
||
assertQuery( |
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.
This should be changed too (and couple of places below too). Also, please extract test changes to separate commit
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.
done
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Show resolved
Hide resolved
398ea6e
to
bdc1b6f
Compare
|
||
assertQuery( |
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: this was resulting single row anyway
|
||
assertQuery( | ||
assertThat(query( |
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: this was resulting single row anyway
@@ -637,30 +637,34 @@ public void testMaterializedView() | |||
assertUpdate("DROP MATERIALIZED VIEW " + viewWithComment); | |||
|
|||
// test filtering materialized views in system metadata table | |||
assertQuery( |
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 is one assertQuery
above that is not changed
this requires doc update cc @mosabua |
docs PR #9562 |
Add support for
ALTER MATERIALIZED VIEW (IF EXISTS)? ... RENAME TO ...
syntax.Implement the support in the iceberg connector.