Search in sources :

Example 1 with TableReferenceExpression

use of org.apache.flink.table.expressions.TableReferenceExpression in project flink by apache.

the class InConverter method convert.

@Override
public RexNode convert(CallExpression call, CallExpressionConvertRule.ConvertContext context) {
    checkArgument(call, call.getChildren().size() > 1);
    Expression headExpr = call.getChildren().get(1);
    if (headExpr instanceof TableReferenceExpression) {
        QueryOperation tableOperation = ((TableReferenceExpression) headExpr).getQueryOperation();
        RexNode child = context.toRexNode(call.getChildren().get(0));
        return RexSubQuery.in(((FlinkRelBuilder) context.getRelBuilder()).queryOperation(tableOperation).build(), ImmutableList.of(child));
    } else {
        List<RexNode> child = toRexNodes(context, call.getChildren());
        return context.getRelBuilder().getRexBuilder().makeIn(child.get(0), child.subList(1, child.size()));
    }
}
Also used : CallExpression(org.apache.flink.table.expressions.CallExpression) Expression(org.apache.flink.table.expressions.Expression) TableReferenceExpression(org.apache.flink.table.expressions.TableReferenceExpression) FlinkRelBuilder(org.apache.flink.table.planner.calcite.FlinkRelBuilder) TableReferenceExpression(org.apache.flink.table.expressions.TableReferenceExpression) QueryOperation(org.apache.flink.table.operations.QueryOperation) RexNode(org.apache.calcite.rex.RexNode)

Aggregations

RexNode (org.apache.calcite.rex.RexNode)1 CallExpression (org.apache.flink.table.expressions.CallExpression)1 Expression (org.apache.flink.table.expressions.Expression)1 TableReferenceExpression (org.apache.flink.table.expressions.TableReferenceExpression)1 QueryOperation (org.apache.flink.table.operations.QueryOperation)1 FlinkRelBuilder (org.apache.flink.table.planner.calcite.FlinkRelBuilder)1