Package org.eigenbase.rel

Examples of org.eigenbase.rel.ProjectRel


    super(RelOptRule.some(ProjectRel.class, Convention.NONE, RelOptRule.any(RelNode.class)), "DrillProjectRule");
  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final ProjectRel project = (ProjectRel) call.rel(0);
    final RelNode input = call.rel(1);
    final RelTraitSet traits = project.getTraitSet().plus(DrillRel.CONVENTION);
    final RelNode convertedInput = convert(input, traits);
    call.transformTo(new DrillProjectRel(project.getCluster(), traits, convertedInput, project.getProjects(), project
        .getRowType()));
  }
View Full Code Here


  }


  @Override
  public void onMatch(RelOptRuleCall call) {
    final ProjectRel proj = (ProjectRel) call.rel(0);
    final EnumerableTableAccessRel scan = (EnumerableTableAccessRel) call.rel(1);

    try {
      ProjectPushInfo columnInfo = PrelUtil.getColumns(scan.getRowType(), proj.getProjects());

      if(columnInfo == null || columnInfo.isStarQuery() //
          || !scan.getTable().unwrap(DrillTable.class) //
          .getGroupScan().canPushdownProjects(columnInfo.columns)) return;

      final DrillScanRel newScan =
          new DrillScanRel(scan.getCluster(),
              scan.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
              scan.getTable(),
              columnInfo.createNewRowType(proj.getChild().getCluster().getTypeFactory()),
              columnInfo.columns);


      List<RexNode> newProjects = Lists.newArrayList();
      for(RexNode n : proj.getChildExps()){
        newProjects.add(n.accept(columnInfo.getInputRewriter()));
      }

      final DrillProjectRel newProj =
          new DrillProjectRel(proj.getCluster(),
              proj.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
              newScan,
              newProjects,
              proj.getRowType());

      if (RemoveTrivialProjectRule.isTrivial(newProj)) {
        call.transformTo(newScan);
      } else {
        call.transformTo(newProj);
View Full Code Here

      }
      exprList.add(newExpr);
    }

    if (rewrite == true) {
      ProjectRel newProject = project.copy(project.getTraitSet(), project.getInput(0), exprList, project.getRowType());
      return visitChild(newProject, 0, project.getChild());
    }

    return visitChild(project, 0, project.getChild());
  }
View Full Code Here

    super(RelOptHelper.any(ProjectRel.class, Convention.NONE), "DrillProjectRule");
  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    final ProjectRel project = (ProjectRel) call.rel(0);
    final RelNode input = project.getChild();
    final RelTraitSet traits = project.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
    final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
    call.transformTo(new DrillProjectRel(project.getCluster(), traits, convertedInput, project.getProjects(), project
        .getRowType()));
  }
View Full Code Here

    this.preserveExprCondition = preserveExprCondition;
  }

  @Override
  public void onMatch(RelOptRuleCall call) {
    ProjectRel origProj;
    FilterRel filterRel;

    if (call.rels.length == 2) {
      origProj = call.rel(0);
      filterRel = call.rel(1);
    } else {
      origProj = null;
      filterRel = call.rel(0);
    }
    RelNode rel = filterRel.getChild();
    RexNode origFilter = filterRel.getCondition();

    if ((origProj != null) && RexOver.containsOver(origProj.getProjects(), null)) {
      // Cannot push project through filter if project contains a windowed
      // aggregate -- it will affect row counts. Abort this rule
      // invocation; pushdown will be considered after the windowed
      // aggregate has been implemented. It's OK if the filter contains a
      // windowed aggregate.
View Full Code Here

      }
      exprList.add(newExpr);
    }

    if (rewrite == true) {
      ProjectRel newProject = project.copy(project.getTraitSet(), project.getInput(0), exprList, project.getRowType());
      return visitChild(newProject, 0, project.getChild());
    }

    return visitChild(project, 0, project.getChild());
  }
View Full Code Here

  }


  @Override
  public void onMatch(RelOptRuleCall call) {
    final ProjectRel proj = (ProjectRel) call.rel(0);
    final EnumerableTableAccessRel scan = (EnumerableTableAccessRel) call.rel(1);

    try {
      ProjectPushInfo columnInfo = PrelUtil.getColumns(scan.getRowType(), proj.getProjects());

      if (columnInfo == null || columnInfo.isStarQuery() //
          || !scan.getTable().unwrap(DrillTable.class) //
          .getGroupScan().canPushdownProjects(columnInfo.columns)) {
        return;
      }

      final DrillScanRel newScan =
          new DrillScanRel(scan.getCluster(),
              scan.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
              scan.getTable(),
              columnInfo.createNewRowType(proj.getChild().getCluster().getTypeFactory()),
              columnInfo.columns);


      List<RexNode> newProjects = Lists.newArrayList();
      for (RexNode n : proj.getChildExps()) {
        newProjects.add(n.accept(columnInfo.getInputRewriter()));
      }

      final DrillProjectRel newProj =
          new DrillProjectRel(proj.getCluster(),
              proj.getTraitSet().plus(DrillRel.DRILL_LOGICAL),
              newScan,
              newProjects,
              proj.getRowType());

      if (RemoveTrivialProjectRule.isTrivial(newProj)) {
        call.transformTo(newScan);
      } else {
        call.transformTo(newProj);
View Full Code Here

  @Override
  public RelNode convert( RelNode rel )
    {
    // stolen from JavaRules.EnumerableAggregateRule
    ProjectRel project = (ProjectRel) rel;

    RelNode convertedChild = convert( project.getChild(), project.getTraitSet().replace( CONVENTION ) );

    if( convertedChild == null )
      return null; // We can't convert the child, so we can't convert rel.

//    return new CascadingProjectRel( rel.getCluster(), rel.getTraitSet(), convertedChild, project.getGroupSet(), project.getAggCallList() );

    return new CascadingProjectRel( rel.getCluster(),
      rel.getTraitSet(),
      convertedChild,
      project.getProjects(),
      project.getRowType(),
      project.getFlags(),
      project.getCollationList() );
    }
View Full Code Here

    }

  @Override
  public void onMatch( RelOptRuleCall call )
    {
    ProjectRel rel = call.rel( 0 );

    RelTraitSet newTraits = rel.getTraitSet().plus( Cascading.CONVENTION );

    call.transformTo( new CascadingProjectRel(
      rel.getCluster(),
      newTraits,
      convert( rel.getChild(), newTraits ),
      rel.getProjects(),
      rel.getRowType(),
      rel.getFlags(),
      rel.getCollationList() ) );
    }
View Full Code Here

TOP

Related Classes of org.eigenbase.rel.ProjectRel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.