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


##########
spark/v4.0/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestViews.java:
##########
@@ -2113,6 +2113,22 @@ 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 ('location'='%s') AS SELECT * FROM %s",
+        viewName, customMetadataLocation, tableName);
+
+    assertThat(sql("SHOW TBLPROPERTIES %s", viewName))
+        .contains(row("location", customMetadataLocation));
+
+    String location = viewCatalog().loadView(TableIdentifier.of(NAMESPACE, 
viewName)).location();
+    assertThat(location).isEqualTo(customMetadataLocation);
+  }
+

Review Comment:
   I did a quick test, actually Spark only has ALTER TABLE … SET LOCATION; It 
doesn't have ALTER VIEW … SET LOCATION
   ```
   sql("ALTER VIEW test_view SET TBLPROPERTIES ('location' = '/updated/path')")
   ```
   issued
   ```
   [UNSUPPORTED_FEATURE.SET_TABLE_PROPERTY] The feature is not supported: 
location is a reserved table property, please use the LOCATION clause to 
specify it. SQLSTATE: 0A000
   == SQL (line 1, position 1) ==
   ALTER VIEW test_view SET TBLPROPERTIES ('location' = '/updated/path')
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```
   but 
   ```
   sql("ALTER VIEW test_view SET LOCATION '/new/table/location'")
   ```
   doesn't work, it gave
   ```
   [PARSE_SYNTAX_ERROR] Syntax error at or near 'LOCATION'. SQLSTATE: 42601 
(line 1, pos 25)
   
   == SQL ==
   ALTER VIEW test_view SET LOCATION '/new/table/location'
   -------------------------^^^
   ```
   



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