[ 
https://issues.apache.org/jira/browse/HIVE-26433?focusedWorklogId=796442&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796442
 ]

ASF GitHub Bot logged work on HIVE-26433:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jul/22 16:31
            Start Date: 29/Jul/22 16:31
    Worklog Time Spent: 10m 
      Work Description: saihemanth-cloudera commented on code in PR #3482:
URL: https://github.com/apache/hive/pull/3482#discussion_r933439946


##########
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:
   Yeah, having `jdbc://internal:metastore:/` would be consistent with other 
Storage URIs. But I'm ok with your above suggestion as well.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 796442)
    Time Spent: 50m  (was: 40m)

> 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: 50m
>  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)

Reply via email to