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

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

                Author: ASF GitHub Bot
            Created on: 05/May/22 09:41
            Start Date: 05/May/22 09:41
    Worklog Time Spent: 10m 
      Work Description: pvary commented on code in PR #3259:
URL: https://github.com/apache/hive/pull/3259#discussion_r865730027


##########
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java:
##########
@@ -1422,6 +1422,28 @@ public void testAuthzURI() throws TException, 
InterruptedException, URISyntaxExc
     Assert.assertEquals("iceberg://" + hmsTable.getDbName() + "/" + 
hmsTable.getTableName(), uriForAuth.toString());
   }
 
+  @Test
+  public void testCreateTableWithMetadataLocation() throws IOException {
+    Assume.assumeTrue("Create with metadata location is only supported for 
Hive Catalog tables",
+        testTableType.equals(TestTables.TestTableType.HIVE_CATALOG));
+    TableIdentifier sourceIdentifier = TableIdentifier.of("default", "source");
+    Table sourceTable =
+        testTables.createTable(shell, sourceIdentifier.name(), 
HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+            PartitionSpec.unpartitioned(), FileFormat.PARQUET, 
Collections.emptyList(), 1,
+            ImmutableMap.<String, 
String>builder().put(InputFormatConfig.EXTERNAL_TABLE_PURGE, "FALSE").build());
+    testTables.appendIcebergTable(shell.getHiveConf(), sourceTable, 
FileFormat.PARQUET, null,
+        HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS);
+    String metadataLocation = ((BaseTable) 
sourceTable).operations().current().metadataFileLocation();
+    shell.executeStatement("DROP TABLE " + sourceIdentifier.name());
+    TableIdentifier targetIdentifier = TableIdentifier.of("default", "target");
+    Table targetTable =
+        testTables.createTable(shell, targetIdentifier.name(), 
HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+            PartitionSpec.unpartitioned(), FileFormat.PARQUET, 
Collections.emptyList(), 1,
+            ImmutableMap.<String, String>builder().put("metadata_location", 
metadataLocation).build()
+        );
+    Assert.assertEquals(metadataLocation, ((BaseTable) 
targetTable).operations().current().metadataFileLocation());

Review Comment:
   Could we run a query against the table, or use Iceberg api to read data from 
the table, to see if the data is correct?





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

    Worklog Id:     (was: 766539)
    Time Spent: 2h 10m  (was: 2h)

> Implement create iceberg table with metadata location
> -----------------------------------------------------
>
>                 Key: HIVE-26190
>                 URL: https://issues.apache.org/jira/browse/HIVE-26190
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: László Pintér
>            Assignee: László Pintér
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> We should support the following syntax
> {code:sql}
> CREATE TABLE ... TBLPROPERTIES('metadata_location='some_location'){code}
> This would allow us to create an iceberg table by reusing an already existing 
> metadata. 



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

Reply via email to