Class ApiExpressionUtils


  • @Internal
    public final class ApiExpressionUtils
    extends Object
    Utilities for API-specific Expressions.
    • Method Detail

      • objectToExpression

        public static org.apache.flink.table.expressions.Expression objectToExpression​(Object expression)
        Converts a given object to an expression.

        It converts:

        • null to null literal
        • Row to a call to a row constructor expression
        • Map to a call to a map constructor expression
        • List to a call to an array constructor expression
        • arrays to a call to an array constructor expression
        • Scala's Seq to an array constructor via reflection
        • Scala's Map to a map constructor via reflection
        • Scala's BigDecimal to a DECIMAL literal
        • if none of the above applies, the function tries to convert the object to a value literal with valueLiteral(Object)
        Parameters:
        expression - An object to convert to an expression
      • unwrapFromApi

        public static org.apache.flink.table.expressions.Expression unwrapFromApi​(org.apache.flink.table.expressions.Expression expression)
      • valueLiteral

        public static org.apache.flink.table.expressions.ValueLiteralExpression valueLiteral​(Object value)
      • valueLiteral

        public static org.apache.flink.table.expressions.ValueLiteralExpression valueLiteral​(Object value,
                                                                                             org.apache.flink.table.types.DataType dataType)
      • typeLiteral

        public static org.apache.flink.table.expressions.TypeLiteralExpression typeLiteral​(org.apache.flink.table.types.DataType dataType)
      • unresolvedCall

        public static UnresolvedCallExpression unresolvedCall​(org.apache.flink.table.functions.FunctionDefinition functionDefinition,
                                                              org.apache.flink.table.expressions.Expression... args)
      • unresolvedCall

        public static UnresolvedCallExpression unresolvedCall​(org.apache.flink.table.functions.FunctionDefinition functionDefinition,
                                                              List<org.apache.flink.table.expressions.Expression> args)
      • lookupCall

        public static LookupCallExpression lookupCall​(String name,
                                                      org.apache.flink.table.expressions.Expression... args)
      • sqlCall

        public static org.apache.flink.table.expressions.SqlCallExpression sqlCall​(String sqlExpression)
      • toMonthInterval

        public static org.apache.flink.table.expressions.Expression toMonthInterval​(org.apache.flink.table.expressions.Expression e,
                                                                                    int multiplier)
      • intervalOfMillis

        public static org.apache.flink.table.expressions.ValueLiteralExpression intervalOfMillis​(long millis)
      • toMilliInterval

        public static org.apache.flink.table.expressions.Expression toMilliInterval​(org.apache.flink.table.expressions.Expression e,
                                                                                    long multiplier)
      • intervalOfMonths

        public static org.apache.flink.table.expressions.ValueLiteralExpression intervalOfMonths​(int months)
      • toRowInterval

        public static org.apache.flink.table.expressions.Expression toRowInterval​(org.apache.flink.table.expressions.Expression e)
      • isFunctionOfKind

        public static boolean isFunctionOfKind​(org.apache.flink.table.expressions.Expression expression,
                                               org.apache.flink.table.functions.FunctionKind kind)
        Checks if the expression is a function call of given type.
        Parameters:
        expression - expression to check
        kind - expected type of function
        Returns:
        true if the expression is function call of given type, false otherwise
      • isFunction

        public static boolean isFunction​(org.apache.flink.table.expressions.Expression expression,
                                         org.apache.flink.table.functions.BuiltInFunctionDefinition functionDefinition)
        Checks if the given expression is a given builtin function.
        Parameters:
        expression - expression to check
        functionDefinition - expected function definition
        Returns:
        true if the given expression is a given function call