This is an automated email from the ASF dual-hosted git repository.

gsaihemanth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 67277049b83 HIVE-28325: Slow compilation without owner information 
with Ranger au… (#5298) (Stephen Carlin, Reviewed by John Sherman, Sai Hemanth 
Gantasala)
67277049b83 is described below

commit 67277049b837b87527631cc7af63b7b10c1e814b
Author: scarlin-cloudera <55709772+scarlin-cloud...@users.noreply.github.com>
AuthorDate: Fri Jun 14 17:16:57 2024 -0700

    HIVE-28325: Slow compilation without owner information with Ranger au… 
(#5298) (Stephen Carlin, Reviewed by John Sherman, Sai Hemanth Gantasala)
---
 ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java   | 6 ++++--
 .../hive/ql/security/authorization/plugin/HivePrivilegeObject.java  | 6 ++++++
 .../clientpositive/llap/authorization_privilege_objects.q.out       | 6 +++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index e82281b728c..44e04e6c635 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -12750,7 +12750,8 @@ public class SemanticAnalyzer extends 
BaseSemanticAnalyzer {
             List<String> colNames = new ArrayList<>();
             extractColumnInfos(table, colNames, new ArrayList<>());
 
-            basicInfos.put(new HivePrivilegeObject(table.getDbName(), 
table.getTableName(), colNames), null);
+            basicInfos.put(new HivePrivilegeObject(table.getDbName(), 
table.getTableName(), colNames,
+                table.getOwner(), table.getOwnerType()), null);
           }
         } else {
           List<String> colNames;
@@ -12766,7 +12767,8 @@ public class SemanticAnalyzer extends 
BaseSemanticAnalyzer {
             extractColumnInfos(table, colNames, colTypes);
           }
 
-          basicInfos.put(new HivePrivilegeObject(table.getDbName(), 
table.getTableName(), colNames),
+          basicInfos.put(new HivePrivilegeObject(table.getDbName(), 
table.getTableName(), colNames,
+              table.getOwner(), table.getOwnerType()),
               new MaskAndFilterInfo(colTypes, additionalTabInfo.toString(), 
alias, astNode, table.isView(), table.isNonNative()));
         }
       }
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java
index 8c756105820..796a062bbbe 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java
@@ -179,6 +179,12 @@ public class HivePrivilegeObject implements 
Comparable<HivePrivilegeObject> {
     this(HivePrivilegeObjectType.TABLE_OR_VIEW, dbname, objectName, null, 
columns, null);
   }
 
+  public HivePrivilegeObject(String dbname, String objectName, List<String> 
columns,
+      String ownerName, PrincipalType ownerType) {
+    this(HivePrivilegeObjectType.TABLE_OR_VIEW, dbname, objectName, null, 
columns,
+        HivePrivObjectActionType.OTHER, null, null, ownerName, ownerType);
+  }
+
   public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname, 
String objectName, List<String> partKeys,
       List<String> columns, HivePrivObjectActionType actionType, List<String> 
commandParams, String className) {
     this(type, dbname, objectName, partKeys, columns, actionType, 
commandParams, className, null, null);
diff --git 
a/ql/src/test/results/clientpositive/llap/authorization_privilege_objects.q.out 
b/ql/src/test/results/clientpositive/llap/authorization_privilege_objects.q.out
index 7fc7b371c31..e5e86fadd61 100644
--- 
a/ql/src/test/results/clientpositive/llap/authorization_privilege_objects.q.out
+++ 
b/ql/src/test/results/clientpositive/llap/authorization_privilege_objects.q.out
@@ -50,7 +50,7 @@ POSTHOOK: Input: database:test_auth_obj_db
 test_privs
 test_privs2
 applyRowFilterAndColumnMasking:
-HIVE PRIVILEGE OBJECT { objectName: test_privs type: TABLE_OR_VIEW actionType: 
OTHER dbName: test_auth_obj_db columns: [i]}
+HIVE PRIVILEGE OBJECT { objectName: test_privs type: TABLE_OR_VIEW actionType: 
OTHER dbName: test_auth_obj_db OWNER: testuser OWNERTYPE: USER columns: [i]}
 inputHObjs:
 HIVE PRIVILEGE OBJECT { objectName: test_privs type: TABLE_OR_VIEW actionType: 
OTHER dbName: test_auth_obj_db OWNER: testuser OWNERTYPE: USER}
 PREHOOK: query: EXPLAIN SELECT * FROM test_auth_obj_db.test_privs
@@ -295,7 +295,7 @@ POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@ext_simple_derby_table_src
 applyRowFilterAndColumnMasking:
-HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_src type: 
TABLE_OR_VIEW actionType: OTHER dbName: default columns: [ikey, bkey, fkey, 
dkey]}
+HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_src type: 
TABLE_OR_VIEW actionType: OTHER dbName: default OWNER: hive_admin_user 
OWNERTYPE: USER columns: [ikey, bkey, fkey, dkey]}
 inputHObjs:
 HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_src type: 
TABLE_OR_VIEW actionType: OTHER dbName: default OWNER: hive_admin_user 
OWNERTYPE: USER columns: [bkey, dkey, fkey, ikey]}
 outputHObjs:
@@ -316,7 +316,7 @@ POSTHOOK: Lineage: ext_simple_derby_table_ctas.dkey SIMPLE 
[(ext_simple_derby_ta
 POSTHOOK: Lineage: ext_simple_derby_table_ctas.fkey SIMPLE 
[(ext_simple_derby_table_src)ext_simple_derby_table_src.FieldSchema(name:fkey, 
type:float, comment:from deserializer), ]
 POSTHOOK: Lineage: ext_simple_derby_table_ctas.ikey SIMPLE 
[(ext_simple_derby_table_src)ext_simple_derby_table_src.FieldSchema(name:ikey, 
type:int, comment:from deserializer), ]
 applyRowFilterAndColumnMasking:
-HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_ctas type: 
TABLE_OR_VIEW actionType: OTHER dbName: default columns: [bkey, dkey, fkey, 
ikey]}
+HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_ctas type: 
TABLE_OR_VIEW actionType: OTHER dbName: default OWNER: hive_admin_user 
OWNERTYPE: USER columns: [bkey, dkey, fkey, ikey]}
 inputHObjs:
 HIVE PRIVILEGE OBJECT { objectName: ext_simple_derby_table_ctas type: 
TABLE_OR_VIEW actionType: OTHER dbName: default OWNER: hive_admin_user 
OWNERTYPE: USER columns: [bkey, dkey, fkey, ikey]}
 outputHObjs:

Reply via email to