Skip to content

Conversation

@okumin
Copy link
Contributor

@okumin okumin commented Nov 7, 2025

What changes were proposed in this pull request?

Add a prefixed message, Got exception: org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAccessControlException, to MetaException when HiveMetaStoreAuthorizer handles HiveAccessControlException, and make HiveCatalog translate it to Iceberg's ForbiddenException.

This Pull Request implements the first option in the following document, and I'm not obsessed with this option; I chose it first because the change is minimal(easy to revert). I'm open to Option 2 or 3, or another suggestion.
https://docs.google.com/document/d/1SMvIud9k5lVSzqjgCzohHH59oW5MWAwA9BW-pPr9yIc/edit?usp=sharing

https://issues.apache.org/jira/browse/HIVE-29248

Why are the changes needed?

Currently, when Ranger rejects an access, HiveMetastore throws MetaException(message:<Message thrown by Ranger>), and a Thrift client can't get more information than the error message implemented in Apache Ranger. It's inconvenient for an Iceberg client such as Spark to distinguish the root cause and Iceberg REST API can't return a proper status code, i.e., 403.

Does this PR introduce any user-facing change?

No. The error message will contain more information.

How was this patch tested?

I added integration tests to verify that thrown exceptions are handled correctly.

@sonarqubecloud
Copy link

@okumin okumin marked this pull request as ready for review November 11, 2025 07:04

private boolean isAccessControlException(MetaException exception) {
return exception.getMessage() != null && exception.getMessage().startsWith(
"Got exception: org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAccessControlException");
Copy link
Member

Choose a reason for hiding this comment

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

should we just check for contains "org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAccessControlException" ?

<!-- Test dependencies -->
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
Copy link
Member

@deniskuzZ deniskuzZ Nov 17, 2025

Choose a reason for hiding this comment

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

why do we need ql dependency here? HMS is supposed to be standalone project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants