public static DrillProjectRel convert(Project project, ConversionContext context)
     throws InvalidRelException {
   RelNode input = context.toRel(project.getInput());
   List<RelDataTypeField> fields = Lists.newArrayList();
   List<RexNode> exps = Lists.newArrayList();
   for (NamedExpression expr : project.getSelections()) {
     fields.add(
         new RelDataTypeFieldImpl(
             expr.getRef().getRootSegment().getPath(),
             fields.size(),
             context.getTypeFactory().createSqlType(SqlTypeName.ANY)));
     exps.add(context.toRex(expr.getExpr()));
   }
   return new DrillProjectRel(
       context.getCluster(), context.getLogicalTraits(), input, exps, new RelRecordType(fields));
 }
示例#2
0
 public static DrillScanRel convert(Scan scan, ConversionContext context) {
   return new DrillScanRel(
       context.getCluster(), context.getLogicalTraits(), context.getTable(scan));
 }