public Pair<Type, List<Expression>> selector( ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) { // Optimize target format switch (fields.size()) { case 0: targetFormat = JavaRowFormat.LIST; break; case 1: targetFormat = JavaRowFormat.SCALAR; break; } final PhysType targetPhysType = project(fields, targetFormat); switch (format) { case SCALAR: return Pair.of(parameter.getType(), ImmutableList.of(parameter)); default: return Pair.of(targetPhysType.getJavaRowType(), fieldReferences(parameter, fields)); } }
public Pair<Type, List<Expression>> selector( ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) { // Optimize target format switch (fields.size()) { case 0: targetFormat = JavaRowFormat.LIST; break; case 1: targetFormat = JavaRowFormat.SCALAR; break; } final PhysType targetPhysType = project(fields, targetFormat); switch (format) { case SCALAR: return Pair.of(parameter.getType(), ImmutableList.of(parameter)); default: return Pair.of(targetPhysType.getJavaRowType(), fieldReferences(parameter, fields)); } }
public Expression generateSelector( ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) { // Optimize target format switch (fields.size()) { case 0: targetFormat = JavaRowFormat.LIST; break; case 1: targetFormat = JavaRowFormat.SCALAR; break; } final PhysType targetPhysType = project(fields, targetFormat); switch (format) { case SCALAR: return Expressions.call(BuiltInMethod.IDENTITY_SELECTOR.method); default: return Expressions.lambda(Function1.class, targetPhysType.record(fieldReferences(parameter, fields)), parameter); } }
public Expression generateSelector( ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) { // Optimize target format switch (fields.size()) { case 0: targetFormat = JavaRowFormat.LIST; break; case 1: targetFormat = JavaRowFormat.SCALAR; break; } final PhysType targetPhysType = project(fields, targetFormat); switch (format) { case SCALAR: return Expressions.call(BuiltInMethod.IDENTITY_SELECTOR.method); default: return Expressions.lambda(Function1.class, targetPhysType.record(fieldReferences(parameter, fields)), parameter); } }