geruh opened a new pull request, #14660:
URL: https://github.com/apache/iceberg/pull/14660

   ## Summary
   
   This PR fixes scan planning behavior for empty tables in both sync and async 
modes. While testing the rest fixture, I found that scanning empty tables 
throws `NoSuchPlanIdException`. This changes the behavior to return an empty 
plan instead.
   
   **Error:**
   ```
   {
     "error": {
       "message": "Could not find plan ID ccccab5e-9195-422d-b9c0-86b6b6feecad",
       "type": "NoSuchPlanIdException",
       "code": 404,
       "stack": [
         "org.apache.iceberg.exceptions.NoSuchPlanIdException: Could not find 
plan ID ccccab5e-9195-422d-b9c0-86b6b6feecad",
         "\tat 
org.apache.iceberg.rest.InMemoryPlanningState.initialScanTasksFor(InMemoryPlanningState.java:116)",
         "\tat 
org.apache.iceberg.rest.CatalogHandlers.planTableScan(CatalogHandlers.java:675)",
         "\tat 
org.apache.iceberg.rest.RESTCatalogAdapter.handleRequest(RESTCatalogAdapter.java:311)",
         ....
       ]
     }
   }
   ```   
   
   ## Testing
   
   **Testing with the Docker fixture:**
   
   ```
     curl -X POST http://localhost:8181/v1/namespaces/test/tables/empty/plan \
       -H "Content-Type: application/json" \
       -d '{"case-sensitive": false}'
   ```
      
   
   **Returns an empty scan with the fix!**
   ```
   
{"status":"completed","plan-id":"sync-a1d448e2-c976-4bca-9a02-92a106e535ae","plan-tasks":[],"file-scan-tasks":[]}
   ```
   
   >  Note: There aren't any tests for scan planning yet, but those are being 
added in the client side pr.
   
   cc: @singhpk234 @amogh-jahagirdar @kevinjqliu 


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