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

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

                Author: ASF GitHub Bot
            Created on: 08/Apr/21 09:25
            Start Date: 08/Apr/21 09:25
    Worklog Time Spent: 10m 
      Work Description: marton-bod commented on a change in pull request #2137:
URL: https://github.com/apache/hive/pull/2137#discussion_r609497741



##########
File path: 
iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
##########
@@ -153,6 +168,39 @@ public DecomposedPredicate decomposePredicate(JobConf 
jobConf, Deserializer dese
     return predicate;
   }
 
+  @Override
+  public boolean 
addDynamicSplitPruningEdge(org.apache.hadoop.hive.ql.metadata.Table table,
+      ExprNodeDesc syntheticFilterPredicate) {
+    try {
+      Collection<String> partitionColumns = ((HiveIcebergSerDe) 
table.getDeserializer()).partitionColumns();
+      if (partitionColumns.size() > 0) {
+        // Collect the column names from the predicate
+        Collection<String> filterColumns = Lists.newArrayList();
+        columns(syntheticFilterPredicate, filterColumns);
+
+        if (filterColumns.removeAll(partitionColumns)) {
+          // Replace dynamic values to dummy constants
+          ExprNodeDesc clone = syntheticFilterPredicate.clone();
+          replace(clone);
+
+          // Check if we can convert the expression to a valid Iceberg filter
+          SearchArgument sarg = ConvertAstToSearchArg.create(conf, 
(ExprNodeGenericFuncDesc) clone);
+          HiveIcebergFilterFactory.generateFilterExpression(sarg);
+          LOG.debug("Found Iceberg partition column to prune with predicate 
{}", filterColumns,
+              syntheticFilterPredicate);
+          return true;
+        }
+      }
+    } catch (UnsupportedOperationException uoe) {
+      // If we can not convert the filter, we do not prune
+      LOG.debug("Unsupported predicate {}", syntheticFilterPredicate);

Review comment:
       Would it be useful to log the `uoe` exception too in case the pruning 
failure is unexpected and need to debug?




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

> 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: 1h 10m
>  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