net.sf.farrago.query
Class FarragoPreparingStmt.PermutingRelOptTable

java.lang.Object
  extended by org.eigenbase.relopt.RelOptAbstractTable
      extended by net.sf.farrago.query.FarragoPreparingStmt.PermutingRelOptTable
All Implemented Interfaces:
RelOptTable
Enclosing class:
FarragoPreparingStmt

protected class FarragoPreparingStmt.PermutingRelOptTable
extends RelOptAbstractTable

Transform which permutes the columns of an input table, applying casts amd renaming columns if necessary, to make the output rowtype match the desired rowtype.

The input table must have a superset of the columns of the output rowtype, and their types must be coercible into the output types. Conversion is performed by the SqlToRelConverter.convertField(org.eigenbase.reltype.RelDataType, org.eigenbase.reltype.RelDataTypeField) method.

The transform generally generates an extra CalcRel during the conversion to a RelNode.


Field Summary
private  RelOptTable inputTable
           
 
Fields inherited from class org.eigenbase.relopt.RelOptAbstractTable
name, rowType, schema
 
Constructor Summary
protected FarragoPreparingStmt.PermutingRelOptTable(RelOptSchema schema, String name, RelDataType rowType, RelOptTable inputTable)
          Creates a table which converts an input row type to a desired output row type, shuffling and casting columns in order to do so.
 
Method Summary
 RelNode toRel(RelOptCluster cluster, RelOptConnection connection)
          Converts this table into a relational expression.
 
Methods inherited from class org.eigenbase.relopt.RelOptAbstractTable
getCollationList, getName, getQualifiedName, getRelOptSchema, getRowCount, getRowType, setRowType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputTable

private final RelOptTable inputTable
Constructor Detail

FarragoPreparingStmt.PermutingRelOptTable

protected FarragoPreparingStmt.PermutingRelOptTable(RelOptSchema schema,
                                                    String name,
                                                    RelDataType rowType,
                                                    RelOptTable inputTable)
Creates a table which converts an input row type to a desired output row type, shuffling and casting columns in order to do so.

Parameters:
schema - Schema the table belongs to
name - Name of this table
rowType - Output row type of this table
inputTable - Input table
Method Detail

toRel

public RelNode toRel(RelOptCluster cluster,
                     RelOptConnection connection)
Description copied from interface: RelOptTable
Converts this table into a relational expression.

The planner calls this method to convert a table into an initial relational expression, generally something abstract, such as a TableAccessRel, then optimizes this expression by applying rules to transform it into more efficient access methods for this table.

Parameters:
cluster - the cluster the relational expression will belong to
connection - the parse tree of the expression which evaluates to a connection object