net.sf.farrago.namespace.flatfile
Class FlatFileColumnSet

java.lang.Object
  extended by org.eigenbase.relopt.RelOptAbstractTable
      extended by net.sf.farrago.namespace.impl.MedAbstractColumnSet
          extended by net.sf.farrago.namespace.flatfile.FlatFileColumnSet
All Implemented Interfaces:
FarragoMedColumnSet, FarragoQueryColumnSet, RelOptTable, SqlValidatorTable

 class FlatFileColumnSet
extends MedAbstractColumnSet

FlatFileColumnSet provides a flatfile implementation of the FarragoMedColumnSet interface.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/flatfile/FlatFileColumnSet.java#1 $
Author:
John Pham

Field Summary
(package private)  String filePath
           
(package private)  String logFilePath
           
(package private)  long numRows
           
(package private)  FlatFileParams params
           
static String PROP_FILENAME
           
static String PROP_LOG_FILENAME
           
(package private)  FlatFileParams.SchemaType schemaType
           
private static String TIMESTAMP_FORMAT
           
private static String TIMESTAMP_PREFIX
           
 
Fields inherited from class org.eigenbase.relopt.RelOptAbstractTable
name, rowType, schema
 
Constructor Summary
FlatFileColumnSet(String[] localName, RelDataType rowType, FlatFileParams params, Properties tableProps, long numRows, FlatFileParams.SchemaType schemaType)
           
 
Method Summary
 String getFilePath()
           
 String getLogFilePath()
           
 FlatFileParams getParams()
           
 double getRowCount()
          Returns an estimate of the number of rows in the table.
private  String makeFilePath(String[] localName, String filename)
          Constructs the full path to the file for a table, based upon the server directory, filename option (if specified), and the server data file extension.
private  String makeLogFilePath(String logFilename)
          Constructs the full path to the log file for a table.
private  CalcRel newCalcRel(RelOptCluster cluster, FennelRel child, RexProgram program)
          Constructs a new CalcRel
private  FennelRel newFennelRel(RelOptCluster cluster, RelOptConnection connection, FlatFileParams.SchemaType schemaType, RelDataType rowType)
          Constructs a new FlatFileFennelRel
 RelNode toRel(RelOptCluster cluster, RelOptConnection connection)
          Converts this table into a relational expression.
 
Methods inherited from class net.sf.farrago.namespace.impl.MedAbstractColumnSet
getAllowedAccess, getColumnPropertyMap, getCwmColumnSet, getForeignName, getLocalName, getMonotonicity, getPreparingStmt, getQualifiedName, getTableProperties, setAllowedAccess, setCwmColumnSet, setPreparingStmt, toLenientRel, toUdxRel
 
Methods inherited from class org.eigenbase.relopt.RelOptAbstractTable
getCollationList, getName, getRelOptSchema, getRowType, setRowType
 
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.RelOptTable
getCollationList, getRelOptSchema, getRowType
 
Methods inherited from interface org.eigenbase.sql.validate.SqlValidatorTable
getRowType
 

Field Detail

PROP_FILENAME

public static final String PROP_FILENAME
See Also:
Constant Field Values

PROP_LOG_FILENAME

public static final String PROP_LOG_FILENAME
See Also:
Constant Field Values

TIMESTAMP_PREFIX

private static final String TIMESTAMP_PREFIX
See Also:
Constant Field Values

TIMESTAMP_FORMAT

private static final String TIMESTAMP_FORMAT
See Also:
Constant Field Values

params

FlatFileParams params

filePath

String filePath

logFilePath

String logFilePath

schemaType

FlatFileParams.SchemaType schemaType

numRows

long numRows
Constructor Detail

FlatFileColumnSet

FlatFileColumnSet(String[] localName,
                  RelDataType rowType,
                  FlatFileParams params,
                  Properties tableProps,
                  long numRows,
                  FlatFileParams.SchemaType schemaType)
Method Detail

getParams

public FlatFileParams getParams()

getFilePath

public String getFilePath()

getLogFilePath

public String getLogFilePath()

getRowCount

public double getRowCount()
Description copied from interface: RelOptTable
Returns an estimate of the number of rows in the table.

Specified by:
getRowCount in interface RelOptTable
Overrides:
getRowCount in class RelOptAbstractTable

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

newFennelRel

private FennelRel newFennelRel(RelOptCluster cluster,
                               RelOptConnection connection,
                               FlatFileParams.SchemaType schemaType,
                               RelDataType rowType)
Constructs a new FlatFileFennelRel


newCalcRel

private CalcRel newCalcRel(RelOptCluster cluster,
                           FennelRel child,
                           RexProgram program)
Constructs a new CalcRel


makeFilePath

private String makeFilePath(String[] localName,
                            String filename)
Constructs the full path to the file for a table, based upon the server directory, filename option (if specified), and the server data file extension. If the filename is not specified, the local table name is used instead.

Parameters:
localName - name of the table within the catalog
filename - name of the file, specified in parameters
Returns:
full path to the data file for the table

makeLogFilePath

private String makeLogFilePath(String logFilename)
Constructs the full path to the log file for a table. The path is constructed from the server's log directory option, and the table's log filename option. If the log directory is not specified, then the current directory is used. If the log filename is not specified, then the log filename will be based upon the table's filename.

Log files names are appended with a timestamp and have a .ERR extension rather than the data file extension.