saihemanth-cloudera commented on code in PR #5770:
URL: https://github.com/apache/hive/pull/5770#discussion_r2053027228


##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/filtercontext/TableFilterContext.java:
##########
@@ -53,36 +54,56 @@ public TableFilterContext(String dbName, List<String> 
tableNames) {
     this.tableNames = tableNames;
   }
 
-  @Override public HiveMetaStoreAuthzInfo getAuthzContext() {
-    HiveMetaStoreAuthzInfo ret =
-        new HiveMetaStoreAuthzInfo(preEventContext, HiveOperationType.QUERY, 
getInputHObjs(), getOutputHObjs(), null);
+  public static TableFilterContext createFromTableMetas(String dbName, 
List<TableMeta> tableMetas) {
+    List<Table> tables = new ArrayList<>();
+
+    for (TableMeta tableMeta : tableMetas) {
+      Table table = new Table();
+      table.setCatName(tableMeta.getCatName());
+      table.setDbName(dbName);
+      table.setTableName(tableMeta.getTableName());
+      if (tableMeta.isSetOwnerName()) {
+        table.setOwner(tableMeta.getOwnerName());
+      }
+      if (tableMeta.isSetOwnerType()) {
+        table.setOwnerType(tableMeta.getOwnerType());
+      }
+      tables.add(table);
+    }
+
+    return new TableFilterContext(tables);
+  }
+
+  @Override
+  public HiveMetaStoreAuthzInfo getAuthzContext() {
+    HiveMetaStoreAuthzInfo ret = new HiveMetaStoreAuthzInfo(preEventContext, 
HiveOperationType.QUERY, getInputHObjs(), getOutputHObjs(), null);
     return ret;
   }
 
   private List<HivePrivilegeObject> getInputHObjs() {
-    LOG.debug("==> TableFilterContext.getOutputHObjs()");
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("==> TableFilterContext.getOutputHObjs()");
+    }

Review Comment:
   nit: You don't need this if condition for debug log.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to