public class ExpressionUtils extends Object
| Constructor and Description |
|---|
ExpressionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<org.apache.flink.table.expressions.ResolvedExpression> |
filterSimpleCallExpression(List<org.apache.flink.table.expressions.ResolvedExpression> exprs) |
static Object |
getKeyFromLiteral(org.apache.flink.table.expressions.ValueLiteralExpression expr,
boolean logicalTimestamp)
Returns the field as part of a hoodie key with given value literal expression.
|
static Object |
getValueFromLiteral(org.apache.flink.table.expressions.ValueLiteralExpression expr)
Returns the value with given value literal expression.
|
static boolean |
isEqualsLitExpr(org.apache.flink.table.expressions.ResolvedExpression resolvedExpr,
Set<String> fields)
Returns whether the given expression
resolvedExpr is a
literal equivalence predicate within the fields fields. |
static boolean |
isFilteringByAllFields(List<org.apache.flink.table.expressions.ResolvedExpression> exprs,
Set<String> fields)
Returns whether all the fields
fields are involved in the filtering predicates. |
static boolean |
isSimpleCallExpression(org.apache.flink.table.expressions.Expression expr)
Returns whether the given expression is simple call expression:
a binary call with one operand as field reference and another operand
as literal.
|
static String[] |
referencedColumns(List<org.apache.flink.table.expressions.ResolvedExpression> exprs)
Collect the referenced columns with given expressions,
only simple call expression is supported.
|
static org.apache.flink.api.java.tuple.Tuple2<List<org.apache.flink.table.expressions.ResolvedExpression>,List<org.apache.flink.table.expressions.ResolvedExpression>> |
splitExprByPartitionCall(List<org.apache.flink.table.expressions.ResolvedExpression> expressions,
List<String> partitionKeys,
org.apache.flink.table.types.logical.RowType tableRowType)
Extracts partition predicate from filter condition.
|
public static String[] referencedColumns(List<org.apache.flink.table.expressions.ResolvedExpression> exprs)
public static boolean isSimpleCallExpression(org.apache.flink.table.expressions.Expression expr)
@Nullable public static Object getValueFromLiteral(org.apache.flink.table.expressions.ValueLiteralExpression expr)
Returns null if the value can not parse as the output data type correctly,
should call ValueLiteralExpression.isNull first to decide whether
the literal is NULL.
@Nullable public static Object getKeyFromLiteral(org.apache.flink.table.expressions.ValueLiteralExpression expr, boolean logicalTimestamp)
CAUTION: the data type and value parsing should follow the impl of getValueFromLiteral(ValueLiteralExpression).
CAUTION: the data and timestamp conversion should follow the impl if HoodieAvroUtils.convertValueForAvroLogicalTypes.
Returns null if the value can not parse as the output data type correctly,
should call ValueLiteralExpression.isNull first to decide whether
the literal is NULL.
public static boolean isFilteringByAllFields(List<org.apache.flink.table.expressions.ResolvedExpression> exprs, Set<String> fields)
fields are involved in the filtering predicates.exprs - The filtersfields - The field setpublic static boolean isEqualsLitExpr(org.apache.flink.table.expressions.ResolvedExpression resolvedExpr,
Set<String> fields)
resolvedExpr is a
literal equivalence predicate within the fields fields.public static List<org.apache.flink.table.expressions.ResolvedExpression> filterSimpleCallExpression(List<org.apache.flink.table.expressions.ResolvedExpression> exprs)
public static org.apache.flink.api.java.tuple.Tuple2<List<org.apache.flink.table.expressions.ResolvedExpression>,List<org.apache.flink.table.expressions.ResolvedExpression>> splitExprByPartitionCall(List<org.apache.flink.table.expressions.ResolvedExpression> expressions, List<String> partitionKeys, org.apache.flink.table.types.logical.RowType tableRowType)
NOTE: the expressions should be simple call expressions.
Copyright © 2023 The Apache Software Foundation. All rights reserved.