Package org.apache.calcite.rel.type
Class RelDataTypeSystemImpl
java.lang.Object
org.apache.calcite.rel.type.RelDataTypeSystemImpl
- All Implemented Interfaces:
RelDataTypeSystem
Default implementation of
RelDataTypeSystem
,
providing parameters from the SQL standard.
To implement other type systems, create a derived class and override values as needed.
Parameter | Value |
---|---|
MAX_NUMERIC_SCALE | 19 |
MIN_NUMERIC_SCALE | 0 |
MAX_NUMERIC_PRECISION | 19 |
-
Field Summary
Fields inherited from interface org.apache.calcite.rel.type.RelDataTypeSystem
DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionderiveAvgAggType
(RelDataTypeFactory typeFactory, RelDataType argumentType) Returns the return type of a call to theAVG
,STDDEV
orVAR
aggregate functions, inferred from its argument type.deriveCovarType
(RelDataTypeFactory typeFactory, RelDataType arg0Type, RelDataType arg1Type) Returns the return type of a call to theCOVAR
aggregate function, inferred from its argument types.deriveFractionalRankType
(RelDataTypeFactory typeFactory) Returns the return type of theCUME_DIST
andPERCENT_RANK
aggregate functions.deriveRankType
(RelDataTypeFactory typeFactory) Returns the return type of theNTILE
,RANK
,DENSE_RANK
, andROW_NUMBER
aggregate functions.deriveSumType
(RelDataTypeFactory typeFactory, RelDataType argumentType) Returns the return type of a call to theSUM
aggregate function, inferred from its argument type.int
getDefaultPrecision
(SqlTypeName typeName) Returns default precision for this type if supported, otherwiseRelDataType.PRECISION_NOT_SPECIFIED
if precision is either unsupported or must be specified explicitly.int
getDefaultScale
(SqlTypeName typeName) Returns the default scale for this type if supported, otherwiseRelDataType.SCALE_NOT_SPECIFIED
if scale is either unsupported or must be specified explicitly.@Nullable String
getLiteral
(SqlTypeName typeName, boolean isPrefix) Returns the LITERAL string for the type, either PREFIX/SUFFIX.int
Returns the maximum precision of a NUMERIC or DECIMAL type.int
Returns the maximum scale of a NUMERIC or DECIMAL type.int
getMaxPrecision
(SqlTypeName typeName) Returns the maximum precision (or length) allowed for this type, orRelDataType.PRECISION_NOT_SPECIFIED
if precision/length are not applicable for this type.int
getMaxScale
(SqlTypeName typeName) Returns the maximum scale allowed for this type, orRelDataType.SCALE_NOT_SPECIFIED
if scale is not applicable for this type.int
getMinPrecision
(SqlTypeName typeName) Returns the minimum precision (or length) allowed for this type, orRelDataType.PRECISION_NOT_SPECIFIED
if precision/length are not applicable for this type.int
getMinScale
(SqlTypeName typeName) Returns the minimum scale (or fractional second precision in the case of intervals) allowed for this type, orRelDataType.SCALE_NOT_SPECIFIED
if precision/length are not applicable for this type.int
getNumTypeRadix
(SqlTypeName typeName) Returns the numeric type radix, typically 2 or 10.boolean
isAutoincrement
(SqlTypeName typeName) Returns whether the type can be auto increment.boolean
isCaseSensitive
(SqlTypeName typeName) Returns whether the type is case sensitive.boolean
Whether two record types are considered distinct if their field names are the same but in different cases.Returns the rounding behavior for numerical operations capable of discarding precision.boolean
Whether the least restrictive type of a number of CHAR types of different lengths should be a VARCHAR type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.type.RelDataTypeSystem
deriveDecimalDivideType, deriveDecimalModType, deriveDecimalMultiplyType, deriveDecimalPlusType, deriveTimeFrameSet, shouldUseDoubleMultiplication
-
Constructor Details
-
RelDataTypeSystemImpl
public RelDataTypeSystemImpl()
-
-
Method Details
-
getMaxScale
Description copied from interface:RelDataTypeSystem
Returns the maximum scale allowed for this type, orRelDataType.SCALE_NOT_SPECIFIED
if scale is not applicable for this type.- Specified by:
getMaxScale
in interfaceRelDataTypeSystem
- Returns:
- Maximum allowed scale
-
getMinScale
Returns the minimum scale (or fractional second precision in the case of intervals) allowed for this type, orRelDataType.SCALE_NOT_SPECIFIED
if precision/length are not applicable for this type.- Specified by:
getMinScale
in interfaceRelDataTypeSystem
- Returns:
- Minimum allowed scale
-
getDefaultPrecision
Description copied from interface:RelDataTypeSystem
Returns default precision for this type if supported, otherwiseRelDataType.PRECISION_NOT_SPECIFIED
if precision is either unsupported or must be specified explicitly.- Specified by:
getDefaultPrecision
in interfaceRelDataTypeSystem
- Returns:
- Default precision
-
getDefaultScale
Returns the default scale for this type if supported, otherwiseRelDataType.SCALE_NOT_SPECIFIED
if scale is either unsupported or must be specified explicitly.- Specified by:
getDefaultScale
in interfaceRelDataTypeSystem
- Returns:
- Default scale
-
getMaxPrecision
Description copied from interface:RelDataTypeSystem
Returns the maximum precision (or length) allowed for this type, orRelDataType.PRECISION_NOT_SPECIFIED
if precision/length are not applicable for this type.- Specified by:
getMaxPrecision
in interfaceRelDataTypeSystem
- Returns:
- Maximum allowed precision
-
getMinPrecision
Returns the minimum precision (or length) allowed for this type, orRelDataType.PRECISION_NOT_SPECIFIED
if precision/length are not applicable for this type.- Specified by:
getMinPrecision
in interfaceRelDataTypeSystem
- Returns:
- Minimum allowed precision
-
getMaxNumericScale
public int getMaxNumericScale()Description copied from interface:RelDataTypeSystem
Returns the maximum scale of a NUMERIC or DECIMAL type. Default value is 19.- Specified by:
getMaxNumericScale
in interfaceRelDataTypeSystem
-
getMaxNumericPrecision
public int getMaxNumericPrecision()Description copied from interface:RelDataTypeSystem
Returns the maximum precision of a NUMERIC or DECIMAL type. Default value is 19.- Specified by:
getMaxNumericPrecision
in interfaceRelDataTypeSystem
-
roundingMode
Description copied from interface:RelDataTypeSystem
Returns the rounding behavior for numerical operations capable of discarding precision.- Specified by:
roundingMode
in interfaceRelDataTypeSystem
-
getLiteral
Description copied from interface:RelDataTypeSystem
Returns the LITERAL string for the type, either PREFIX/SUFFIX.- Specified by:
getLiteral
in interfaceRelDataTypeSystem
-
isCaseSensitive
Description copied from interface:RelDataTypeSystem
Returns whether the type is case sensitive.- Specified by:
isCaseSensitive
in interfaceRelDataTypeSystem
-
isAutoincrement
Description copied from interface:RelDataTypeSystem
Returns whether the type can be auto increment.- Specified by:
isAutoincrement
in interfaceRelDataTypeSystem
-
getNumTypeRadix
Description copied from interface:RelDataTypeSystem
Returns the numeric type radix, typically 2 or 10. 0 means "not applicable".- Specified by:
getNumTypeRadix
in interfaceRelDataTypeSystem
-
deriveSumType
Description copied from interface:RelDataTypeSystem
Returns the return type of a call to theSUM
aggregate function, inferred from its argument type.- Specified by:
deriveSumType
in interfaceRelDataTypeSystem
-
deriveAvgAggType
Description copied from interface:RelDataTypeSystem
Returns the return type of a call to theAVG
,STDDEV
orVAR
aggregate functions, inferred from its argument type.- Specified by:
deriveAvgAggType
in interfaceRelDataTypeSystem
-
deriveCovarType
public RelDataType deriveCovarType(RelDataTypeFactory typeFactory, RelDataType arg0Type, RelDataType arg1Type) Description copied from interface:RelDataTypeSystem
Returns the return type of a call to theCOVAR
aggregate function, inferred from its argument types.- Specified by:
deriveCovarType
in interfaceRelDataTypeSystem
-
deriveFractionalRankType
Description copied from interface:RelDataTypeSystem
Returns the return type of theCUME_DIST
andPERCENT_RANK
aggregate functions.- Specified by:
deriveFractionalRankType
in interfaceRelDataTypeSystem
-
deriveRankType
Description copied from interface:RelDataTypeSystem
Returns the return type of theNTILE
,RANK
,DENSE_RANK
, andROW_NUMBER
aggregate functions.- Specified by:
deriveRankType
in interfaceRelDataTypeSystem
-
isSchemaCaseSensitive
public boolean isSchemaCaseSensitive()Description copied from interface:RelDataTypeSystem
Whether two record types are considered distinct if their field names are the same but in different cases.- Specified by:
isSchemaCaseSensitive
in interfaceRelDataTypeSystem
-
shouldConvertRaggedUnionTypesToVarying
public boolean shouldConvertRaggedUnionTypesToVarying()Description copied from interface:RelDataTypeSystem
Whether the least restrictive type of a number of CHAR types of different lengths should be a VARCHAR type. And similarly BINARY to VARBINARY.- Specified by:
shouldConvertRaggedUnionTypesToVarying
in interfaceRelDataTypeSystem
-