|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.oj.rel.JavaRelImplementor net.sf.farrago.query.FarragoRelImplementor
public class FarragoRelImplementor
FarragoRelImplementor refines JavaRelImplementor
with some Farrago
specifics.
Nested Class Summary | |
---|---|
static class |
FarragoRelImplementor.RelPathEntry
RelPathEntry keeps track of a RelNode and its input position within that node's parent RelNode in the execution stream graph. |
private static class |
FarragoRelImplementor.RelScope
|
private static class |
FarragoRelImplementor.UdfAwareOJRexImplementorTable
An operator implementor table which knows about UDF's. |
Nested classes/interfaces inherited from class org.eigenbase.oj.rel.JavaRelImplementor |
---|
JavaRelImplementor.TranslationTester, JavaRelImplementor.VariableInitializerThunk |
Field Summary | |
---|---|
private List<FarragoRelImplementor.RelPathEntry> |
currRelPathList
|
private int |
nextDynamicParamId
|
private long |
nextRelParamId
|
private int |
nextTransformId
|
(package private) OJClass |
ojAssignableValue
|
(package private) OJClass |
ojBytePointer
|
(package private) FarragoPreparingStmt |
preparingStmt
|
private Map<List<FarragoRelImplementor.RelPathEntry>,FarragoRelImplementor.RelScope> |
relPathScopeMap
|
private Map<RelNode,List<FarragoRelImplementor.RelPathEntry>> |
relToFirstRelPathEntryMap
|
private Map<RelNode,List<FemExecutionStreamDef>> |
relToStreamDefMap
|
private String |
serverMofId
|
private Set<FemExecutionStreamDef> |
streamDefSet
|
private static Logger |
tracer
|
private List<FarragoTransformDef> |
transformDefs
|
private Map<String,FarragoTransformDef> |
transformMap
|
private List<FemJavaTransformStreamDef> |
transformStreamDefs
|
Fields inherited from class org.eigenbase.oj.rel.JavaRelImplementor |
---|
implementorTable |
Constructor Summary | |
---|---|
FarragoRelImplementor(FarragoPreparingStmt preparingStmt,
RexBuilder rexBuilder)
|
Method Summary | |
---|---|
void |
addDataFlowFromProducerToConsumer(FemExecutionStreamDef producer,
FemExecutionStreamDef consumer)
Adds a new explicit dataflow edge between two existing stream definitions. |
void |
addDataFlowFromProducerToConsumer(FemExecutionStreamDef producer,
FemExecutionStreamDef consumer,
boolean implicit)
Adds a new dataflow edge between two existing stream definitions. |
protected void |
addRelPathEntry(RelNode rel,
int ordinal)
Adds a RelPathEntry corresponding to a new RelNode to the current RelPathEntry list |
void |
addTransform(RelNode rel,
ClassDeclaration decl)
|
FennelRelParamId |
allocateRelParamId()
Reserves a Fennel dynamic parameter. |
int |
allocateTransform()
|
void |
compileTransforms(String pkgName)
|
protected FemTupleDescriptor |
computeStreamDefOutputDesc(RelDataType rowType)
|
private void |
finishTransforms()
|
Variable |
getConnectionVariable()
|
FarragoPreparingStmt |
getPreparingStmt()
|
List<FemExecutionStreamDef> |
getRegisteredStreamDefs(RelNode rel)
Returns the list of stream definitions that have been registered for a RelNode. |
List<FarragoRelImplementor.RelPathEntry> |
getRelPathEntry()
|
FarragoRepos |
getRepos()
Returns the repository. |
String |
getServerMofId()
|
Set<FemExecutionStreamDef> |
getStreamDefSet()
|
String |
getStreamGlobalName(FemExecutionStreamDef streamDef,
RelNode rel)
Constructs a globally unique name for an execution stream. |
List<FarragoTransformDef> |
getTransforms()
|
Expression |
implementRoot(JavaRel rel)
Starts an iteration, by calling JavaRel.implement(org.eigenbase.oj.rel.JavaRelImplementor) on the root element. |
boolean |
isFirstTranslationInstance(RelNode rel)
Determines if this is the instance of a RelNode such that the instance corresponds to the one at the time this method was first called. |
RexToOJTranslator |
newStmtTranslator(JavaRel rel,
StatementList stmtList,
MemberDeclarationList memberList)
Creates a translator which can translate a succession of expressions, possibly using multiple statements, scratch variables, and helper functions. |
protected RexToOJTranslator |
newTranslator(RelNode rel)
Creates a RexToOJTranslator with which to translate the row-expressions within a relational expression into OpenJava
expressions. |
private String |
printTransformMap()
|
private String |
printTransforms()
|
void |
registerRelStreamDef(FemExecutionStreamDef streamDef,
RelNode rel,
RelDataType rowType)
Registers a new stream definition. |
private void |
registerStreamDef(FemExecutionStreamDef streamDef,
RelNode rel,
RelDataType rowType)
|
protected void |
removeRelPathEntry()
Removes the RelPathEntry corresponding to the current RelNode being visited from the current RelPathEntry list |
void |
setErrorRecordType(FennelRel rel,
FemExecutionStreamDef streamDef,
RelDataType errorType)
Sets the format of error records for an execution stream. |
void |
setServerMofId(String serverMofId)
Sets the MOFID of the foreign server associated with the expression being implemented. |
protected FemExecutionStreamDef |
toStreamDefImpl(FennelRel rel,
int ordinal)
Converts a FennelRel to a FemExecutionStreamDef , and
prints context if anything goes wrong. |
FennelDynamicParamId |
translateParamId(FennelRelParamId relParamId)
Translates a FennelRelParamId into a FennelDynamicParamId
based on the current scope. |
FennelDynamicParamId |
translateParamId(FennelRelParamId relParamId,
FemExecutionStreamDef streamDef,
FennelDynamicParamId.StreamType streamType)
Translates a FennelRelParamId into a FennelDynamicParamId
based on the current scope. |
Object |
visitChildInternal(RelNode child,
int ordinal)
Override method to deal with the possibility that we are being called from a FennelRel via our FennelRelImplementor interface. |
FemExecutionStreamDef |
visitFennelChild(FennelRel rel,
int ordinal)
Converts a relational expression into a plan by calling its FennelRel.toStreamDef(net.sf.farrago.query.FennelRelImplementor) method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eigenbase.relopt.RelImplementor |
---|
visitChild, visitChildInternal |
Field Detail |
---|
private static final Logger tracer
FarragoPreparingStmt preparingStmt
OJClass ojAssignableValue
OJClass ojBytePointer
private Set<FemExecutionStreamDef> streamDefSet
private String serverMofId
private long nextRelParamId
private int nextDynamicParamId
private List<FarragoRelImplementor.RelPathEntry> currRelPathList
private Map<List<FarragoRelImplementor.RelPathEntry>,FarragoRelImplementor.RelScope> relPathScopeMap
private List<FarragoTransformDef> transformDefs
private List<FemJavaTransformStreamDef> transformStreamDefs
private Map<String,FarragoTransformDef> transformMap
private int nextTransformId
private Map<RelNode,List<FemExecutionStreamDef>> relToStreamDefMap
private Map<RelNode,List<FarragoRelImplementor.RelPathEntry>> relToFirstRelPathEntryMap
Constructor Detail |
---|
public FarragoRelImplementor(FarragoPreparingStmt preparingStmt, RexBuilder rexBuilder)
Method Detail |
---|
public void setServerMofId(String serverMofId)
serverMofId
- MOFID to set, or null to clearpublic String getServerMofId()
getServerMofId
in interface FarragoOJRexRelImplementor
public FarragoRepos getRepos()
FennelRelImplementor
getRepos
in interface FennelRelImplementor
public FennelRelParamId allocateRelParamId()
FennelRelImplementor
FennelRelImplementor.translateParamId(FennelRelParamId)
later as part of its toStreamDef
implementation to convert this into a final FennelDynamicParamId
,
which can then be referenced from stream definitions.
allocateRelParamId
in interface FennelRelImplementor
public FennelDynamicParamId translateParamId(FennelRelParamId relParamId)
FennelRelImplementor
FennelRelParamId
into a FennelDynamicParamId
based on the current scope.
translateParamId
in interface FennelRelImplementor
relParamId
- reserved ID to be translated
public FennelDynamicParamId translateParamId(FennelRelParamId relParamId, FemExecutionStreamDef streamDef, FennelDynamicParamId.StreamType streamType)
FennelRelImplementor
FennelRelParamId
into a FennelDynamicParamId
based on the current scope.
translateParamId
in interface FennelRelImplementor
relParamId
- reserved ID to be translatedstreamDef
- the stream that either produces or consumes the dynamic
parameter; or null if we don't need to keep track of that informationstreamType
- whether the streamDef produces or consumes the dynamic
parameter
public void setErrorRecordType(FennelRel rel, FemExecutionStreamDef streamDef, RelDataType errorType)
FennelRelImplementor
setErrorRecordType
in interface FennelRelImplementor
rel
- relation to which the execution stream belongsstreamDef
- stream definition of stream that may produce errorserrorType
- row type of error records produced by the streampublic FemExecutionStreamDef visitFennelChild(FennelRel rel, int ordinal)
FennelRelImplementor
FennelRel.toStreamDef(net.sf.farrago.query.FennelRelImplementor)
method.
visitFennelChild
in interface FennelRelImplementor
rel
- the relational expressionordinal
- input position of the relational expression for its parentpublic List<FarragoRelImplementor.RelPathEntry> getRelPathEntry()
protected void addRelPathEntry(RelNode rel, int ordinal)
rel
- the new RelNodeordinal
- the input position of the RelNodeprotected void removeRelPathEntry()
protected final FemExecutionStreamDef toStreamDefImpl(FennelRel rel, int ordinal)
FennelRel
to a FemExecutionStreamDef
, and
prints context if anything goes wrong.
This method is final: derived classes should not add extra functionality.
rel
- Relational expressionordinal
- input position of the relational expression for its parent
public Object visitChildInternal(RelNode child, int ordinal)
FennelRel
via our FennelRelImplementor
interface.
visitChildInternal
in interface RelImplementor
visitChildInternal
in class JavaRelImplementor
child
- Child relational expressionordinal
- Ordinal of child within its parent
public Set<FemExecutionStreamDef> getStreamDefSet()
public List<FarragoTransformDef> getTransforms()
public void addTransform(RelNode rel, ClassDeclaration decl)
public int allocateTransform()
public void compileTransforms(String pkgName)
private void finishTransforms()
private String printTransforms()
private String printTransformMap()
public FarragoPreparingStmt getPreparingStmt()
public void registerRelStreamDef(FemExecutionStreamDef streamDef, RelNode rel, RelDataType rowType)
FennelRelImplementor
FennelRelImplementor.visitFennelChild(net.sf.farrago.query.FennelRel, int)
. However, this is not true for non-tree stream graphs.
For streams with multiple parents, this method must be called for streams
not returned from FennelRelImplementor.visitFennelChild(net.sf.farrago.query.FennelRel, int)
.
registerRelStreamDef
in interface FennelRelImplementor
streamDef
- new stream definitionrel
- RelNode which stream implementsrowType
- row type for stream, or null to use rel's row typepublic void addDataFlowFromProducerToConsumer(FemExecutionStreamDef producer, FemExecutionStreamDef consumer)
FennelRelImplementor
NOTE jvs 14-Nov-2005: I gave this method a long name so that it wouldn't be necessary to guess the direction when reading code that uses it.
addDataFlowFromProducerToConsumer
in interface FennelRelImplementor
producer
- the upstream node of the dataflowconsumer
- the downstream node of the dataflowpublic void addDataFlowFromProducerToConsumer(FemExecutionStreamDef producer, FemExecutionStreamDef consumer, boolean implicit)
FennelRelImplementor
addDataFlowFromProducerToConsumer
in interface FennelRelImplementor
producer
- the upstream node of the dataflowconsumer
- the downstream node of the dataflowimplicit
- false if this is an explicit dataflow edge between two
ExecStreams; true if it represents implicit dataflow via a UDX reading
from a cursorprotected FemTupleDescriptor computeStreamDefOutputDesc(RelDataType rowType)
private void registerStreamDef(FemExecutionStreamDef streamDef, RelNode rel, RelDataType rowType)
public List<FemExecutionStreamDef> getRegisteredStreamDefs(RelNode rel)
FennelRelImplementor
getRegisteredStreamDefs
in interface FennelRelImplementor
rel
- the RelNode
public boolean isFirstTranslationInstance(RelNode rel)
FennelRelImplementor
isFirstTranslationInstance
in interface FennelRelImplementor
rel
- the RelNode
public String getStreamGlobalName(FemExecutionStreamDef streamDef, RelNode rel)
streamDef
- stream definitionrel
- rel which generated stream definition, or null if none
public Variable getConnectionVariable()
getConnectionVariable
in class JavaRelImplementor
protected RexToOJTranslator newTranslator(RelNode rel)
JavaRelImplementor
RexToOJTranslator
with which to translate the row-expressions
within a relational expression into OpenJava
expressions.
newTranslator
in class JavaRelImplementor
public RexToOJTranslator newStmtTranslator(JavaRel rel, StatementList stmtList, MemberDeclarationList memberList)
JavaRelImplementor
Typical usage:
Translator translator = newStmtTranslator(rel, stmtList, memberList); translator.translateRexNode(exp1); translator.translateRexNode(exp2);
newStmtTranslator
in class JavaRelImplementor
rel
- the relational expression which is the context for expstmtList
- optional code can be appended herememberList
- optional member declarations can be appended here (if
needed for reusable scratch space or helper functions; local variablespublic Expression implementRoot(JavaRel rel)
JavaRelImplementor
JavaRel.implement(org.eigenbase.oj.rel.JavaRelImplementor)
on the root element.
implementRoot
in class JavaRelImplementor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |