net.sf.saffron.oj.rel
Class JavaProjectRel

java.lang.Object
  |
  +--net.sf.saffron.rel.SaffronRel
        |
        +--net.sf.saffron.rel.SingleRel
              |
              +--net.sf.saffron.rel.ProjectRelBase
                    |
                    +--net.sf.saffron.rel.ProjectRel
                          |
                          +--net.sf.saffron.oj.rel.JavaProjectRel
All Implemented Interfaces:
JavaRel

public class JavaProjectRel
extends ProjectRel
implements JavaRel

Implements the ProjectRel relational expression as Java code.


Nested Class Summary
 
Nested classes inherited from class net.sf.saffron.rel.ProjectRelBase
ProjectRelBase.Flags
 
Field Summary
 
Fields inherited from class net.sf.saffron.rel.ProjectRelBase
exps, fieldNames, flags
 
Fields inherited from class net.sf.saffron.rel.SingleRel
child
 
Fields inherited from class net.sf.saffron.rel.SaffronRel
cluster, digest, id, rowType
 
Constructor Summary
JavaProjectRel(VolcanoCluster cluster, SaffronRel child, RexNode[] exps, String[] fieldNames, int flags)
           
 
Method Summary
 Object clone()
           
 CallingConvention getConvention()
          Returns a value from CallingConvention.
 Object implement(RelImplementor implementor, int ordinal)
          Create a plan for this expression according to a calling convention.
 Expression implementSelf(RelImplementor implementor)
          Generates the initializer for the variable which holds the current row of this project.
 
Methods inherited from class net.sf.saffron.rel.ProjectRelBase
computeSelfCost, defineTerms, deriveRowType, explain, getChildExps, getFieldNames, getFlags, implementFieldAccess, isBoxed
 
Methods inherited from class net.sf.saffron.rel.SingleRel
childrenAccept, getInputs, getRows, replaceInput
 
Methods inherited from class net.sf.saffron.rel.SaffronRel
computeDigest, getCluster, getCorrelVariable, getId, getInput, getOrCreateCorrelVariable, getQualifier, getQuery, getRelTypeName, getRowType, getTable, getVariablesStopped, isAccessTo, isDistinct, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaProjectRel

public JavaProjectRel(VolcanoCluster cluster,
                      SaffronRel child,
                      RexNode[] exps,
                      String[] fieldNames,
                      int flags)
Method Detail

getConvention

public CallingConvention getConvention()
Description copied from class: SaffronRel
Returns a value from CallingConvention.

Overrides:
getConvention in class SaffronRel

clone

public Object clone()
Overrides:
clone in class ProjectRel

implement

public Object implement(RelImplementor implementor,
                        int ordinal)
Description copied from class: SaffronRel
Create a plan for this expression according to a calling convention.

Overrides:
implement in class SaffronRel
Parameters:
implementor - implementor
ordinal - indicates our position in the pre-, in- and postfix walk over the tree; ordinal is -1 when called from the parent, and i when called from the ith child.

implementSelf

public Expression implementSelf(RelImplementor implementor)
Generates the initializer for the variable which holds the current row of this project. If the row-type V is complex, generate

  V v = new V(exp, ...);
  {parent-handler(v)}
  
If the row-type is simple, generate

  V v = exp;
  {parent-handler(v)}
  
Todo: map relations to expressions (not variables), so we don't have to create new objects:

  T1 v1 = exp1;
  T2 v2 = exp2;
  {parent-handler(v1,v2)}
  
Or at least, create a holder object outside the loop, and just assign into it:

  V v = new V();
  {loop} {
  v.v1 = exp1;
  v.v2 = exp2;
  {parent-handler(v)}
  }
  

Specified by:
implementSelf in interface JavaRel
See Also:
RelImplementor.bind(SaffronRel,SaffronRel)

SourceForge.net_Logo