Search in sources :

Example 1 with ExprToRex

use of org.apache.drill.exec.planner.index.ExprToRex in project drill by apache.

the class PluginProjectRule method createPluginProject.

protected Project createPluginProject(Project project, DrillRelOptUtil.ProjectPushInfo projectPushInfo) {
    ExprToRex exprToRex = new ExprToRex(project.getInput(), project.getInput().getRowType(), project.getCluster().getRexBuilder());
    List<RexNode> newProjects = projectPushInfo.getFields().stream().map(f -> f.accept(exprToRex, null)).collect(Collectors.toList());
    return new PluginProjectRel(getOutConvention(), project.getCluster(), project.getTraitSet().replace(getOutConvention()), convert(project.getInput(), project.getTraitSet().replace(getOutConvention())), newProjects, projectPushInfo.createNewRowType(project.getCluster().getTypeFactory()));
}
Also used : Convention(org.apache.calcite.plan.Convention) Project(org.apache.calcite.rel.core.Project) RelDataType(org.apache.calcite.rel.type.RelDataType) ExprToRex(org.apache.drill.exec.planner.index.ExprToRex) DrillRel(org.apache.drill.exec.planner.logical.DrillRel) RelNode(org.apache.calcite.rel.RelNode) Collectors(java.util.stream.Collectors) Utilities(org.apache.drill.exec.util.Utilities) List(java.util.List) RexNode(org.apache.calcite.rex.RexNode) DrillRelOptUtil(org.apache.drill.exec.planner.common.DrillRelOptUtil) RelTrait(org.apache.calcite.plan.RelTrait) DrillProjectRel(org.apache.drill.exec.planner.logical.DrillProjectRel) ProjectRemoveRule(org.apache.calcite.rel.rules.ProjectRemoveRule) PluginImplementor(org.apache.drill.exec.store.plan.PluginImplementor) PluginProjectRel(org.apache.drill.exec.store.plan.rel.PluginProjectRel) ExprToRex(org.apache.drill.exec.planner.index.ExprToRex) PluginProjectRel(org.apache.drill.exec.store.plan.rel.PluginProjectRel) RexNode(org.apache.calcite.rex.RexNode)

Aggregations

List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Convention (org.apache.calcite.plan.Convention)1 RelTrait (org.apache.calcite.plan.RelTrait)1 RelNode (org.apache.calcite.rel.RelNode)1 Project (org.apache.calcite.rel.core.Project)1 ProjectRemoveRule (org.apache.calcite.rel.rules.ProjectRemoveRule)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1 RexNode (org.apache.calcite.rex.RexNode)1 DrillRelOptUtil (org.apache.drill.exec.planner.common.DrillRelOptUtil)1 ExprToRex (org.apache.drill.exec.planner.index.ExprToRex)1 DrillProjectRel (org.apache.drill.exec.planner.logical.DrillProjectRel)1 DrillRel (org.apache.drill.exec.planner.logical.DrillRel)1 PluginImplementor (org.apache.drill.exec.store.plan.PluginImplementor)1 PluginProjectRel (org.apache.drill.exec.store.plan.rel.PluginProjectRel)1 Utilities (org.apache.drill.exec.util.Utilities)1