nastra commented on code in PR #12017:
URL: https://github.com/apache/iceberg/pull/12017#discussion_r1932465818


##########
core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java:
##########
@@ -239,6 +239,36 @@ public void completeCreateView() {
     assertThat(catalog().viewExists(identifier)).as("View should not 
exist").isFalse();
   }
 
+  @Test
+  public void createViewWithCustomMetadataLocation() {
+    TableIdentifier identifier = TableIdentifier.of("ns", "view");
+
+    if (requiresNamespaceCreate()) {
+      catalog().createNamespace(identifier.namespace());
+    }
+
+    assertThat(catalog().viewExists(identifier)).as("View should not 
exist").isFalse();
+
+    String location = Paths.get(tempDir.toUri().toString()).toString();
+    String customLocation = Paths.get(tempDir.toUri().toString(), 
"custom-location").toString();
+
+    View view =
+        catalog()
+            .buildView(identifier)
+            .withSchema(SCHEMA)
+            .withDefaultNamespace(identifier.namespace())
+            .withDefaultCatalog(catalog().name())
+            .withQuery("spark", "select * from ns.tbl")
+            .withProperty("write.metadata.path", customLocation)
+            .withLocation(location)
+            .create();
+
+    assertThat(view).isNotNull();
+    assertThat(catalog().viewExists(identifier)).as("View should 
exist").isTrue();
+    assertThat(view.properties()).containsEntry("write.metadata.path", 
customLocation);
+    assertThat(((BaseView) 
view).operations().current().metadataFileLocation()).isNotNull();

Review Comment:
   maybe also add a `.startsWith(customLocation)` check at the end



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to