manuzhang commented on code in PR #17128:
URL: https://github.com/apache/iceberg/pull/17128#discussion_r3549756964
##########
spark/v4.1/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -774,6 +774,34 @@ public void renameView() throws NoSuchTableException {
.containsExactlyInAnyOrderElementsOf(expected);
}
+ @TestTemplate
+ public void renameQualifiedViewToUnqualifiedTargetKeepsSourceNamespace() {
+ Namespace sourceNamespace = Namespace.of(viewName("rename_source_ns"));
+ Namespace currentNamespace = Namespace.of(viewName("rename_current_ns"));
+ String viewName = viewName("originalView");
+ String renamedView = viewName("renamedView");
+ String sql = String.format("SELECT id FROM %s.%s.%s", catalogName,
NAMESPACE, tableName);
+
+ sql("CREATE NAMESPACE IF NOT EXISTS %s.%s", catalogName, sourceNamespace);
+ sql("CREATE NAMESPACE IF NOT EXISTS %s.%s", catalogName, currentNamespace);
+
+ ViewCatalog viewCatalog = viewCatalog();
+ viewCatalog
+ .buildView(TableIdentifier.of(sourceNamespace, viewName))
+ .withQuery("spark", sql)
+ .withDefaultNamespace(sourceNamespace)
+ .withDefaultCatalog(catalogName)
+ .withSchema(schema(sql))
+ .create();
+
+ sql("USE %s.%s", catalogName, currentNamespace);
+ sql("ALTER VIEW %s.%s RENAME TO %s", sourceNamespace, viewName,
renamedView);
Review Comment:
Yes, it's a specific behavior in rename based on my research.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]