public class SqlTypeFactoryImpl extends RelDataTypeFactoryImpl
RelDataTypeFactory which supports SQL types.| Modifier and Type | Class and Description |
|---|---|
private static class |
SqlTypeFactoryImpl.UnknownSqlType
The unknown type.
|
RelDataTypeFactoryImpl.JavaTypeRelDataTypeFactory.Builder, RelDataTypeFactory.FieldInfo, RelDataTypeFactory.FieldInfoBuildertypeSystem| Constructor and Description |
|---|
SqlTypeFactoryImpl(RelDataTypeSystem typeSystem) |
| Modifier and Type | Method and Description |
|---|---|
private void |
assertBasic(SqlTypeName typeName) |
protected RelDataType |
canonize(RelDataType type)
Registers a type, or returns the existing type if it is already
registered.
|
private RelDataType |
copyArrayType(RelDataType type,
boolean nullable) |
private RelDataType |
copyIntervalType(RelDataType type,
boolean nullable) |
private RelDataType |
copyMapType(RelDataType type,
boolean nullable) |
private RelDataType |
copyMultisetType(RelDataType type,
boolean nullable) |
private RelDataType |
copyObjectType(RelDataType type,
boolean nullable) |
RelDataType |
createArrayType(RelDataType elementType,
long maxCardinality)
Creates an array type.
|
private RelDataType |
createDoublePrecisionType() |
RelDataType |
createMapType(RelDataType keyType,
RelDataType valueType)
Creates a map type.
|
RelDataType |
createMultisetType(RelDataType type,
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 |
createTypeWithCharsetAndCollation(RelDataType type,
Charset charset,
SqlCollation collation)
Creates a type that is the same as another type but with possibly
different charset or collation.
|
RelDataType |
createTypeWithNullability(RelDataType type,
boolean nullable)
Creates a type that is the same as another type but with possibly
different nullability.
|
RelDataType |
createUnknownType()
Creates a SQL type that represents the "unknown" type.
|
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.
|
private RelDataType |
leastRestrictiveByCast(List<RelDataType> types) |
private RelDataType |
leastRestrictiveSqlType(List<RelDataType> types) |
protected boolean |
shouldRaggedFixedLengthValueUnionBeVariable()
Controls behavior discussed here.
|
builder, canonize, copyType, createDecimalProduct, createDecimalQuotient, createJavaType, createJoinType, createStructType, createStructType, createStructType, createStructType, getDefaultCharset, getTypeSystem, isJavaType, leastRestrictiveStructuredType, useDoubleMultiplicationpublic SqlTypeFactoryImpl(RelDataTypeSystem typeSystem)
public RelDataType createSqlType(SqlTypeName typeName)
RelDataTypeFactorytypeName - Name of the type, for example SqlTypeName.BOOLEAN,
never nullpublic RelDataType createSqlType(SqlTypeName typeName, int precision)
RelDataTypeFactorytypeName - Name of the type, for example SqlTypeName.VARCHAR.
Never null.precision - Maximum length of the value (non-numeric types) or the
precision of the value (numeric/datetime types).
Must be non-negative or
RelDataType.PRECISION_NOT_SPECIFIED.public RelDataType createSqlType(SqlTypeName typeName, int precision, int scale)
RelDataTypeFactorytypeName - Name of the type, for example SqlTypeName.DECIMAL.
Never null.precision - Precision of the value.
Must be non-negative or
RelDataType.PRECISION_NOT_SPECIFIED.scale - 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.public RelDataType createUnknownType()
RelDataTypeFactorypublic RelDataType createMultisetType(RelDataType type, long maxCardinality)
RelDataTypeFactorytype - type of the elements of the multisetmaxCardinality - maximum collection size, or -1 for unlimitedpublic RelDataType createArrayType(RelDataType elementType, long maxCardinality)
RelDataTypeFactoryelementType - type of the elements of the arraymaxCardinality - maximum array size, or -1 for unlimitedpublic RelDataType createMapType(RelDataType keyType, RelDataType valueType)
RelDataTypeFactorykeyType - type of the keys of the mapvalueType - type of the values of the mappublic RelDataType createSqlIntervalType(SqlIntervalQualifier intervalQualifier)
RelDataTypeFactoryintervalQualifier - contains information if it is a year-month or a
day-time interval along with precision informationpublic RelDataType createTypeWithCharsetAndCollation(RelDataType type, Charset charset, SqlCollation collation)
RelDataTypeFactorytype - input typecharset - charset to assigncollation - collation to assignpublic RelDataType leastRestrictive(List<RelDataType> types)
RelDataTypeFactoryleastRestrictive(INT, NUMERIC(3, 2)) could be
NUMERIC(12, 2).leastRestrictive in interface RelDataTypeFactoryleastRestrictive in class RelDataTypeFactoryImpltypes - input types to be combined using union (not null, not empty)private RelDataType leastRestrictiveByCast(List<RelDataType> types)
public RelDataType createTypeWithNullability(RelDataType type, boolean nullable)
RelDataTypeFactorycreateTypeWithNullability in interface RelDataTypeFactorycreateTypeWithNullability in class RelDataTypeFactoryImpltype - input typenullable - true to request a nullable type; false to request a NOT
NULL typeprivate void assertBasic(SqlTypeName typeName)
private RelDataType leastRestrictiveSqlType(List<RelDataType> types)
protected boolean shouldRaggedFixedLengthValueUnionBeVariable()
SQL:2003 Part 2 Section 9.3 Syntax Rule 3.a.iii.3private RelDataType createDoublePrecisionType()
private RelDataType copyMultisetType(RelDataType type, boolean nullable)
private RelDataType copyIntervalType(RelDataType type, boolean nullable)
private RelDataType copyObjectType(RelDataType type, boolean nullable)
private RelDataType copyArrayType(RelDataType type, boolean nullable)
private RelDataType copyMapType(RelDataType type, boolean nullable)
protected RelDataType canonize(RelDataType type)
RelDataTypeFactoryImplcanonize in class RelDataTypeFactoryImplCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.