daijy opened a new issue, #11478:
URL: https://github.com/apache/gravitino/issues/11478

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   When Spark loads a non-existent Iceberg table through Gravitino Iceberg 
REST, the first request can fail with 403 Forbidden instead of 404 
NoSuchTableException.
   
   Gravitino checks current-user authorization before validating whether the 
requested table exists. If auth state is cold or expired, Spark reports a 
misleading authorization error even though the table is missing. A retry can 
return the correct NoSuchTableException after auth state is warmed.
   
   ### Error message and/or stacktrace
   
   ```
   org.apache.iceberg.exceptions.ForbiddenException: Forbidden: User 'jidai' is 
not authorized to load table 
'roku.RokuIcebergCatalog.roku.fact_device_intermediate_logs'
       at 
org.apache.iceberg.rest.RESTSessionCatalog.loadTable(RESTSessionCatalog.java:399)
       at org.apache.iceberg.rest.RESTCatalog.loadTable(RESTCatalog.java:106)
       at org.apache.iceberg.CachingCatalog.loadTable(CachingCatalog.java:147)
       at org.apache.iceberg.spark.SparkCatalog.load(SparkCatalog.java:846)
       at org.apache.iceberg.spark.SparkCatalog.loadTable(SparkCatalog.java:170)
       at 
org.apache.spark.sql.connector.catalog.CatalogV2Util$.loadTable(CatalogV2Util.scala:337)
       ......
   
   ```
   
   ### How to reproduce
   
   1. Enable Gravitino Iceberg REST authorization.
   2. Run a Spark query against a table that does not exist.
   3. Trigger the request after auth state is cold or expired.
   
   Expected: NoSuchTableException / 404.
   
   Actual: ForbiddenException / 403 may be returned on the first request.
   
   ### Additional context
   
   Iceberg REST loadTable should validate table/view existence before 
current-user authorization, so missing tables are always reported as 404.


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