Search in sources :

Example 1 with JavaRowFormat

use of org.apache.calcite.adapter.enumerable.JavaRowFormat in project Mycat2 by MyCATApache.

the class MycatView method toRows.

public static Expression toRows(PhysType physType, Expression expression, final int fieldCount) {
    JavaRowFormat oldFormat = JavaRowFormat.ARRAY;
    if (physType.getFormat() == oldFormat) {
        return expression;
    }
    final ParameterExpression row_ = Expressions.parameter(Object[].class, "row");
    List<Expression> expressionList = new ArrayList<>(fieldCount);
    for (int i = 0; i < fieldCount; i++) {
        expressionList.add(fieldExpression(row_, i, physType, oldFormat));
    }
    return Expressions.call(expression, BuiltInMethod.SELECT.method, Expressions.lambda(Function1.class, physType.record(expressionList), row_));
}
Also used : Function1(org.apache.calcite.linq4j.function.Function1) JavaRowFormat(org.apache.calcite.adapter.enumerable.JavaRowFormat)

Aggregations

JavaRowFormat (org.apache.calcite.adapter.enumerable.JavaRowFormat)1 Function1 (org.apache.calcite.linq4j.function.Function1)1