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

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

                Author: ASF GitHub Bot
            Created on: 20/Apr/22 14:29
            Start Date: 20/Apr/22 14:29
    Worklog Time Spent: 10m 
      Work Description: szlta commented on code in PR #3226:
URL: https://github.com/apache/hive/pull/3226#discussion_r854208599


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java:
##########
@@ -43,6 +45,26 @@ private IcebergTableUtil() {
 
   }
 
+  /**
+   * Constructs the table properties needed for the Iceberg table loading by 
retrieving the information from the
+   * hmsTable. It then calls {@link IcebergTableUtil#getTable(Configuration, 
Properties)} with these properties.
+   * @param configuration a Hadoop configuration
+   * @param hmsTable the HMS table
+   * @return the Iceberg table
+   */
+  static Table getTable(Configuration configuration, 
org.apache.hadoop.hive.metastore.api.Table hmsTable) {
+    Properties properties = new Properties();
+    properties.setProperty(Catalogs.NAME, 
TableIdentifier.of(hmsTable.getDbName(), hmsTable.getTableName()).toString());
+    if (hmsTable.getSd() != null) {
+      properties.setProperty(Catalogs.LOCATION, 
hmsTable.getSd().getLocation());
+    }
+    if (hmsTable.getParameters().containsKey(InputFormatConfig.CATALOG_NAME)) {
+      properties.setProperty(
+          InputFormatConfig.CATALOG_NAME, 
hmsTable.getParameters().get(InputFormatConfig.CATALOG_NAME));
+    }

Review Comment:
   nit: could do with one look-up only by calling get() beforehand, and 
refactoring the if condition into null check.





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

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

> Change Iceberg storage handler authz URI to metadata location
> -------------------------------------------------------------
>
>                 Key: HIVE-26157
>                 URL: https://issues.apache.org/jira/browse/HIVE-26157
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: László Pintér
>            Assignee: László Pintér
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> In HIVE-25964, the authz URI has been changed to "iceberg://db.table".
> It is possible to set the metadata pointers of table A to point to table B, 
> and therefore you could read table B's data via querying table A.
> {code:sql}
> alter table A set tblproperties 
> ('metadata_location'='/path/to/B/snapshot.json', 
> 'previous_metadata_location'='/path/to/B/prev_snapshot.json');  {code}



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

Reply via email to