deniskuzZ commented on code in PR #4761:
URL: https://github.com/apache/hive/pull/4761#discussion_r1440678452


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -381,9 +381,39 @@ public DecomposedPredicate decomposePredicate(JobConf 
jobConf, Deserializer dese
       }
     }
     predicate.pushedPredicate = (ExprNodeGenericFuncDesc) pushedPredicate;
+    setFilterExpression(predicate);
     return predicate;
   }
 
+  /**
+   * Sets the filter expression in the configuration.
+   *
+   * @param predicate The predicate to create the filter expression from.
+   */
+  public void setFilterExpression(DecomposedPredicate predicate) {
+    Expression expr = Expressions.alwaysTrue();
+    try {
+      if (predicate.pushedPredicate != null) {
+        SearchArgument sarg = ConvertAstToSearchArg.create(conf, 
predicate.pushedPredicate);
+        expr = HiveIcebergFilterFactory.generateFilterExpression(sarg);
+      }
+    } catch (UnsupportedOperationException e) {
+      LOG.warn("Unable to create Iceberg filter, continuing without filter 
(will be applied by Hive later): ", e);
+    }
+    SessionStateUtil.addResource(conf, InputFormatConfig.QUERY_FILTERS, expr);
+  }
+
+  /**
+   * Retrieves the query filter expression from the configuration.
+   *
+   * @param config The configuration to retrieve the filter expression from.
+   * @return The query filter expression or alwaysTrue if not found.
+   */
+  public static Expression getQueryFilter(Configuration config) {

Review Comment:
   why is it static? it you need static why it's in HiveIcebergStorageHandler 
and not in iceberg util class?



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to