Copilot commented on code in PR #11318:
URL: https://github.com/apache/gravitino/pull/11318#discussion_r3332176942


##########
iceberg/iceberg-rest-server/src/test/java/org/apache/gravitino/iceberg/integration/test/IcebergRESTServiceIT.java:
##########
@@ -305,6 +305,37 @@ void testCreateTable() {
         () -> sql(String.format("CREATE TABLE %s.create_foo1", 
getTestNamespace())));
   }
 
+  @Test
+  void testCreateTableInNonExistentNamespace() {
+    // The child namespace is intentionally never created.
+    String namespaceName = getTestNamespace("absent_create_ns");
+    Throwable thrown =
+        Assertions.assertThrows(
+            Throwable.class,
+            () ->
+                sql(
+                    String.format(
+                        "CREATE TABLE %s.create_in_absent(id bigint) using 
iceberg",
+                        namespaceName)));
+    // Creating a table in a namespace that does not exist must surface a 
NoSuchNamespace error
+    // (HTTP 404) instead of implicitly creating the namespace. This holds for 
the memory and hive
+    // backends, and for the JDBC backend now that strict mode is enabled by 
default.
+    Assertions.assertTrue(
+        isNoSuchNamespace(thrown), () -> "Expected a NoSuchNamespace error but 
got: " + thrown);
+  }

Review Comment:
   This test validates missing-namespace behavior for table creation, but the 
PR also changes behavior for view creation in JDBC strict mode (as noted in the 
description). Adding an assertion for `CREATE VIEW` in a non-existent namespace 
would prevent regressions where tables fail correctly but views still 
implicitly create namespaces or return a different error.



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

Reply via email to