public abstract class RelDataTypeFactoryImpl extends Object implements RelDataTypeFactory
RelDataTypeFactory.| Modifier and Type | Class and Description |
|---|---|
class |
RelDataTypeFactoryImpl.JavaType
Type which is based upon a Java class.
|
RelDataTypeFactory.FieldInfo, RelDataTypeFactory.FieldInfoBuilder| Modifier and Type | Field and Description |
|---|---|
protected RelDataTypeSystem |
typeSystem |
| Modifier | Constructor and Description |
|---|---|
protected |
RelDataTypeFactoryImpl(RelDataTypeSystem typeSystem)
Creates a type factory.
|
| Modifier and Type | Method and Description |
|---|---|
RelDataTypeFactory.FieldInfoBuilder |
builder()
Creates a
RelDataTypeFactory.FieldInfoBuilder. |
protected RelDataType |
canonize(List<String> names,
List<RelDataType> types)
Looks up a type using a temporary key, and if not present, creates
a permanent key and type.
|
protected RelDataType |
canonize(RelDataType type)
Registers a type, or returns the existing type if it is already
registered.
|
RelDataType |
copyType(RelDataType type)
Duplicates a type, making a deep copy.
|
RelDataType |
createDecimalProduct(RelDataType type1,
RelDataType type2)
implement RelDataTypeFactory with SQL 2003 compliant behavior.
|
RelDataType |
createDecimalQuotient(RelDataType type1,
RelDataType type2)
Rules:
Let p1, s1 be the precision and scale of the first operand
Let p2, s2 be the precision and scale of the second operand
Let p, s be the precision and scale of the result
Let d be the number of whole digits in the result
Then the result type is a decimal with:
d = p1 - s1 + s2
s < max(6, s1 + p2 + 1)
p = d + s
p and s are capped at their maximum values
|
RelDataType |
createJavaType(Class clazz)
Creates a type which corresponds to a Java class.
|
RelDataType |
createJoinType(RelDataType... types)
Creates a cartesian product type.
|
RelDataType |
createStructType(List<? extends Map.Entry<String,RelDataType>> fieldList)
Creates a type which represents a structured collection of fieldList,
obtaining the field information from a list of (name, type) pairs.
|
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(RelDataTypeFactory.FieldInfo fieldInfo)
Creates a type which represents a structured collection of fields,
obtaining the field information via a callback.
|
RelDataType |
createTypeWithNullability(RelDataType type,
boolean nullable)
Creates a type which is the same as another type but with possibly
different nullability.
|
Charset |
getDefaultCharset() |
RelDataTypeSystem |
getTypeSystem()
Returns the type system.
|
static boolean |
isJavaType(RelDataType t) |
RelDataType |
leastRestrictive(List<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.
|
protected RelDataType |
leastRestrictiveStructuredType(List<RelDataType> types) |
boolean |
useDoubleMultiplication(RelDataType type1,
RelDataType type2)
Returns whether a decimal multiplication should be implemented by casting
arguments to double values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateArrayType, createMapType, createMultisetType, createSqlIntervalType, createSqlType, createSqlType, createSqlType, createTypeWithCharsetAndCollationprotected final RelDataTypeSystem typeSystem
protected RelDataTypeFactoryImpl(RelDataTypeSystem typeSystem)
public RelDataTypeSystem getTypeSystem()
RelDataTypeFactorygetTypeSystem in interface RelDataTypeFactorypublic RelDataType createJavaType(Class clazz)
RelDataTypeFactorycreateJavaType in interface RelDataTypeFactoryclazz - the Java class used to define the typepublic RelDataType createJoinType(RelDataType... types)
RelDataTypeFactorycreateJoinType in interface RelDataTypeFactorytypes - array of types to be joinedpublic RelDataType createStructType(List<RelDataType> typeList, List<String> fieldNameList)
RelDataTypeFactorycreateStructType in interface RelDataTypeFactorytypeList - types of the fieldsfieldNameList - names of the fieldspublic RelDataType createStructType(RelDataTypeFactory.FieldInfo fieldInfo)
RelDataTypeFactorycreateStructType in interface RelDataTypeFactoryfieldInfo - callback for field informationpublic final RelDataType createStructType(List<? extends Map.Entry<String,RelDataType>> fieldList)
RelDataTypeFactorycreateStructType in interface RelDataTypeFactoryfieldList - List of (name, type) pairspublic RelDataType leastRestrictive(List<RelDataType> types)
RelDataTypeFactoryleastRestrictive(INT, NUMERIC(3, 2)) could be
NUMERIC(12, 2).leastRestrictive in interface RelDataTypeFactorytypes - input types to be combined using union (not null, not empty)protected RelDataType leastRestrictiveStructuredType(List<RelDataType> types)
public RelDataType copyType(RelDataType type)
RelDataTypeFactorycopyType in interface RelDataTypeFactorytype - input typepublic RelDataType createTypeWithNullability(RelDataType type, boolean nullable)
RelDataTypeFactorycreateTypeWithNullability in interface RelDataTypeFactorytype - input typenullable - true to request a nullable type; false to request a NOT
NULL typeprotected RelDataType canonize(RelDataType type)
NullPointerException - if type is nullprotected RelDataType canonize(List<String> names, List<RelDataType> types)
This approach allows us to use a cheap temporary key. A permanent key is more expensive, because it must be immutable and not hold references into other data structures.
public static boolean isJavaType(RelDataType t)
public RelDataType createDecimalProduct(RelDataType type1, RelDataType type2)
createDecimalProduct in interface RelDataTypeFactorytype1 - type of the first operandtype2 - type of the second operandpublic boolean useDoubleMultiplication(RelDataType type1, RelDataType type2)
RelDataTypeFactoryPre-condition: createDecimalProduct(type1, type2) != null
useDoubleMultiplication in interface RelDataTypeFactorypublic RelDataType createDecimalQuotient(RelDataType type1, RelDataType type2)
createDecimalQuotient in interface RelDataTypeFactorytype1 - type of the first operandtype2 - type of the second operandpublic Charset getDefaultCharset()
getDefaultCharset in interface RelDataTypeFactoryCharset for string typespublic RelDataTypeFactory.FieldInfoBuilder builder()
RelDataTypeFactoryRelDataTypeFactory.FieldInfoBuilder.builder in interface RelDataTypeFactoryCopyright © 2012–2015 The Apache Software Foundation. All rights reserved.