|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.namespace.flatfile.FlatFileProgramWriter
public class FlatFileProgramWriter
FlatFileProgramWriter builds calculator programs for converting text from flat files into typed data. It assumes the text has already been processed for quoting and escape characters. The programs mainly consist of simple casts. However, custom date formats may be specified when using LucidDb. They are implemented with calls to LucidDb user defined routines. Only one set of formats can be active for a writer.
When using custom date conversions, the program can be split into Fennel and Java-only sections. If splitting the program, data must flow through the Fennel section first, which handles basic casts. Then the Java-only section handles custom date conversions.
Nested Class Summary | |
---|---|
private static class |
FlatFileProgramWriter.Section
Identifies a section of a flat file program |
Field Summary | |
---|---|
private String |
dateFormat
|
private static int |
DATETIME_FORMAT_ARG_LENGTH
|
private RelDataType[] |
datetimeArgs
|
static int |
FLAT_FILE_MAX_NON_CHAR_VALUE_LEN
|
private RexBuilder |
rexBuilder
|
private RelDataType |
rowType
|
private FarragoPreparingStmt |
stmt
|
private String |
timeFormat
|
private String |
timestampFormat
|
private static SqlIdentifier |
toDateFuncName
|
private static SqlIdentifier |
toTimeFuncName
|
private static SqlIdentifier |
toTimestampFuncName
|
private RelDataTypeFactory |
typeFactory
|
Constructor Summary | |
---|---|
FlatFileProgramWriter(RexBuilder rexBuilder,
FarragoPreparingStmt stmt,
FlatFileParams params,
RelDataType rowType)
Constructs a new FlatFileProgramWriter |
Method Summary | |
---|---|
RexProgram |
getFennelSection()
Gets the Fennel portion of the data conversion program |
private String |
getFormat(RelDataType type)
Returns the custom format for a data type |
RexProgram |
getJavaOnlySection()
Gets the Java only portion of the data conversion program |
RexProgram |
getProgram()
Gets the entire data conversion program |
private RexProgram |
getSection(FlatFileProgramWriter.Section section)
Builds a section of the data conversion program as follows. |
private RelDataType |
getTextType(RelDataType sqlType)
Converts a SQL type into a type that can be used by a Fennel FlatFileExecStream to read files. |
private SqlFunction |
getUdr(RelDataType type,
RelDataType charType)
Gets a function that converts a string to another type, according to a format string. |
private boolean |
isCustom(RelDataType type)
Whether a data type has a custom format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FLAT_FILE_MAX_NON_CHAR_VALUE_LEN
private static final SqlIdentifier toDateFuncName
private static final SqlIdentifier toTimeFuncName
private static final SqlIdentifier toTimestampFuncName
private static final int DATETIME_FORMAT_ARG_LENGTH
private final RexBuilder rexBuilder
private final RelDataTypeFactory typeFactory
private final FarragoPreparingStmt stmt
private final String dateFormat
private final String timeFormat
private final String timestampFormat
private final RelDataType[] datetimeArgs
private final RelDataType rowType
Constructor Detail |
---|
public FlatFileProgramWriter(RexBuilder rexBuilder, FarragoPreparingStmt stmt, FlatFileParams params, RelDataType rowType)
rexBuilder
- a rex node builderstmt
- the statement being preparedparams
- a set of flat file server parameters. These parameters may
include custom date formatsrowType
- the desired data type for data read from a flat file. The
row type is also used to infer the size of text fields in the file.Method Detail |
---|
public RexProgram getProgram()
public RexProgram getFennelSection()
public RexProgram getJavaOnlySection()
private RexProgram getSection(FlatFileProgramWriter.Section section)
section
- section of the program to build
private RelDataType getTextType(RelDataType sqlType)
private boolean isCustom(RelDataType type)
private String getFormat(RelDataType type)
private SqlFunction getUdr(RelDataType type, RelDataType charType)
type
- the target typecharType
- the type of the string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |