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.JavaType
RelDataTypeFactory.Builder, RelDataTypeFactory.FieldInfo, RelDataTypeFactory.FieldInfoBuilder
typeSystem
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,
java.nio.charset.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(java.util.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(java.util.List<RelDataType> types) |
private RelDataType |
leastRestrictiveSqlType(java.util.List<RelDataType> types) |
builder, canonize, canonize, copyType, createDecimalProduct, createDecimalQuotient, createJavaType, createJoinType, createStructType, createStructType, createStructType, createStructType, getDefaultCharset, getTypeSystem, isJavaType, leastRestrictiveStructuredType, useDoubleMultiplication
public SqlTypeFactoryImpl(RelDataTypeSystem typeSystem)
public RelDataType createSqlType(SqlTypeName typeName)
RelDataTypeFactory
typeName
- Name of the type, for example SqlTypeName.BOOLEAN
,
never nullpublic RelDataType createSqlType(SqlTypeName typeName, int precision)
RelDataTypeFactory
typeName
- 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)
RelDataTypeFactory
typeName
- 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()
RelDataTypeFactory
public RelDataType createMultisetType(RelDataType type, long maxCardinality)
RelDataTypeFactory
type
- type of the elements of the multisetmaxCardinality
- maximum collection size, or -1 for unlimitedpublic RelDataType createArrayType(RelDataType elementType, long maxCardinality)
RelDataTypeFactory
elementType
- type of the elements of the arraymaxCardinality
- maximum array size, or -1 for unlimitedpublic RelDataType createMapType(RelDataType keyType, RelDataType valueType)
RelDataTypeFactory
keyType
- type of the keys of the mapvalueType
- type of the values of the mappublic RelDataType createSqlIntervalType(SqlIntervalQualifier intervalQualifier)
RelDataTypeFactory
intervalQualifier
- contains information if it is a year-month or a
day-time interval along with precision informationpublic RelDataType createTypeWithCharsetAndCollation(RelDataType type, java.nio.charset.Charset charset, SqlCollation collation)
RelDataTypeFactory
type
- input typecharset
- charset to assigncollation
- collation to assignpublic RelDataType leastRestrictive(java.util.List<RelDataType> types)
RelDataTypeFactory
leastRestrictive(INT, NUMERIC(3, 2))
could be
NUMERIC(12, 2)
.leastRestrictive
in interface RelDataTypeFactory
leastRestrictive
in class RelDataTypeFactoryImpl
types
- input types to be combined using union (not null, not empty)private RelDataType leastRestrictiveByCast(java.util.List<RelDataType> types)
public RelDataType createTypeWithNullability(RelDataType type, boolean nullable)
RelDataTypeFactory
createTypeWithNullability
in interface RelDataTypeFactory
createTypeWithNullability
in class RelDataTypeFactoryImpl
type
- input typenullable
- true to request a nullable type; false to request a NOT
NULL typeprivate void assertBasic(SqlTypeName typeName)
private RelDataType leastRestrictiveSqlType(java.util.List<RelDataType> types)
private 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)
RelDataTypeFactoryImpl
canonize
in class RelDataTypeFactoryImpl
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.