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

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

                Author: ASF GitHub Bot
            Created on: 08/Apr/21 20:00
            Start Date: 08/Apr/21 20:00
    Worklog Time Spent: 10m 
      Work Description: nrg4878 commented on a change in pull request #1970:
URL: https://github.com/apache/hive/pull/1970#discussion_r609665616



##########
File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -2435,8 +2435,24 @@ public Type getType(String name) throws 
NoSuchObjectException, MetaException, TE
   @Override
   public List<String> getTables(String catName, String dbName, String 
tablePattern)
       throws TException {
-    List<String> tables = client.get_tables(prependCatalogToDbName(catName, 
dbName, conf), tablePattern);
-    return FilterUtils.filterTableNamesIfEnabled(isClientFilterEnabled, 
filterHook, catName, dbName, tables);
+    List<String> tables = new ArrayList<>();
+    GetProjectionsSpec projectionsSpec = new GetProjectionsSpec();
+    List<String> projectedFields = Arrays.asList("dbName", "tableName", 
"owner", "ownerType");
+    projectionsSpec.setFieldList(projectedFields);
+    GetTablesRequest req = new GetTablesRequest(dbName);
+    req.setCatName(catName);
+    req.setCapabilities(version);
+    req.setTblNames(tables);
+    req.setTablesPattern(tablePattern);
+    if (processorCapabilities != null)

Review comment:
       Thanks for adding the processorIdentifiier.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -1853,15 +1853,25 @@ private MTable getMTable(String catName, String db, 
String table) {
       db = normalizeIdentifier(db);
       catName = normalizeIdentifier(catName);
 
-      List<String> lowered_tbl_names = new ArrayList<>(tbl_names.size());
-      for (String t : tbl_names) {
-        lowered_tbl_names.add(normalizeIdentifier(t));
+      List<String> lowered_tbl_names = new ArrayList<>();
+      if(tbl_names != null) {
+        lowered_tbl_names = new ArrayList<>(tbl_names.size());
+        for (String t : tbl_names) {
+          lowered_tbl_names.add(normalizeIdentifier(t));
+        }
       }
 
-      query = pm.newQuery(MTable.class);
-      query.setFilter("database.name == db && database.catalogName == cat && 
tbl_names.contains(tableName)");
-      query.declareParameters("java.lang.String db, java.lang.String cat, 
java.util.Collection tbl_names");
-
+      StringBuilder filterBuilder = new StringBuilder();
+      List<String> parameterVals = new ArrayList<>();
+      appendSimpleCondition(filterBuilder, "database.name", new String[] {db}, 
parameterVals);
+      appendSimpleCondition(filterBuilder, "database.catalogName", new 
String[] {catName}, parameterVals);
+      if(tbl_names != null){

Review comment:
       We should add a comment to explain the strategy on how this API uses the 
input arguments.




-- 
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:
us...@infra.apache.org


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

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

> HiveMetaStore getTables() doesn't have Owner information to filter on it
> ------------------------------------------------------------------------
>
>                 Key: HIVE-24769
>                 URL: https://issues.apache.org/jira/browse/HIVE-24769
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Sai Hemanth Gantasala
>            Assignee: Sai Hemanth Gantasala
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> HiveMetaStoreClient#getTables() api should have table owner information so 
> that they can be used while authorizing in Apache Ranger/Sentry.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to