You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2019/11/21 14:09:48 UTC

[GitHub] [hive] maheshk114 commented on a change in pull request #847: HIVE-22512 : Use direct SQL to fetch column privileges in refreshPrivileges.

maheshk114 commented on a change in pull request #847: HIVE-22512 : Use direct SQL to fetch column privileges in refreshPrivileges.
URL: https://github.com/apache/hive/pull/847#discussion_r349031249
 
 

 ##########
 File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
 ##########
 @@ -1280,6 +1284,94 @@ public ColumnStatistics getTableStats(final String catName, final String dbName,
     return result;
   }
 
+  public List<HiveObjectPrivilege> getTableAllColumnGrants(String catName, String dbName,
+                                                           String tableName, String authorizer) throws MetaException {
+    Query query = null;
+
+    // These constants should match the SELECT clause of the query.
+    final int authorizerIndex = 0;
+    final int columnNameIndex = 1;
+    final int createTimeIndex = 2;
+    final int grantOptionIndex = 3;
+    final int grantorIndex = 4;
+    final int grantorTypeIndex = 5;
+    final int principalNameIndex = 6;
+    final int principalTypeIndex = 7;
+    final int privilegeIndex = 8;
+
+    // Retrieve the privileges from the object store. Just grab only the required fields.
+    String queryText = "select " +
+            TBL_COL_PRIVS + ".\"AUTHORIZER\", " +
+            TBL_COL_PRIVS + ".\"COLUMN_NAME\", " +
+            TBL_COL_PRIVS + ".\"CREATE_TIME\", " +
+            TBL_COL_PRIVS + ".\"GRANT_OPTION\", " +
+            TBL_COL_PRIVS + ".\"GRANTOR\", " +
 
 Review comment:
   why left outer join us used ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org