Search in sources :

Example 1 with FilterQueryOperation

use of org.apache.flink.table.operations.FilterQueryOperation in project flink by apache.

the class OperationTreeBuilder method filter.

public QueryOperation filter(Expression condition, QueryOperation child) {
    ExpressionResolver resolver = getResolver(child);
    ResolvedExpression resolvedExpression = resolveSingleExpression(condition, resolver);
    DataType conditionType = resolvedExpression.getOutputDataType();
    if (!conditionType.getLogicalType().is(BOOLEAN)) {
        throw new ValidationException("Filter operator requires a boolean expression as input," + " but $condition is of type " + conditionType);
    }
    return new FilterQueryOperation(resolvedExpression, child);
}
Also used : ValidationException(org.apache.flink.table.api.ValidationException) ResolvedExpression(org.apache.flink.table.expressions.ResolvedExpression) DataType(org.apache.flink.table.types.DataType) ExpressionResolver(org.apache.flink.table.expressions.resolver.ExpressionResolver) SqlExpressionResolver(org.apache.flink.table.expressions.resolver.SqlExpressionResolver) FilterQueryOperation(org.apache.flink.table.operations.FilterQueryOperation)

Aggregations

ValidationException (org.apache.flink.table.api.ValidationException)1 ResolvedExpression (org.apache.flink.table.expressions.ResolvedExpression)1 ExpressionResolver (org.apache.flink.table.expressions.resolver.ExpressionResolver)1 SqlExpressionResolver (org.apache.flink.table.expressions.resolver.SqlExpressionResolver)1 FilterQueryOperation (org.apache.flink.table.operations.FilterQueryOperation)1 DataType (org.apache.flink.table.types.DataType)1