Package org.apache.calcite.sql.type
Class IntervalSqlType
java.lang.Object
org.apache.calcite.rel.type.RelDataTypeImpl
org.apache.calcite.sql.type.AbstractSqlType
org.apache.calcite.sql.type.IntervalSqlType
- All Implemented Interfaces:
Serializable
,Cloneable
,RelDataType
,RelDataTypeFamily
IntervalSqlType represents a standard SQL datetime interval type.
- See Also:
-
Field Summary
Fields inherited from class org.apache.calcite.sql.type.AbstractSqlType
isNullable, typeName
Fields inherited from class org.apache.calcite.rel.type.RelDataTypeImpl
digest, fieldList, NON_NULLABLE_SUFFIX
Fields inherited from interface org.apache.calcite.rel.type.RelDataType
PRECISION_NOT_SPECIFIED, SCALE_NOT_SPECIFIED
-
Constructor Summary
ConstructorDescriptionIntervalSqlType
(RelDataTypeSystem typeSystem, SqlIntervalQualifier intervalQualifier, boolean isNullable) Constructs an IntervalSqlType. -
Method Summary
Modifier and TypeMethodDescriptioncombine
(RelDataTypeFactoryImpl typeFactory, IntervalSqlType that) Combines two IntervalTypes and returns the result.protected void
generateTypeString
(StringBuilder sb, boolean withDetail) Generates a string representation of this type.Gets this type's interval qualifier, or null if this is not an interval type.int
Gets the JDBC-defined precision for values of this type.int
getScale()
Gets the scale of this type.Methods inherited from class org.apache.calcite.sql.type.AbstractSqlType
getFamily, getPrecedenceList, getSqlTypeName, isNullable
Methods inherited from class org.apache.calcite.rel.type.RelDataTypeImpl
computeDigest, equals, extra, getCharset, getCollation, getComparability, getComponentType, getField, getFieldCount, getFieldList, getFieldMap, getFieldNames, getFullTypeString, getKeyType, getSqlIdentifier, getStructKind, getValueType, hashCode, isDynamicStruct, isStruct, proto, proto, proto, proto, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.type.RelDataType
equalsSansFieldNames, equalsSansFieldNamesAndNullability, getMeasureElementType, isMeasure
-
Constructor Details
-
IntervalSqlType
public IntervalSqlType(RelDataTypeSystem typeSystem, SqlIntervalQualifier intervalQualifier, boolean isNullable) Constructs an IntervalSqlType. This should only be called from a factory method.
-
-
Method Details
-
generateTypeString
Description copied from class:RelDataTypeImpl
Generates a string representation of this type.- Specified by:
generateTypeString
in classRelDataTypeImpl
- Parameters:
sb
- StringBuilder into which to generate the stringwithDetail
- when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;
-
getIntervalQualifier
Description copied from interface:RelDataType
Gets this type's interval qualifier, or null if this is not an interval type.- Specified by:
getIntervalQualifier
in interfaceRelDataType
- Overrides:
getIntervalQualifier
in classRelDataTypeImpl
- Returns:
- interval qualifier
-
combine
Combines two IntervalTypes and returns the result. E.g. the result of combining
INTERVAL DAY TO HOUR
with
INTERVAL SECOND
is
INTERVAL DAY TO SECOND
-
getPrecision
public int getPrecision()Description copied from interface:RelDataType
Gets the JDBC-defined precision for values of this type. Note that this is not always the same as the user-specified precision. For example, the type INTEGER has no user-specified precision, but this method returns 10 for an INTEGER type.Returns
RelDataType.PRECISION_NOT_SPECIFIED
(-1) if precision is not applicable for this type.- Specified by:
getPrecision
in interfaceRelDataType
- Overrides:
getPrecision
in classRelDataTypeImpl
- Returns:
- number of decimal digits for exact numeric types; number of decimal digits in mantissa for approximate numeric types; number of decimal digits for fractional seconds of datetime types; length in characters for character types; length in bytes for binary types; length in bits for bit types; 1 for BOOLEAN; -1 if precision is not valid for this type
-
getScale
public int getScale()Description copied from interface:RelDataType
Gets the scale of this type. ReturnsRelDataType.SCALE_NOT_SPECIFIED
(-1) if scale is not valid for this type.- Specified by:
getScale
in interfaceRelDataType
- Overrides:
getScale
in classRelDataTypeImpl
- Returns:
- number of digits of scale
-