sagib1 opened a new issue, #16060:
URL: https://github.com/apache/iceberg/issues/16060

   ### Apache Iceberg version
   
   1.5.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
   
   - [x] I can contribute a fix for this bug independently
   - [x] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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