bharos opened a new pull request, #10767:
URL: https://github.com/apache/gravitino/pull/10767

   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): Support xxx"
        - "[#233] fix: Check null before access result in xxx"
        - "[MINOR] refactor: Fix typo in variable name"
        - "[MINOR] docs: Fix typo in README"
        - "[#255] test: Fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   
   When credential vending is enabled, 
`IcebergTableHookDispatcher.createTable()` now
   skips `importTable()` and `setTableOwner()` for staged creates 
(`stageCreate=true`).
   Instead, the import and ownership assignment are deferred to 
`updateTable()`, which
   checks if the table entity already exists in the EntityStore and, if not 
(i.e., a
   staged create being committed), performs the import and ownership setup at 
that point.
   
   
   ### Why are the changes needed?
   
   With credential vending enabled, Trino sends all CREATE TABLE requests with
   `stageCreate=true`. The Iceberg REST protocol stages the table (builds 
metadata
   in memory without committing) and returns vended credentials. The table is 
only
   committed to the catalog when the client later calls `updateTable`.
   
   `IcebergTableHookDispatcher.createTable()` unconditionally called 
`importTable()`,
   which tried to load the non-existent table from the catalog and threw
   `NoSuchTableException`, failing every table create when credential vending 
is active.
   
   Fix: #10766 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This fixes an internal error that prevented table creation when 
credential
   vending was enabled. No API or property changes.
   
   ### How was this patch tested?
   
   - Added `testCreateTableSkipsImportAndOwnershipForStageCreate` — verifies
     `importTable` and `setTableOwner` are NOT called when `stageCreate=true`
   - Added `testUpdateTableImportsAndSetsOwnershipForStagedCommit` — verifies
     import and ownership are called when entity doesn't exist (staged commit)
   - Updated `testUpdateTablePassesThrough` — verifies import is skipped for
     regular updates where the entity already exists
   - All 11 tests in `TestIcebergTableHookDispatcher` pass


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