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

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

                Author: ASF GitHub Bot
            Created on: 02/Jun/21 08:02
            Start Date: 02/Jun/21 08:02
    Worklog Time Spent: 10m 
      Work Description: lcspinter commented on a change in pull request #2333:
URL: https://github.com/apache/hive/pull/2333#discussion_r643746537



##########
File path: 
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
##########
@@ -402,10 +406,18 @@ private Schema schema(Properties properties, 
org.apache.hadoop.hive.metastore.ap
     }
   }
 
-  private static PartitionSpec spec(Schema schema, Properties properties,
+  private static PartitionSpec spec(Configuration configuration, Schema 
schema, Properties properties,
       org.apache.hadoop.hive.metastore.api.Table hmsTable) {
 
-    if (hmsTable.getParameters().get(InputFormatConfig.PARTITION_SPEC) != 
null) {
+    if 
(SessionState.get().getQueryState(configuration.get(HiveConf.ConfVars.HIVEQUERYID.varname))

Review comment:
       I agree. I created an util class

##########
File path: 
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
##########
@@ -402,10 +406,18 @@ private Schema schema(Properties properties, 
org.apache.hadoop.hive.metastore.ap
     }
   }
 
-  private static PartitionSpec spec(Schema schema, Properties properties,
+  private static PartitionSpec spec(Configuration configuration, Schema 
schema, Properties properties,
       org.apache.hadoop.hive.metastore.api.Table hmsTable) {
 
-    if (hmsTable.getParameters().get(InputFormatConfig.PARTITION_SPEC) != 
null) {
+    if 
(SessionState.get().getQueryState(configuration.get(HiveConf.ConfVars.HIVEQUERYID.varname))

Review comment:
       I agree. I created a util class

##########
File path: 
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
##########
@@ -155,6 +155,36 @@ public void after() throws Exception {
     HiveIcebergStorageHandlerTestUtils.close(shell);
   }
 
+  @Test
+  public void testPartitionTransform() {
+    Schema schema = new Schema(
+        optional(1, "id", Types.LongType.get()),
+        optional(2, "year_field", Types.DateType.get()),
+        optional(3, "month_field", Types.TimestampType.withZone()),
+        optional(4, "day_field", Types.TimestampType.withoutZone()),
+        optional(5, "hour_field", Types.TimestampType.withoutZone()),
+        optional(6, "truncate_field", Types.StringType.get()),
+        optional(7, "bucket_field", Types.StringType.get()),
+        optional(8, "identity_field", Types.StringType.get())
+    );
+    PartitionSpec spec = 
PartitionSpec.builderFor(schema).year("year_field").month("month_field").day("day_field")
+        .hour("hour_field").truncate("truncate_field", 
2).bucket("bucket_field", 2)
+        .identity("identity_field").build();
+    String tableName = "part_test";
+
+    TableIdentifier identifier = TableIdentifier.of("default", tableName);
+    shell.executeStatement("CREATE EXTERNAL TABLE " + identifier +
+        " PARTITIONED BY SPEC (year_field year, month_field month, day_field 
day, hour_field hour, " +
+        "truncate_field truncate[2], bucket_field bucket[2], identity_field 
identity)" +
+        " STORED BY '" + HiveIcebergStorageHandler.class.getName() + "' " +

Review comment:
       Fixed

##########
File path: 
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
##########
@@ -155,6 +155,36 @@ public void after() throws Exception {
     HiveIcebergStorageHandlerTestUtils.close(shell);
   }
 
+  @Test
+  public void testPartitionTransform() {
+    Schema schema = new Schema(
+        optional(1, "id", Types.LongType.get()),
+        optional(2, "year_field", Types.DateType.get()),
+        optional(3, "month_field", Types.TimestampType.withZone()),
+        optional(4, "day_field", Types.TimestampType.withoutZone()),
+        optional(5, "hour_field", Types.TimestampType.withoutZone()),
+        optional(6, "truncate_field", Types.StringType.get()),
+        optional(7, "bucket_field", Types.StringType.get()),
+        optional(8, "identity_field", Types.StringType.get())
+    );
+    PartitionSpec spec = 
PartitionSpec.builderFor(schema).year("year_field").month("month_field").day("day_field")

Review comment:
       Done




-- 
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: 605005)
    Time Spent: 3h 10m  (was: 3h)

> Support all partition transforms for Iceberg in create table
> ------------------------------------------------------------
>
>                 Key: HIVE-25179
>                 URL: https://issues.apache.org/jira/browse/HIVE-25179
>             Project: Hive
>          Issue Type: New Feature
>            Reporter: László Pintér
>            Assignee: László Pintér
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> Enhance table create syntax with support to partition transforms:
> {code:sql}
> CREATE TABLE ... PARTITIONED BY SPEC(
> year_field year,
> month_field month,
> day_field day,
> hour_field hour,
> truncate_field truncate[3],
> bucket_field bucket[5],
> identity_field identity
> ) STORED BY ICEBERG;
> {code}



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

Reply via email to