Apache Iceberg version
Reproduced in 1.5.0. relevant also for latest (1.10.0)
Query engine
Spark
Please describe the bug 🐞
When using the apache/iceberg-rest-fixture Docker image, the REST server allows a user to drop a namespace that contains nested sub-namespaces, as long as the parent namespace does not directly contain any tables. This violates the REST OpenAPI specification for DELETE /v1/{prefix}/namespaces/{namespace}, which states: "Namespace deletions must be empty and not contain any tables or child namespaces."
To Reproduce
Using PySpark with the REST catalog pointing to the apache/iceberg-rest-fixture server:
# 1. Create a parent namespace
spark.sql("CREATE NAMESPACE IF NOT EXISTS n1")
# 2. Create a child namespace and a table inside the child
spark.sql("CREATE NAMESPACE IF NOT EXISTS n1.n2")
spark.sql("CREATE TABLE IF NOT EXISTS n1.n2.t2 (id INT) USING iceberg")
# 3. Attempt to drop the parent (NO CASCADE)
# EXPECTED: Failure (NamespaceNotEmptyException) because n1.n2 exists.
# ACTUAL: Success (200 OK). The parent is dropped, orphaning n1.n2.t2.
spark.sql("DROP NAMESPACE n1")
Note on Behavior:
If I add a table directly to the parent (CREATE TABLE n1.t1), the server correctly rejects the DROP NAMESPACE n1 command. It seems the fixture only performs a shallow table check, ignoring nested namespaces.
Expected Behavior:
The REST server should return an HTTP 4xx error (translating to NamespaceNotEmptyException) when dropping n1 because the child namespace n1.n2 still exists.
Environment:
Spark Version: 3.5.x
Iceberg Version: 1.5.0
Catalog: apache/iceberg-rest-fixture running via Docker
Willingness to contribute
Apache Iceberg version
Reproduced in 1.5.0. relevant also for latest (1.10.0)
Query engine
Spark
Please describe the bug 🐞
When using the apache/iceberg-rest-fixture Docker image, the REST server allows a user to drop a namespace that contains nested sub-namespaces, as long as the parent namespace does not directly contain any tables. This violates the REST OpenAPI specification for DELETE /v1/{prefix}/namespaces/{namespace}, which states: "Namespace deletions must be empty and not contain any tables or child namespaces."
To Reproduce
Using PySpark with the REST catalog pointing to the apache/iceberg-rest-fixture server:
Note on Behavior:
If I add a table directly to the parent (CREATE TABLE n1.t1), the server correctly rejects the DROP NAMESPACE n1 command. It seems the fixture only performs a shallow table check, ignoring nested namespaces.
Expected Behavior:
The REST server should return an HTTP 4xx error (translating to NamespaceNotEmptyException) when dropping n1 because the child namespace n1.n2 still exists.
Environment:
Spark Version: 3.5.x
Iceberg Version: 1.5.0
Catalog: apache/iceberg-rest-fixture running via Docker
Willingness to contribute