org.eigenbase.relopt
Class CallingConvention

java.lang.Object
  extended by org.eigenbase.relopt.CallingConvention
All Implemented Interfaces:
RelTrait

public class CallingConvention
extends Object
implements RelTrait

CallingConvention enumerates the calling conventions built in to the Saffron project. This set can be extended by applications by defining new instances of CallingConvention and registering them with a planner, along with the desired conversion rules. Extended ordinals must be greater than CallingConvention.enumeration.getMax().


Field Summary
static CallingConvention ARRAY
           
static int ARRAY_ORDINAL
          The ARRAY calling convention results in a Java expression which evaluates to an array containing the rows returned.
static CallingConvention COLLECTION
           
static int COLLECTION_ORDINAL
          The COLLECTION calling convention results in a Java expression which evaluates to a Collection, typically a ArrayList.
static CallingConvention ENUMERATION
           
static int ENUMERATION_ORDINAL
           
static CallingConvention EXISTS
           
static int EXISTS_ORDINAL
          The EXISTS calling convention is only allowed for a terminator.
static CallingConvention HASHTABLE
           
static int HASHTABLE_ORDINAL
           
private  Class interfaze
          Interface that a relational expression of this calling convention must implement.
static CallingConvention ITERABLE
           
static int ITERABLE_ORDINAL
          The ITERABLE calling convention means that the expression is converted to an openjava expression (Expression) which evalutes to an object which implements Iterable.
static CallingConvention ITERATOR
           
static int ITERATOR_ORDINAL
          The ITERATOR calling convention means that the expression is converted to an openjava expression (Expression) which evalutes to an TupleIter.
static CallingConvention JAVA
           
static int JAVA_ORDINAL
          The JAVA calling convention means that the expression is converted into an Openjava parse tree, which can then be un-parsed, compiled, and executed as java code.
static CallingConvention MAP
           
static int MAP_ORDINAL
           
private static int maxOrdinal
           
private  String name
          Enumerated value's name.
static CallingConvention NONE
           
static int NONE_ORDINAL
          The NONE calling convention means that expression does not support any calling convention -- in other words, it is not implementable, and has to be transformed to something else in order to be implemented.
private  int ordinal
          Enumerated value's ordinal.
static CallingConvention RESULT_SET
           
static int RESULT_SET_ORDINAL
          The RESULT_SET calling convention means that the expression is a JDBC result set.
static CallingConvention[] values
           
static CallingConvention VECTOR
           
static int VECTOR_ORDINAL
           
 
Constructor Summary
CallingConvention(String name, int ordinal, Class interfaze)
           
 
Method Summary
 boolean equals(Object o)
          Compares this CallingConvention to another for equality by ordinal.
static int generateOrdinal()
           
 Class getInterface()
           
 String getName()
           
 int getOrdinal()
           
 RelTraitDef getTraitDef()
          Returns the RelTraitDef that defines this RelTrait.
 int hashCode()
          Returns the ordinal as the CallingConvention's hash code.
 String toString()
          Returns the value's name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

maxOrdinal

private static int maxOrdinal

NONE_ORDINAL

public static final int NONE_ORDINAL
The NONE calling convention means that expression does not support any calling convention -- in other words, it is not implementable, and has to be transformed to something else in order to be implemented.

See Also:
Constant Field Values

NONE

public static final CallingConvention NONE

JAVA_ORDINAL

public static final int JAVA_ORDINAL
The JAVA calling convention means that the expression is converted into an Openjava parse tree, which can then be un-parsed, compiled, and executed as java code.

The JavaRel.implement(org.eigenbase.oj.rel.JavaRelImplementor) method generates a piece of code which will call the piece of code corresponding to the parent once for each row:

See Also:
Constant Field Values

JAVA

public static final CallingConvention JAVA

ITERATOR_ORDINAL

public static final int ITERATOR_ORDINAL
The ITERATOR calling convention means that the expression is converted to an openjava expression (Expression) which evalutes to an TupleIter. See ConverterRel.

See Also:
Constant Field Values

ITERATOR

public static final CallingConvention ITERATOR

ARRAY_ORDINAL

public static final int ARRAY_ORDINAL
The ARRAY calling convention results in a Java expression which evaluates to an array containing the rows returned. Compare with JAVA_ORDINAL, where a loop does something for each row returned).

See Also:
Constant Field Values

ARRAY

public static final CallingConvention ARRAY

COLLECTION_ORDINAL

public static final int COLLECTION_ORDINAL
The COLLECTION calling convention results in a Java expression which evaluates to a Collection, typically a ArrayList.

See Also:
Constant Field Values

COLLECTION

public static final CallingConvention COLLECTION

VECTOR_ORDINAL

public static final int VECTOR_ORDINAL
See Also:
Constant Field Values

VECTOR

public static final CallingConvention VECTOR

ENUMERATION_ORDINAL

public static final int ENUMERATION_ORDINAL
See Also:
Constant Field Values

ENUMERATION

public static final CallingConvention ENUMERATION

MAP_ORDINAL

public static final int MAP_ORDINAL
See Also:
Constant Field Values

MAP

public static final CallingConvention MAP

HASHTABLE_ORDINAL

public static final int HASHTABLE_ORDINAL
See Also:
Constant Field Values

HASHTABLE

public static final CallingConvention HASHTABLE

ITERABLE_ORDINAL

public static final int ITERABLE_ORDINAL
The ITERABLE calling convention means that the expression is converted to an openjava expression (Expression) which evalutes to an object which implements Iterable.

See Also:
Constant Field Values

ITERABLE

public static final CallingConvention ITERABLE

EXISTS_ORDINAL

public static final int EXISTS_ORDINAL
The EXISTS calling convention is only allowed for a terminator.

See Also:
Constant Field Values

EXISTS

public static final CallingConvention EXISTS

RESULT_SET_ORDINAL

public static final int RESULT_SET_ORDINAL
The RESULT_SET calling convention means that the expression is a JDBC result set. When a result set is converted to another convention such as array or iterator, the default object type is Row.

See Also:
Constant Field Values

RESULT_SET

public static final CallingConvention RESULT_SET

values

public static final CallingConvention[] values

name

private final String name
Enumerated value's name.


ordinal

private final int ordinal
Enumerated value's ordinal.


interfaze

private final Class interfaze
Interface that a relational expression of this calling convention must implement. Must be a sub-interface of RelNode.

Constructor Detail

CallingConvention

public CallingConvention(String name,
                         int ordinal,
                         Class interfaze)
Method Detail

getInterface

public Class getInterface()

generateOrdinal

public static int generateOrdinal()

getName

public String getName()

getOrdinal

public int getOrdinal()

getTraitDef

public RelTraitDef getTraitDef()
Description copied from interface: RelTrait
Returns the RelTraitDef that defines this RelTrait.

Specified by:
getTraitDef in interface RelTrait
Returns:
the RelTraitDef that defines this RelTrait

hashCode

public int hashCode()
Returns the ordinal as the CallingConvention's hash code.

Specified by:
hashCode in interface RelTrait
Overrides:
hashCode in class Object
Returns:
ordinal

equals

public boolean equals(Object o)
Compares this CallingConvention to another for equality by ordinal.

Specified by:
equals in interface RelTrait
Overrides:
equals in class Object
Parameters:
o - the other CallingConvention
Returns:
true if they are equal, false otherwise

toString

public String toString()
Returns the value's name.

Specified by:
toString in interface RelTrait
Overrides:
toString in class Object