[
https://issues.apache.org/jira/browse/HIVE-26433?focusedWorklogId=796132&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796132
]
ASF GitHub Bot logged work on HIVE-26433:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 28/Jul/22 16:38
Start Date: 28/Jul/22 16:38
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #3482:
URL: https://github.com/apache/hive/pull/3482#discussion_r932459551
##########
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/JdbcStorageHandler.java:
##########
@@ -99,7 +101,10 @@ public void configureInputJobProperties(TableDesc
tableDesc, Map<String, String>
@Override
public URI getURIForAuth(Table table) throws URISyntaxException {
Map<String, String> tableProperties =
HiveCustomStorageHandlerUtils.getTableProperties(table);
- String host_url = tableProperties.get(Constants.JDBC_URL);
+ DatabaseType dbType = DatabaseType.valueOf(
+ tableProperties.get(JdbcStorageConfig.DATABASE_TYPE.getPropertyName()));
+ String host_url = DatabaseType.METASTORE == dbType ?
+ "internal:metastore://" : tableProperties.get(Constants.JDBC_URL);
Review Comment:
With the current setup
````
'HivePrivilegeObject':{'type':STORAGEHANDLER_URI, 'dbName':null,
'objectType':STORAGEHANDLER_URI, 'objectName':internal:metastore:///null,
'columns':[], 'partKeys':[], 'commandParams':[], 'actionType':OTHER,
'owner':hive}
````
elements={storage-type=internal:metastore; storage-url=/null; }
Why do we need to remove extra "/" after "metastore?
Issue Time Tracking
-------------------
Worklog Id: (was: 796132)
Time Spent: 0.5h (was: 20m)
> StorageHandler authorization doesn't work with "METASTORE" db type
> ------------------------------------------------------------------
>
> Key: HIVE-26433
> URL: https://issues.apache.org/jira/browse/HIVE-26433
> Project: Hive
> Issue Type: Task
> Reporter: Denys Kuzmenko
> Assignee: Denys Kuzmenko
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> StorageHandler Authorization doesn't work with the "METASTORE" db type:
> {code}
> CREATE EXTERNAL TABLE IF NOT EXISTS `SYS`.`HIVE_LOCKS` (
> `HL_LOCK_EXT_ID` bigint,
> `HL_LOCK_INT_ID` bigint,
> `HL_TXNID` bigint,
> `HL_DB` string,
> `HL_TABLE` string,
> `HL_PARTITION` string,
> `HL_LOCK_STATE` string,
> `HL_LOCK_TYPE` string,
> `HL_LAST_HEARTBEAT` bigint,
> `HL_ACQUIRED_AT` bigint,
> `HL_USER` string,
> `HL_HOST` string,
> `HL_HEARTBEAT_COUNT` int,
> `HL_AGENT_INFO` string,
> `HL_BLOCKEDBY_EXT_ID` bigint,
> `HL_BLOCKEDBY_INT_ID` bigint
> )
> STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler'
> TBLPROPERTIES (
> "hive.sql.database.type" = "METASTORE",
> "hive.sql.query" =
> "SELECT
> \"HL_LOCK_EXT_ID\",
> \"HL_LOCK_INT_ID\",
> \"HL_TXNID\",
> \"HL_DB\",
> \"HL_TABLE\",
> \"HL_PARTITION\",
> \"HL_LOCK_STATE\",
> \"HL_LOCK_TYPE\",
> \"HL_LAST_HEARTBEAT\",
> \"HL_ACQUIRED_AT\",
> \"HL_USER\",
> \"HL_HOST\",
> \"HL_HEARTBEAT_COUNT\",
> \"HL_AGENT_INFO\",
> \"HL_BLOCKEDBY_EXT_ID\",
> \"HL_BLOCKEDBY_INT_ID\"
> FROM \"HIVE_LOCKS\""
> );
> {code}
> Exception thrown:
> {code}
> Error: Error while compiling statement: FAILED: HiveAccessControlException
> Permission denied: user [hive] does not have [RWSTORAGE] privilege on
> [null/null] (state=42000,code=40000)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)