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

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

                Author: ASF GitHub Bot
            Created on: 08/Apr/21 14:10
            Start Date: 08/Apr/21 14:10
    Worklog Time Spent: 10m 
      Work Description: pvary commented on a change in pull request #2137:
URL: https://github.com/apache/hive/pull/2137#discussion_r609744304



##########
File path: 
iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSerDe.java
##########
@@ -77,15 +85,26 @@ public void initialize(@Nullable Configuration 
configuration, Properties serDePr
 
     if (serDeProperties.get(InputFormatConfig.TABLE_SCHEMA) != null) {
       this.tableSchema = SchemaParser.fromJson((String) 
serDeProperties.get(InputFormatConfig.TABLE_SCHEMA));
+      if (serDeProperties.get(InputFormatConfig.PARTITION_SPEC) != null) {
+        PartitionSpec spec =
+            PartitionSpecParser.fromJson(tableSchema, (String) 
serDeProperties.get(InputFormatConfig.PARTITION_SPEC));
+        this.partitionColumns = 
spec.fields().stream().map(PartitionField::name).collect(Collectors.toList());
+      } else {
+        this.partitionColumns = ImmutableList.of();
+      }
     } else {
       try {
         // always prefer the original table schema if there is one
-        this.tableSchema = Catalogs.loadTable(configuration, 
serDeProperties).schema();
+        Table table = Catalogs.loadTable(configuration, serDeProperties);
+        this.tableSchema = table.schema();
+        this.partitionColumns = 
table.spec().fields().stream().map(PartitionField::name).collect(Collectors.toList());
         LOG.info("Using schema from existing table {}", 
SchemaParser.toJson(tableSchema));
       } catch (Exception e) {
         boolean autoConversion = 
configuration.getBoolean(InputFormatConfig.SCHEMA_AUTO_CONVERSION, false);
         // If we can not load the table try the provided hive schema
         this.tableSchema = hiveSchemaOrThrow(serDeProperties, e, 
autoConversion);
+        // This is only for table creation, it is ok to have an empty 
partition column list

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: 579238)
    Time Spent: 2h 40m  (was: 2.5h)

> Enable partition pruning for Iceberg tables
> -------------------------------------------
>
>                 Key: HIVE-24962
>                 URL: https://issues.apache.org/jira/browse/HIVE-24962
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> We should enable partition pruning above iceberg tables



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

Reply via email to