Skip to content

Conversation

@hdygxsj
Copy link
Collaborator

@hdygxsj hdygxsj commented Nov 25, 2025

What changes were proposed in this pull request?

fix list tags for columns error

Why are the changes needed?

Fix: #9238

Does this PR introduce any user-facing change?

None

How was this patch tested?

org.apache.gravitino.client.integration.test.authorization.TagOperationsAuthorizationIT#testListColumnTag

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where listing tags on columns failed due to missing authorization handling for the COLUMN entity type. The fix adds proper hierarchy extraction for column identifiers, ensuring that authorization checks can properly validate access through the column's parent entities (table, schema, catalog).

Key Changes

  • Added COLUMN case handling in MetadataAuthzHelper.spiltMetadataNames() to extract parent entity identifiers
  • Implemented getTableIdentifier() utility method to extract table identifiers from column identifiers
  • Added integration test testListColumnTag() to verify column tag listing works correctly

Reviewed changes

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

File Description
server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataAuthzHelper.java Added COLUMN case to extract parent entity hierarchy (table, schema, catalog) for authorization checks
core/src/main/java/org/apache/gravitino/utils/NameIdentifierUtil.java Implemented getTableIdentifier() method to extract table identifier from column identifiers
clients/client-java/src/test/java/org/apache/gravitino/client/integration/test/authorization/TagOperationsAuthorizationIT.java Added integration test to verify column tag listing with authorization enabled

@jerqi
Copy link
Contributor

jerqi commented Nov 26, 2025

Could you correct your description?

String metalake, Entity.EntityType entityType, NameIdentifier nameIdentifier) {
Map<Entity.EntityType, NameIdentifier> nameIdentifierMap = new HashMap<>();
nameIdentifierMap.put(Entity.EntityType.METALAKE, NameIdentifierUtil.ofMetalake(metalake));
switch (entityType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have added the two methods

parentEntityType

and

parentNameIdentifier

You can use these methods to refactor the logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@jerqi
Copy link
Contributor

jerqi commented Nov 27, 2025

Wait for CI. LGTM.

@jerqi
Copy link
Contributor

jerqi commented Nov 27, 2025

Could u correct the description?

@hdygxsj
Copy link
Collaborator Author

hdygxsj commented Nov 27, 2025

Could u correct the description?

fixed

@hdygxsj hdygxsj changed the title [#9238] fix(authz): fix list column tag error [#9238] fix(authz): fix list tags for columns error Nov 27, 2025
@jerqi jerqi merged commit 8303a04 into apache:main Nov 27, 2025
26 checks passed
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.

[Bug report] Auth: Failed to list tags for columns

2 participants