|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.rel.AbstractRelNode org.eigenbase.rel.SingleRel org.eigenbase.oj.rel.IterCalcRel
public class IterCalcRel
IterCalcRel
is an iterator implementation of a combination of
ProjectRel
above an optional FilterRel
. It takes a iterator
as input, and for each row applies the filter condition
if defined. Rows passing the filter expression are transformed via projection
and returned. Note that the same object is always returned (with different
values), so parents must not buffer the result.
Rules:
IterRules.IterCalcRule
creates an
IterCalcRel from a CalcRel
Field Summary | |
---|---|
private static boolean |
abortOnError
|
private static boolean |
errorBuffering
|
protected int |
flags
Values defined in ProjectRelBase.Flags . |
private RexProgram |
program
|
private String |
tag
|
Fields inherited from class org.eigenbase.rel.AbstractRelNode |
---|
digest, id, rowType, traits |
Fields inherited from interface org.eigenbase.rel.RelNode |
---|
emptyArray |
Constructor Summary | |
---|---|
IterCalcRel(RelOptCluster cluster,
RelNode child,
RexProgram program,
int flags)
|
|
IterCalcRel(RelOptCluster cluster,
RelNode child,
RexProgram program,
int flags,
String tag)
|
Method Summary | |
---|---|
private static Statement |
assignInputRow(OJClass inputRowClass,
Variable varInputRow,
Variable varInputObj)
|
IterCalcRel |
clone()
Clones this RelNode. |
protected String |
computeDigest()
Computes the digest. |
RelOptCost |
computeSelfCost(RelOptPlanner planner)
Returns the cost of this plan (not including children). |
void |
explain(RelOptPlanWriter pw)
|
int |
getFlags()
|
RexProgram |
getProgram()
|
double |
getRows()
Returns an estimate of the number of rows this relational expression will return. |
String |
getTag()
|
ParseTree |
implement(JavaRelImplementor implementor)
Creates a plan for this expression according to a calling convention. |
static Expression |
implementAbstract(JavaRelImplementor implementor,
JavaRel rel,
Expression childExp,
Variable varInputRow,
RelDataType inputRowType,
RelDataType outputRowType,
RexProgram program,
String tag)
|
static Expression |
implementAbstractTupleIter(JavaRelImplementor implementor,
JavaRel rel,
Expression childExp,
Variable varInputRow,
RelDataType inputRowType,
RelDataType outputRowType,
RexProgram program,
String tag)
Generates code for a Java expression satisfying the TupleIter interface. |
JavaRel |
implementFieldAccess(JavaRelImplementor implementor,
String fieldName)
Burrows into a synthetic record and returns the underlying relation which provides the field called fieldName . |
boolean |
isBoxed()
|
static void |
setAbortOnError(boolean abortOnError)
Disables throwing of exceptions on error. |
static void |
setErrorBuffering(boolean errorBuffering)
Allows errors to be buffered, in the event that they overflow the error handler. |
Methods inherited from class org.eigenbase.rel.SingleRel |
---|
childrenAccept, deriveRowType, getChild, getInputs, replaceInput |
Methods inherited from class org.eigenbase.rel.AbstractRelNode |
---|
cloneTraits, collectVariablesSet, collectVariablesUsed, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, inheritTraitsFrom, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eigenbase.rel.RelNode |
---|
childrenAccept, collectVariablesSet, collectVariablesUsed, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, registerCorrelVariable, replaceInput, setCorrelVariable |
Field Detail |
---|
private static boolean abortOnError
private static boolean errorBuffering
private final RexProgram program
protected int flags
ProjectRelBase.Flags
.
private String tag
Constructor Detail |
---|
public IterCalcRel(RelOptCluster cluster, RelNode child, RexProgram program, int flags)
public IterCalcRel(RelOptCluster cluster, RelNode child, RexProgram program, int flags, String tag)
Method Detail |
---|
public void explain(RelOptPlanWriter pw)
explain
in interface RelNode
explain
in class SingleRel
protected String computeDigest()
AbstractRelNode
computeDigest
in class AbstractRelNode
public double getRows()
RelNode
NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getRowCount(org.eigenbase.rel.RelNode)
, which gives plugins a chance to
override the rel's default ideas about row count.
getRows
in interface RelNode
getRows
in class SingleRel
public RelOptCost computeSelfCost(RelOptPlanner planner)
RelNode
NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.eigenbase.rel.RelNode)
, which gives plugins a
chance to override the rel's default ideas about cost.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
public IterCalcRel clone()
RelNode
Traits of the RelNode must be explicitly cloned, using AbstractRelNode.inheritTraitsFrom(AbstractRelNode)
, as the RelNode may
have traits of which it has no knowledge. Example implementation:
public MyRelNode clone() { MyRelNode clone = new MyRelNode(...); clone.inheritTraitsFrom(this); return clone; }N.B.: This method must be overridden whenever an existing, concrete RelNode is extended. Otherwise, calling clone() will produce a differently typed RelNode, resulting in invalid or incorrect query plans.
clone
in interface RelNode
clone
in class AbstractRelNode
public int getFlags()
public boolean isBoxed()
public JavaRel implementFieldAccess(JavaRelImplementor implementor, String fieldName)
fieldName
.
public static void setAbortOnError(boolean abortOnError)
public static void setErrorBuffering(boolean errorBuffering)
errorBuffering
- whether to buffer errorspublic static Expression implementAbstract(JavaRelImplementor implementor, JavaRel rel, Expression childExp, Variable varInputRow, RelDataType inputRowType, RelDataType outputRowType, RexProgram program, String tag)
public static Expression implementAbstractTupleIter(JavaRelImplementor implementor, JavaRel rel, Expression childExp, Variable varInputRow, RelDataType inputRowType, RelDataType outputRowType, RexProgram program, String tag)
TupleIter
interface. The generated code allocates
a CalcTupleIter
with a dynamic TupleIter.fetchNext()
method. If the "abort on
error" flag is false, or an error handling tag is specified, then
fetchNext is written to handle row errors.
Row errors are handled by wrapping expressions that can fail with a try/catch block. A caught RuntimeException is then published to an "connection variable." In the event that errors can overflow, an "error buffering" flag allows them to be posted again on the next iteration of fetchNext.
implementor
- an object that implements relations as Java coderel
- the relation to be implementedchildExp
- the implemented child of the relationvarInputRow
- the Java variable to use for the input rowinputRowType
- the rel data type of the input rowoutputRowType
- the rel data type of the output rowprogram
- the rex program to implemented by the relationtag
- an error handling tag
public ParseTree implement(JavaRelImplementor implementor)
JavaRel
implement
in interface JavaRel
implementor
- implementorpublic RexProgram getProgram()
public String getTag()
private static Statement assignInputRow(OJClass inputRowClass, Variable varInputRow, Variable varInputObj)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |