public class Binder extends java.lang.Object
expressionsby replacing unbound named references with references to fields in a struct schema.
|Modifier and Type||Method and Description|
Replaces all unbound/named references with bound references to fields in the given struct.
Returns whether an expression is bound.
public static Expression bind(Types.StructType struct, Expression expr, boolean caseSensitive)
When a reference is resolved, any literal used in a predicate for that field is converted to
the field's type using
Literal.to(Type). If automatic conversion to that type isn't
validation exception is thrown.
The result expression may be simplified when constructed. For example,
is replaced with
"a" is resolved to a required field.
The expression cannot contain references that are already bound, or an
IllegalStateException will be thrown.
struct typeto resolve references by name.
expressionto rewrite with bound references.
caseSensitive- A boolean flag to control whether the bind should enforce case sensitivity.
ValidationException- if literals do not match bound references
java.lang.IllegalStateException- if any references are already bound
public static java.util.Set<java.lang.Integer> boundReferences(Types.StructType struct, java.util.List<Expression> exprs, boolean caseSensitive)
public static boolean isBound(Expression expr)
An expression is bound if all of its predicates are bound.
java.lang.IllegalArgumentException- if the expression has both bound and unbound predicates.