[#10685] feat(iceberg-rest): Support vended credentials on planTableScan endpoint#10800
Open
sachinnn99 wants to merge 1 commit intoapache:mainfrom
Open
[#10685] feat(iceberg-rest): Support vended credentials on planTableScan endpoint#10800sachinnn99 wants to merge 1 commit intoapache:mainfrom
sachinnn99 wants to merge 1 commit intoapache:mainfrom
Conversation
…TableScan endpoint Accept X-Iceberg-Access-Delegation on planTableScan and merge storage credentials into the scan response when vended-credentials is requested, matching the pattern already used by createTable/loadTable/registerTable. PlanTableScanResponse in Iceberg 1.10.1 has no config map or credential field (added in 1.11.0 via iceberg PR #14518), so credentials are merged into the response JSON at the endpoint. Credential generation itself runs through the wrapper's shouldGenerateCredential gate (so local/HDFS tables correctly return no credentials).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Add
X-Iceberg-Access-Delegationheader support to theplanTableScanendpoint and return storage credentials in the response whenvended-credentialsis requested. Mirrors the existing credential-vending flow fromcreateTable/loadTable/registerTable(#10684).Changes:
IcebergTableOperations.planTableScan: add@HeaderParam(X_ICEBERG_ACCESS_DELEGATION), computeisCredentialVending, build the 3-argIcebergRequestContext, mergestorage-credentialsinto the response JSON when eligibleIcebergTableOperations: injectIcebergCatalogWrapperManager(same pattern asIcebergConfigOperations) and add a privatebuildScanResponseWithCredentialshelper that serializes the response to anObjectNodeand appends thestorage-credentialsarrayCatalogWrapperForREST: addgetCredentialsIfEligible(identifier, requestCredential, privilege)that wrapsshouldGenerateCredential+getCredentialand returns credentials separately, reusing the same Gravitino→Iceberg credential conversion pattern asgetTableCredentialsMockIcebergTableOperations: update constructor to match the parentTestIcebergTableOperations: add three tests —testPlanTableScanWithCredentialVending(no header / local / S3),testPlanTableScanRemoteSigningNotSupported,testPlanTableScanInvalidAccessDelegationNote:
PlanTableScanResponsein Iceberg 1.10.1 has noconfig/credentialsfield (credentials support was added in Iceberg PR #14518, targeting 1.11.0+). Credentials are therefore merged into the response JSON at the endpoint. When Gravitino upgrades to Iceberg 1.11.0+, the JSON-level merge can be replaced with a directPlanTableScanResponse.Builder.withCredentials(...)call inCatalogWrapperForREST.planTableScan. Credential eligibility (shouldGenerateCredential) is still enforced at the wrapper level so local/HDFS tables correctly receive no credentials.Why are the changes needed?
The Iceberg REST spec defines
X-Iceberg-Access-Delegationas a valid header onplanTableScanandCompletedPlanningResultincludes astorage-credentialsfield. Currently, clients performing server-side scan planning must make a separateGET .../credentialscall to obtain storage access credentials before reading the data files returned in the scan plan.Fix: #10685
Does this PR introduce any user-facing change?
Yes. The
planTableScanREST endpoint now accepts theX-Iceberg-Access-Delegationheader and returns vended credentials in the responsestorage-credentialsfield when requested. Backward compatible — clients that do not send the header get existing behavior.How was this patch tested?
Added unit tests in
TestIcebergTableOperations:testPlanTableScanWithCredentialVending— no vending without header, no vending forfile://location, vending present fors3://location with expectedDUMMY_CREDENTIAL_TYPEtestPlanTableScanRemoteSigningNotSupported— 406 response forremote-signingtestPlanTableScanInvalidAccessDelegation— 400 response for invalid header valuesAll existing
TestIcebergTableOperationstests still pass (no regressions).