You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/04/08 11:16:30 UTC

[GitHub] [hive] pvary commented on a change in pull request #2137: HIVE-24962: Implement partition pruning for Iceberg tables

pvary commented on a change in pull request #2137:
URL: https://github.com/apache/hive/pull/2137#discussion_r609585235



##########
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,

Review comment:
       Good catch. The `syntheticFilterPredicate` contains the columns as well. Reworded the log, but forgot to remove the parameter




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org