Skip to content

Fix view grants on federated catalogs#5096

Open
ayushtkn wants to merge 1 commit into
apache:mainfrom
ayushtkn:viewGrants
Open

Fix view grants on federated catalogs#5096
ayushtkn wants to merge 1 commit into
apache:mainfrom
ayushtkn:viewGrants

Conversation

@ayushtkn

Copy link
Copy Markdown
Member

Granting or revoking a privilege on a view in a federated (passthrough) catalog always failed with Failed to create or find table entity '' in federated catalog '', while the same operation on a table worked fine.
The cause is in PolarisAdminService.createSyntheticTableLikeEntities: it synthesizes the entity with the caller's intended subtype via selectEntitySubType(subTypes) (which is ICEBERG_VIEW for a view), but the post-creation validation of the re-resolved leaf was hard-coded to accept only ICEBERG_TABLE, so a correctly-created view leaf failed the check and the method threw.
This changes that check to subTypes.contains(leafEntity.getSubType()), validating against the subtypes the caller actually requested and consistent with how the synthetic entity was created.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Copilot AI review requested due to automatic review settings July 19, 2026 15:54
@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jul 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes granting/revoking privileges on views in federated (passthrough) catalogs by aligning synthetic entity post-creation validation with the caller-requested table-like subtypes, preventing correctly-created ICEBERG_VIEW leaves from being rejected.

Changes:

  • Update createSyntheticTableLikeEntities validation to accept any resolved leaf subtype included in the caller’s requested subTypes list (instead of hard-coding ICEBERG_TABLE).
  • Add a passthrough-facade regression test covering view privilege grants that require synthetic table-like entity creation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java Fixes subtype validation for synthetic table-like entities in federated catalogs to support views.
runtime/service/src/test/java/org/apache/polaris/service/admin/PolarisAdminServiceTest.java Adds regression coverage for granting privileges on views via passthrough facade when synthetic creation is required.
Comments suppressed due to low confidence (1)

runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java:2358

  • The exception message still says "table entity" even though this code path now legitimately handles views (and other table-like subtypes). This can be confusing when troubleshooting failed grants on views in federated catalogs; consider making the message subtype-agnostic (e.g., "table-like entity").
            && subTypes.contains(leafEntity.getSubType())
            && Objects.equals(leafEntity.getName(), identifier.name()))) {
      throw new RuntimeException(
          String.format(
              "Failed to create or find table entity '%s' in federated catalog '%s'",

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants