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

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

                Author: ASF GitHub Bot
            Created on: 17/May/22 23:08
            Start Date: 17/May/22 23:08
    Worklog Time Spent: 10m 
      Work Description: saihemanth-cloudera commented on code in PR #3247:
URL: https://github.com/apache/hive/pull/3247#discussion_r875334956


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/misc/rename/AbstractAlterTableRenameAnalyzer.java:
##########
@@ -48,7 +54,12 @@ protected void analyzeCommand(TableName tableName, 
Map<String, String> partition
     if (AcidUtils.isTransactionalTable(table)) {
       setAcidDdlDesc(desc);
     }
-    addInputsOutputsAlterTable(tableName, null, desc, desc.getType(), false);

Review Comment:
   I tried to implement essential logic in that method here which is organizing 
input and output object lists. But I now added back the method and added the 
output list in a way that we would need it in Apache Ranger.



##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/SQLAuthorizationUtils.java:
##########
@@ -269,7 +269,19 @@ private static boolean isOwner(IMetaStoreClient 
metastoreClient, String userName
         thriftTableObj = metastoreClient.getTable(hivePrivObject.getDbname(),
             hivePrivObject.getObjectName());
       } catch (Exception e) {
-        throwGetObjErr(e, hivePrivObject);
+        boolean isTableExists = true;
+        try {
+          isTableExists = 
metastoreClient.tableExists(hivePrivObject.getDbname(), 
hivePrivObject.getObjectName());

Review Comment:
   Ack



##########
itests/util/src/main/java/org/apache/hadoop/hive/ql/hooks/VerifyOutputTableLocationSchemeIsFileHook.java:
##########
@@ -24,10 +24,10 @@ public class VerifyOutputTableLocationSchemeIsFileHook 
implements ExecuteWithHoo
 
   @Override
   public void run(HookContext hookContext) {
-    for (WriteEntity output : hookContext.getOutputs()) {
-      if (output.getType() == WriteEntity.Type.TABLE) {
-        String scheme = 
output.getTable().getDataLocation().toUri().getScheme();
-        Assert.assertTrue(output.getTable().getTableName() + " has a location 
which has a " +
+    for (ReadEntity input : hookContext.getInputs()) {

Review Comment:
   Yeah, this change is an intended one. This class is only used in 
rename_table_location.q file and it is used  to verify the table object and its 
location. Previously, output and input had the old table objects for 
authorization. Now, we would like to have the old table in the input list and 
the new database and table object in the output list.





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

    Worklog Id:     (was: 771636)
    Time Spent: 0.5h  (was: 20m)

> Fix the HivePrivilegesObjects for Alter table rename command
> ------------------------------------------------------------
>
>                 Key: HIVE-26055
>                 URL: https://issues.apache.org/jira/browse/HIVE-26055
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2, Security
>            Reporter: Sai Hemanth Gantasala
>            Assignee: Sai Hemanth Gantasala
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Fix the HivePrivilegeObjects for Alter table rename query in a way that it 
> includes source table information in the output objects and destination table 
> information in the input objects.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to