rdblue commented on code in PR #18629:
URL: https://github.com/apache/iceberg/pull/18629#discussion_r4744953305


##########
api/src/main/java/org/apache/iceberg/expressions/Binder.java:
##########
@@ -48,16 +48,101 @@ private Binder() {}
    * <p>The expression cannot contain references that are already bound, or an 
{@link
    * IllegalStateException} will be thrown.
    *
+   * <p>A value expression is bound as by {@link #bind(StructType, 
ValueExpression, boolean)}.
+   *
    * @param struct The {@link StructType struct type} to resolve references by 
name.
    * @param expr An {@link Expression expression} to rewrite with bound 
references.
    * @param caseSensitive A boolean flag to control whether the bind should 
enforce case
    *     sensitivity.
    * @return the expression rewritten with bound references
    * @throws ValidationException if literals do not match bound references
    * @throws IllegalStateException if any references are already bound
+   * @throws UnsupportedOperationException if the expression calls a function 
outside {@code
+   *     iceberg_functions}; use {@link #bind(StructType, Expression, boolean, 
FunctionBinder)} to
+   *     resolve other functions
    */
   public static Expression bind(StructType struct, Expression expr, boolean 
caseSensitive) {
-    return ExpressionVisitors.visit(expr, new BindVisitor(struct, 
caseSensitive));
+    return bind(struct, expr, caseSensitive, IcebergFunctions.INSTANCE);
+  }
+
+  /**
+   * Replaces all unbound references with bound references to fields in the 
given struct, using a
+   * function binder to resolve function calls.
+   *
+   * <p>Behaves like {@link #bind(StructType, Expression, boolean)} for 
everything other than
+   * function calls.
+   *
+   * @param struct The {@link StructType struct type} to resolve references by 
name.
+   * @param expr An {@link Expression expression} to rewrite with bound 
references.
+   * @param caseSensitive A boolean flag to control whether the bind should 
enforce case
+   *     sensitivity.
+   * @param functionBinder a {@link FunctionBinder} used to resolve functions
+   * @return the expression rewritten with bound references
+   * @throws ValidationException if literals do not match bound references
+   * @throws IllegalStateException if any references are already bound
+   */
+  public static Expression bind(

Review Comment:
   I would make this package-private until we want to expose `FunctionBinder`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to