public Expression convertTo(Expression exp, PhysType targetPhysType) { final JavaRowFormat targetFormat = targetPhysType.getFormat(); if (format == targetFormat) { return exp; } final ParameterExpression o_ = Expressions.parameter(javaRowClass, "o"); final int fieldCount = rowType.getFieldCount(); return Expressions.call(exp, BuiltInMethod.SELECT.method, generateSelector(o_, Util.range(fieldCount), targetFormat)); }
public Expression convertTo(Expression exp, PhysType targetPhysType) { final JavaRowFormat targetFormat = targetPhysType.getFormat(); if (format == targetFormat) { return exp; } final ParameterExpression o_ = Expressions.parameter(javaRowClass, "o"); final int fieldCount = rowType.getFieldCount(); return Expressions.call(exp, BuiltInMethod.SELECT.method, generateSelector(o_, Util.range(fieldCount), targetFormat)); }
private Expression toRows(PhysType physType, Expression expression) { if (physType.getFormat() == JavaRowFormat.SCALAR && Object[].class.isAssignableFrom(elementType) && getRowType().getFieldCount() == 1 && (table.unwrap(ScannableTable.class) != null || table.unwrap(FilterableTable.class) != null || table.unwrap(ProjectableFilterableTable.class) != null)) { return Expressions.call(BuiltInMethod.SLICE0.method, expression); } JavaRowFormat oldFormat = format(); if (physType.getFormat() == oldFormat && !hasCollectionField(rowType)) { return expression; } final ParameterExpression row_ = Expressions.parameter(elementType, "row"); final int fieldCount = table.getRowType().getFieldCount(); 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_)); }
private Expression toRows(PhysType physType, Expression expression) { if (physType.getFormat() == JavaRowFormat.SCALAR && Object[].class.isAssignableFrom(elementType) && getRowType().getFieldCount() == 1 && (table.unwrap(ScannableTable.class) != null || table.unwrap(FilterableTable.class) != null || table.unwrap(ProjectableFilterableTable.class) != null)) { return Expressions.call(BuiltInMethod.SLICE0.method, expression); } JavaRowFormat oldFormat = format(); if (physType.getFormat() == oldFormat && !hasCollectionField(rowType)) { return expression; } final ParameterExpression row_ = Expressions.parameter(elementType, "row"); final int fieldCount = table.getRowType().getFieldCount(); 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_)); }
switch (prefer) { case ARRAY: if (result.physType.getFormat() == JavaRowFormat.ARRAY && rootRel.getRowType().getFieldCount() == 1) { BlockBuilder bb = new BlockBuilder();
switch (prefer) { case ARRAY: if (result.physType.getFormat() == JavaRowFormat.ARRAY && rootRel.getRowType().getFieldCount() == 1) { BlockBuilder bb = new BlockBuilder();