|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.fennel.FennelUtil
public abstract class FennelUtil
Static utility methods related to Fennel storage. Historically, these methods were refactored from FennelRelUtil to remove their dependency on the Farrago query package.
Constructor Summary | |
---|---|
FennelUtil()
|
Method Summary | |
---|---|
static FennelTupleDescriptor |
convertRowTypeToFennelTupleDesc(RelDataType rowType)
Creates a FennelTupleDescriptor for a RelDataType which is a row. |
static FennelStandardTypeDescriptor |
convertSqlTypeToFennelType(RelDataType sqlType)
Converts a SQL type to a Fennel type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FennelUtil()
Method Detail |
---|
public static FennelTupleDescriptor convertRowTypeToFennelTupleDesc(RelDataType rowType)
rowType
- row type descriptor
public static FennelStandardTypeDescriptor convertSqlTypeToFennelType(RelDataType sqlType)
The mapping is as follows:
SQL type | Fennel type | Comments |
---|---|---|
SqlTypeName.BOOLEAN |
BOOL |
|
SqlTypeName.TINYINT |
INT_8 |
|
SqlTypeName.SMALLINT |
INT_16 |
|
SqlTypeName.INTEGER |
INT_32 |
|
SqlTypeName.DECIMAL (precision, scale) |
INT_64 |
We use a scaled integer representation. For example, the |
SqlTypeName.DATE |
INT_64 |
Milliseconds since the epoch. |
SqlTypeName.TIME |
INT_64 |
Milliseconds since midnight. |
SqlTypeName.TIMESTAMP |
INT_64 |
Milliseconds since the epoch. |
Timestamp with timezone | Not implemented. We will probably use a user-defined type consisting of a TIMESTAMP and a VARCHAR. | |
SqlTypeName.INTERVAL_DAY_TIME |
INT_64 |
Not implemented.
All types of day-time interval are represented in the same way: an
integer milliseconds value. For example, TBD: How to represent fractions of seconds smaller than a millisecond,
for example, |
SqlTypeName.INTERVAL_YEAR_MONTH |
INT_64 |
Not implemented.
All types of year-month interval are represented in the same way: an
integer value which holds the number of months. For example, |
SqlTypeName.BIGINT |
INT_64 |
|
SqlTypeName.VARCHAR (precision) |
VARCHAR or UNICODE_VARCHAR depending on
character set |
|
SqlTypeName.VARBINARY (precision) |
VARBINARY |
|
SqlTypeName.MULTISET |
VARBINARY |
The fields are serialized into the VARBINARY field in the standard
Fennel serialization format. There is no 'count' field. To deduce the
number of records, deserialize values until you reach the length of the
field. Of course, this requires that every value takes at least one byte.
The length of a multiset value is limited by the capacity of the
|
SqlTypeName.ROW |
The fields are 'flattened' so that they become top-level fields of
the relation.
If the row is nullable, then all fields will be nullable after flattening. An extra 'null indicator' field is added to discriminate between a NULL row and a not-NULL row which happens to have all fields NULL. |
|
SqlTypeName.CHAR (precision) |
CHAR or CHAR depending on character set |
|
SqlTypeName.BINARY (precision) |
BINARY |
|
SqlTypeName.REAL |
REAL |
|
SqlTypeName.FLOAT |
DOUBLE |
|
SqlTypeName.DOUBLE |
DOUBLE |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |