roryqi commented on code in PR #11318:
URL: https://github.com/apache/gravitino/pull/11318#discussion_r3332202007
##########
catalogs/catalog-common/src/main/java/org/apache/gravitino/catalog/lakehouse/iceberg/IcebergConstants.java:
##########
@@ -38,6 +38,8 @@ public class IcebergConstants {
public static final String GRAVITINO_JDBC_SCHEMA_VERSION =
"jdbc-schema-version";
public static final String ICEBERG_JDBC_SCHEMA_VERSION =
"jdbc.schema-version";
+ public static final String ICEBERG_JDBC_STRICT_MODE = "jdbc.strict-mode";
Review Comment:
Good catch. Added a `gravitino.iceberg-rest.jdbc.strict-mode` row (default
`true`, since 1.3.0) to the JDBC backend configuration table in
`docs/iceberg-rest-service.md` in f657fb093.
##########
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:
Added `IcebergRESTServiceIT#testCreateViewInNonExistentNamespace` in
f657fb093, which creates a source table in an existing namespace and then
asserts that `CREATE VIEW` in a non-existent namespace surfaces a
`NoSuchNamespace` error (gated by `@EnabledIf("isSupportsViewCatalog")`).
--
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]