Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28356: HMS’s Authorizer for the CREATE_TABLE event doesn’t handle HivePrivilegeObjectType.STORAGEHANDLER_URI #5343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanielZhu58
Copy link
Contributor

What changes were proposed in this pull request?

Why are the changes needed?

Does this PR introduce any user-facing change?

Is the change a dependency upgrade?

How was this patch tested?

.setTableName(tblName)
.addCol("name", ColumnType.STRING_TYPE_NAME)
.setOwner(authorizedUser)
.build(conf);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a normal table, not a storage handler-based table. We need to verify a storage handler-based table.

@@ -64,6 +61,12 @@ protected HivePrivilegeObject getHivePrivilegeObject(Table table) {
table.getOwner(), table.getOwnerType());
}

protected HivePrivilegeObject getHivePrivilegeObjectStorageHandlerUri(String storagehandler_uri, Table table) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is not used anymore now.

@saihemanth-cloudera
Copy link
Contributor

The only test failure seems to be the newly added test. It looks like you haven't run the test locally, so make sure it runs fine before pushing it here.

@nrg4878
Copy link
Contributor

nrg4878 commented Jul 30, 2024

@ayushtkn @deniskuzZ Could you please review this PR.

@@ -88,7 +110,9 @@ private List<HivePrivilegeObject> getOutputHObjs() {

COMMAND_STR = buildCommandString(COMMAND_STR,table);

LOG.debug("<== CreateTableEvent.getOutputHObjs(): ret={}", ret);
if (LOG.isDebugEnabled()) {
Copy link
Member

Choose a reason for hiding this comment

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

minor, but why do we need this check?

HiveStorageHandler hiveStorageHandler = (HiveStorageHandler) ReflectionUtils.newInstance(
conf.getClassByName(table.getParameters().get(hive_metastoreConstants.META_TABLE_STORAGE)), event.getHandler().getConf());
String storageUri = hiveStorageHandler.getURIForAuth(table).toString();
if (storageUri.contains("iceberg")) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to check for iceberg?
This code looks similar to AlterTableEvent#getOutputHObjs

Copy link

sonarcloud bot commented Aug 16, 2024

import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.api.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: incorrect imports

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.util.ReflectionUtils;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: All the newly added imports are in an incorrect order. They should follow alphabetical order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants