ebyhr commented on code in PR #14212:
URL: https://github.com/apache/iceberg/pull/14212#discussion_r2389473826


##########
spark/v4.0/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -2113,6 +2113,26 @@ public void createViewWithCustomMetadataLocation() {
                 ""));
   }
 
+  @TestTemplate
+  public void createViewWithCustomMetadataLocationWithLocation() {
+    String viewName = viewName("v");
+    String customMetadataLocation =
+        Paths.get(temp.toUri().toString(), 
"custom-metadata-location").toString();
+    sql(
+        "CREATE VIEW %s TBLPROPERTIES ('%s'='%s') AS SELECT * FROM %s",
+        viewName, "location", customMetadataLocation, tableName);

Review Comment:
   nit: `"location"` can be inlined. 



##########
docs/docs/view-configuration.md:
##########
@@ -28,7 +28,7 @@ Iceberg views support properties to configure view behavior. 
Below is an overvie
 | Property                         | Default                   | Description   
                                                                     |
 
|----------------------------------|---------------------------|------------------------------------------------------------------------------------|
 | write.metadata.compression-codec | gzip                      | Metadata 
compression codec: `none` or `gzip`                                       |
-| write.metadata.path              | view location + /metadata | Base location 
for metadata files                                                   |
+| location                         | view location + /metadata | Base location 
for metadata files                                                   |

Review Comment:
   The "location" isn't actually a property, right? 
   
   Readers of the docs might mistakenly think they can set a custom location 
with `ViewBuilder#withProperty("location", xxx)`. Instead, they should use 
`ViewBuilder#withLocation`.



##########
spark/v4.0/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -2113,6 +2113,26 @@ public void createViewWithCustomMetadataLocation() {
                 ""));
   }
 
+  @TestTemplate
+  public void createViewWithCustomMetadataLocationWithLocation() {
+    String viewName = viewName("v");
+    String customMetadataLocation =
+        Paths.get(temp.toUri().toString(), 
"custom-metadata-location").toString();
+    sql(
+        "CREATE VIEW %s TBLPROPERTIES ('%s'='%s') AS SELECT * FROM %s",
+        viewName, "location", customMetadataLocation, tableName);
+    String location = viewCatalog().loadView(TableIdentifier.of(NAMESPACE, 
viewName)).location();
+
+    assertThat(sql("DESCRIBE EXTENDED %s", viewName))
+        .contains(
+            row(
+                "View Properties",
+                String.format(
+                    "['format-version' = '1', 'location' = '%s', 'provider' = 
'iceberg']",
+                    customMetadataLocation),
+                ""));

Review Comment:
   We could use `SHOW TBLPROPERTIES %s (location)` if `format-version` & 
`provider` aren't important in this test: 
   ```java
       assertThat(sql("SHOW TBLPROPERTIES %s (location)", viewName))
           .contains(row("location", customMetadataLocation));
   ```



##########
core/src/main/java/org/apache/iceberg/view/ViewProperties.java:
##########
@@ -25,7 +25,12 @@ public class ViewProperties {
 
   public static final String METADATA_COMPRESSION = 
"write.metadata.compression-codec";
   public static final String METADATA_COMPRESSION_DEFAULT = "gzip";
-  public static final String WRITE_METADATA_LOCATION = "write.metadata.path";
+
+  /**
+   * @deprecated will be removed in 2.0.0, use location instead.

Review Comment:
   nit: We could replace `location` with `{@link ViewBuilder#withLocation}`. 



##########
spark/v4.0/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -2113,6 +2113,26 @@ public void createViewWithCustomMetadataLocation() {
                 ""));
   }
 
+  @TestTemplate
+  public void createViewWithCustomMetadataLocationWithLocation() {
+    String viewName = viewName("v");
+    String customMetadataLocation =
+        Paths.get(temp.toUri().toString(), 
"custom-metadata-location").toString();
+    sql(
+        "CREATE VIEW %s TBLPROPERTIES ('%s'='%s') AS SELECT * FROM %s",
+        viewName, "location", customMetadataLocation, tableName);
+    String location = viewCatalog().loadView(TableIdentifier.of(NAMESPACE, 
viewName)).location();

Review Comment:
   `location` variable is unused. Perhaps, 
`assertThat(location).isEqualTo(customMetadataLocation)` is missing? 



-- 
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]

Reply via email to