|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RelDataTypeFactory
RelDataTypeFactory is a factory for datatype descriptors. It defines methods for instantiating and combining SQL, Java, and collection types. The factory also provides methods for return type inference for arithmetic in cases where SQL 2003 is implementation defined or impractical.
This interface is an example of the abstract factory pattern
.
Any implementation of RelDataTypeFactory
must ensure that type
objects are canonical: two types are equal if and only if they are
represented by the same Java object. This reduces memory consumption and
comparison cost.
Nested Class Summary | |
---|---|
static interface |
RelDataTypeFactory.FieldInfo
Callback which provides enough information to create fields. |
static class |
RelDataTypeFactory.ListFieldInfo
Simple implementation of RelDataTypeFactory.FieldInfo , based on a list of fields. |
Method Summary | |
---|---|
RelDataType |
copyType(RelDataType type)
Duplicates a type, making a deep copy. |
RelDataType |
createArrayType(RelDataType elementType,
long maxCardinality)
Creates an array type. |
RelDataType |
createDecimalProduct(RelDataType type1,
RelDataType type2)
Infers the return type of a decimal multiplication. |
RelDataType |
createDecimalQuotient(RelDataType type1,
RelDataType type2)
Infers the return type of a decimal division. |
RelDataType |
createJavaType(Class clazz)
Creates a type which corresponds to a Java class. |
RelDataType |
createJoinType(RelDataType[] types)
Creates a cartesian product type. |
RelDataType |
createMultisetType(RelDataType elementType,
long maxCardinality)
Creates a multiset type. |
RelDataType |
createSqlIntervalType(SqlIntervalQualifier intervalQualifier)
Creates a SQL interval type. |
RelDataType |
createSqlType(SqlTypeName typeName)
Creates a SQL type with no precision or scale. |
RelDataType |
createSqlType(SqlTypeName typeName,
int precision)
Creates a SQL type with length (precision) but no scale. |
RelDataType |
createSqlType(SqlTypeName typeName,
int precision,
int scale)
Creates a SQL type with precision and scale. |
RelDataType |
createStructType(List<RelDataType> typeList,
List<String> fieldNameList)
Creates a type which represents a structured collection of fields, given lists of the names and types of the fields. |
RelDataType |
createStructType(RelDataType[] types,
String[] fieldNames)
Creates a type which represents a structured collection of fields. |
RelDataType |
createStructType(RelDataTypeFactory.FieldInfo fieldInfo)
Creates a type which represents a structured collection of fields, obtaining the field information via a callback. |
RelDataType |
createTypeWithCharsetAndCollation(RelDataType type,
Charset charset,
SqlCollation collation)
Creates a Type which is the same as another type but with possibily different charset or collation. |
RelDataType |
createTypeWithNullability(RelDataType type,
boolean nullable)
Creates a type which is the same as another type but with possibly different nullability. |
Charset |
getDefaultCharset()
|
RelDataType |
leastRestrictive(RelDataType[] types)
Returns the most general of a set of types (that is, one type to which they can all be cast), or null if conversion is not possible. |
boolean |
useDoubleMultiplication(RelDataType type1,
RelDataType type2)
|
Method Detail |
---|
RelDataType createJavaType(Class clazz)
clazz
- the Java class used to define the type
RelDataType createJoinType(RelDataType[] types)
RelDataType createStructType(RelDataType[] types, String[] fieldNames)
types
- types of the fieldsfieldNames
- names of the fields
RelDataType createStructType(List<RelDataType> typeList, List<String> fieldNameList)
typeList
- types of the fieldsfieldNameList
- names of the fields
RelDataType createStructType(RelDataTypeFactory.FieldInfo fieldInfo)
fieldInfo
- callback for field information
RelDataType createArrayType(RelDataType elementType, long maxCardinality)
elementType
- type of the elements of the arraymaxCardinality
- maximum array size, or -1 for unlimited
RelDataType createMultisetType(RelDataType elementType, long maxCardinality)
elementType
- type of the elements of the multisetmaxCardinality
- maximum collection size, or -1 for unlimited
RelDataType copyType(RelDataType type)
type
- input type
RelDataType createTypeWithNullability(RelDataType type, boolean nullable)
type
- input typenullable
- true to request a nullable type; false to request a NOT
NULL type
RelDataType createTypeWithCharsetAndCollation(RelDataType type, Charset charset, SqlCollation collation)
type
- input typecharset
- charset to assigncollation
- collation to assign
Charset getDefaultCharset()
Charset
for string typesRelDataType leastRestrictive(RelDataType[] types)
types
- input types to be unioned
RelDataType createSqlType(SqlTypeName typeName)
typeName
- Name of the type, for example SqlTypeName.BOOLEAN
.
RelDataType createSqlType(SqlTypeName typeName, int precision)
typeName
- Name of the type, for example SqlTypeName.VARCHAR
.precision
- maximum length of the value (non-numeric types) or the
precision of the value (numeric/datetime types) requires both operands to
have exact numeric types.
RelDataType createSqlType(SqlTypeName typeName, int precision, int scale)
typeName
- Name of the type, for example SqlTypeName.DECIMAL
.precision
- precision of the valuescale
- scale of the values, i.e. the number of decimal places to
shift the value. For example, a NUMBER(10,3) value of "123.45" is
represented "123450" (that is, multiplied by 10^3). A negative scale
is valid.
RelDataType createSqlIntervalType(SqlIntervalQualifier intervalQualifier)
intervalQualifier
- contains information if it is a year-month or a
day-time interval along with precision information
RelDataType createDecimalProduct(RelDataType type1, RelDataType type2)
type1
- type of the first operandtype2
- type of the second operand
boolean useDoubleMultiplication(RelDataType type1, RelDataType type2)
RelDataType createDecimalQuotient(RelDataType type1, RelDataType type2)
type1
- type of the first operandtype2
- type of the second operand
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |