public class PushProjector
extends java.lang.Object
Pushing is particularly interesting in the case of join, because there are multiple inputs. Generally an expression can be pushed down to a particular input if it depends upon no other inputs. If it can be pushed down to both sides, it is pushed down to the left.
Sometimes an expression needs to be split before it can be pushed down. To flag that an expression cannot be split, specify a rule that it must be preserved. Such an expression will be pushed down intact to one of the inputs, or not pushed down at all.
Modifier and Type  Class and Description 

static interface 
PushProjector.ExprCondition
A functor that replies true or false for a given expression.

Constructor and Description 

PushProjector(Project origProj,
RexNode origFilter,
RelNode childRel,
PushProjector.ExprCondition preserveExprCondition,
RelBuilder relBuilder)
Creates a PushProjector object for pushing projects past a RelNode.

Modifier and Type  Method and Description 

RelNode 
convertProject(RexNode defaultExpr)
Decomposes a projection to the input references referenced by a
projection and a filter, either of which is optional.

RexNode 
convertRefsAndExprs(RexNode rex,
java.util.List<RelDataTypeField> destFields,
int[] adjustments)
Clones an expression tree and walks through it, adjusting each
RexInputRef index by some amount, and converting expressions that need to
be preserved to field references.

RelNode 
createNewProject(RelNode projChild,
int[] adjustments)
Creates a new projection based on the original projection, adjusting all
input refs using an adjustment array passed in.

Project 
createProjectRefsAndExprs(RelNode projChild,
boolean adjust,
boolean rightSide)
Creates a projection based on the inputs specified in a bitmap and the
expressions that need to be preserved.

int[] 
getAdjustments()
Determines how much each input reference needs to be adjusted as a result
of projection

boolean 
locateAllRefs()
Locates all references found in either the projection expressions a
filter, as well as references to expressions that should be preserved.

public PushProjector(Project origProj, RexNode origFilter, RelNode childRel, PushProjector.ExprCondition preserveExprCondition, RelBuilder relBuilder)
origProj
 the original projection that is being pushed;
may be null if the projection is implied as a
result of a projection having been trivially
removedorigFilter
 the filter that the projection must also be
pushed past, if applicablechildRel
 the RelNode that the projection is being
pushed pastpreserveExprCondition
 condition for whether an expression should
be preserved in the projectionpublic RelNode convertProject(RexNode defaultExpr)
Creates a projection containing all input references as well as preserving any special expressions. Converts the original projection and/or filter to reference the new projection. Then, finally puts on top, a final projection corresponding to the original projection.
defaultExpr
 expression to be used in the projection if no fields
or special columns are selectedpublic boolean locateAllRefs()
public Project createProjectRefsAndExprs(RelNode projChild, boolean adjust, boolean rightSide)
projChild
 child that the projection will be created on top ofadjust
 if true, need to create new projection expressions;
otherwise, the existing ones are reusedrightSide
 if true, creating a projection for the right hand side
of a joinpublic int[] getAdjustments()
public RexNode convertRefsAndExprs(RexNode rex, java.util.List<RelDataTypeField> destFields, int[] adjustments)
rex
 the expressiondestFields
 fields that the new expressions will be referencingadjustments
 the amount each input reference index needs to be
adjusted bypublic RelNode createNewProject(RelNode projChild, int[] adjustments)
If the resulting projection would be trivial, return the child.
projChild
 child of the new projectadjustments
 array indicating how much each input reference should
be adjusted byCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.