public void go(EnumerableRel.Result result) { final Set<Type> types = new LinkedHashSet<>(); result.block.accept(new TypeFinder(types)); types.add(result.physType.getJavaRowType()); for (Type type : types) { register(type); } } }
public void go(EnumerableRel.Result result) { final Set<Type> types = new LinkedHashSet<>(); result.block.accept(new TypeFinder(types)); types.add(result.physType.getJavaRowType()); for (Type type : types) { register(type); } } }
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)); } }
private void declareParentAccumulator(List<Expression> initExpressions, BlockBuilder initBlock, PhysType accPhysType) { if (accPhysType.getJavaRowType() instanceof JavaTypeFactoryImpl.SyntheticRecordType) { // We have to initialize the SyntheticRecordType instance this way, to // avoid using a class constructor with too many parameters. final JavaTypeFactoryImpl.SyntheticRecordType synType = (JavaTypeFactoryImpl.SyntheticRecordType) accPhysType.getJavaRowType(); final ParameterExpression record0_ = Expressions.parameter(accPhysType.getJavaRowType(), "record0"); initBlock.add(Expressions.declare(0, record0_, null)); initBlock.add( Expressions.statement( Expressions.assign(record0_, Expressions.new_(accPhysType.getJavaRowType())))); List<Types.RecordField> fieldList = synType.getRecordFields(); for (int i = 0; i < initExpressions.size(); i++) { Expression right = initExpressions.get(i); initBlock.add( Expressions.statement( Expressions.assign( Expressions.field(record0_, fieldList.get(i)), right))); } initBlock.add(record0_); } else { initBlock.add(accPhysType.record(initExpressions)); } }
Expressions.parameter(Primitive.box(inputPhysType.getJavaRowType()), EnumUtils.LEFT_RIGHT.get(ord.i)); parameters.add(parameter);
Expressions.parameter(Primitive.box(inputPhysType.getJavaRowType()), EnumUtils.LEFT_RIGHT.get(ord.i)); parameters.add(parameter);
Blocks.toFunctionBlock( Expressions.return_(null, Expressions.constant(result.physType.getJavaRowType()))))); return Expressions.classDecl(Modifier.PUBLIC, "Baz",
Blocks.toFunctionBlock( Expressions.return_(null, Expressions.constant(result.physType.getJavaRowType()))))); return Expressions.classDecl(Modifier.PUBLIC, "Baz",
getRowType(), pref.preferCustom()); final Type rowClass = physType.getJavaRowType();
getRowType(), pref.preferCustom()); final Type rowClass = physType.getJavaRowType();
builder.append("left", leftResult.block); final ParameterExpression left_ = Expressions.parameter(leftResult.physType.getJavaRowType(), "left"); final Result rightResult = implementor.visitChild(this, 1, (EnumerableRel) right, pref); builder.append("right", rightResult.block); final ParameterExpression right_ = Expressions.parameter(rightResult.physType.getJavaRowType(), "right"); final JavaTypeFactory typeFactory = implementor.getTypeFactory(); final PhysType physType =
builder.append("left", leftResult.block); final ParameterExpression left_ = Expressions.parameter(leftResult.physType.getJavaRowType(), "left"); final Result rightResult = implementor.visitChild(this, 1, (EnumerableRel) right, pref); builder.append("right", rightResult.block); final ParameterExpression right_ = Expressions.parameter(rightResult.physType.getJavaRowType(), "right"); final JavaTypeFactory typeFactory = implementor.getTypeFactory(); final PhysType physType =
Expression predicate(EnumerableRelImplementor implementor, BlockBuilder builder, PhysType leftPhysType, PhysType rightPhysType, RexNode condition) { final ParameterExpression left_ = Expressions.parameter(leftPhysType.getJavaRowType(), "left"); final ParameterExpression right_ = Expressions.parameter(rightPhysType.getJavaRowType(), "right"); final RexProgramBuilder program = new RexProgramBuilder( implementor.getTypeFactory().builder() .addAll(left.getRowType().getFieldList()) .addAll(right.getRowType().getFieldList()) .build(), getCluster().getRexBuilder()); program.addCondition(condition); builder.add( Expressions.return_(null, RexToLixTranslator.translateCondition(program.getProgram(), implementor.getTypeFactory(), builder, new RexToLixTranslator.InputGetterImpl( ImmutableList.of(Pair.of((Expression) left_, leftPhysType), Pair.of((Expression) right_, rightPhysType))), implementor.allCorrelateVariables, implementor.getConformance()))); return Expressions.lambda(Predicate2.class, builder.toBlock(), left_, right_); } }
Expression predicate(EnumerableRelImplementor implementor, BlockBuilder builder, PhysType leftPhysType, PhysType rightPhysType, RexNode condition) { final ParameterExpression left_ = Expressions.parameter(leftPhysType.getJavaRowType(), "left"); final ParameterExpression right_ = Expressions.parameter(rightPhysType.getJavaRowType(), "right"); final RexProgramBuilder program = new RexProgramBuilder( implementor.getTypeFactory().builder() .addAll(left.getRowType().getFieldList()) .addAll(right.getRowType().getFieldList()) .build(), getCluster().getRexBuilder()); program.addCondition(condition); builder.add( Expressions.return_(null, RexToLixTranslator.translateCondition(program.getProgram(), implementor.getTypeFactory(), builder, new RexToLixTranslator.InputGetterImpl( ImmutableList.of(Pair.of((Expression) left_, leftPhysType), Pair.of((Expression) right_, rightPhysType))), implementor.allCorrelateVariables, implementor.getConformance()))); return Expressions.lambda(Predicate2.class, builder.toBlock(), left_, right_); } }
final BlockBuilder builder2 = new BlockBuilder(); final ParameterExpression v_ = Expressions.parameter(inputPhysType.getJavaRowType(), builder2.newName("v"));
final PhysType childPhysType = result.physType; final ParameterExpression o_ = Expressions.parameter(childPhysType.getJavaRowType(), "o"); final int fieldCount = childPhysType.getRowType().getFieldCount();
final PhysType childPhysType = result.physType; final ParameterExpression o_ = Expressions.parameter(childPhysType.getJavaRowType(), "o"); final int fieldCount = childPhysType.getRowType().getFieldCount();
Type corrVarType = leftResult.physType.getJavaRowType();
Type corrVarType = leftResult.physType.getJavaRowType();