Package org.apache.calcite.rel.type
Class RelRecordType
- java.lang.Object
-
- org.apache.calcite.rel.type.RelDataTypeImpl
-
- org.apache.calcite.rel.type.RelRecordType
-
- All Implemented Interfaces:
java.io.Serializable
,RelDataType
,RelDataTypeFamily
- Direct Known Subclasses:
JavaRecordType
public class RelRecordType extends RelDataTypeImpl implements java.io.Serializable
RelRecordType represents a structured type having named fields.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RelRecordType.SerializableRelRecordType
Skinny object which has the same information content as aRelRecordType
but skips redundant stuff like digest and the immutable list.
-
Field Summary
Fields Modifier and Type Field Description private StructKind
kind
Name resolution policy; usuallyStructKind.FULLY_QUALIFIED
.-
Fields inherited from class org.apache.calcite.rel.type.RelDataTypeImpl
digest, fieldList
-
Fields inherited from interface org.apache.calcite.rel.type.RelDataType
PRECISION_NOT_SPECIFIED, SCALE_NOT_SPECIFIED
-
-
Constructor Summary
Constructors Constructor Description RelRecordType(java.util.List<RelDataTypeField> fields)
RelRecordType(StructKind kind, java.util.List<RelDataTypeField> fields)
Creates aRecordType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
generateTypeString(java.lang.StringBuilder sb, boolean withDetail)
Generates a string representation of this type.int
getPrecision()
Gets the JDBC-defined precision for values of this type.SqlTypeName
getSqlTypeName()
Gets theSqlTypeName
of this type.StructKind
getStructKind()
Returns the rule for resolving the fields of a structured type, orStructKind.NONE
if this is not a structured type.boolean
isNullable()
Queries whether this type allows null values.private java.lang.Object
writeReplace()
PerSerializable
API, provides a replacement object to be written during serialization.-
Methods inherited from class org.apache.calcite.rel.type.RelDataTypeImpl
computeDigest, equals, extra, getCharset, getCollation, getComparability, getComponentType, getFamily, getField, getFieldCount, getFieldList, getFieldNames, getFullTypeString, getIntervalQualifier, getKeyType, getPrecedenceList, getScale, getSqlIdentifier, getValueType, hashCode, isDynamicStruct, isStruct, proto, proto, proto, proto, toString
-
-
-
-
Field Detail
-
kind
private final StructKind kind
Name resolution policy; usuallyStructKind.FULLY_QUALIFIED
.
-
-
Constructor Detail
-
RelRecordType
public RelRecordType(StructKind kind, java.util.List<RelDataTypeField> fields)
Creates aRecordType
. This should only be called from a factory method.
-
RelRecordType
public RelRecordType(java.util.List<RelDataTypeField> fields)
-
-
Method Detail
-
getSqlTypeName
public SqlTypeName getSqlTypeName()
Description copied from interface:RelDataType
Gets theSqlTypeName
of this type.- Specified by:
getSqlTypeName
in interfaceRelDataType
- Overrides:
getSqlTypeName
in classRelDataTypeImpl
- Returns:
- SqlTypeName, or null if this is not an SQL predefined type
-
isNullable
public boolean isNullable()
Description copied from interface:RelDataType
Queries whether this type allows null values.- Specified by:
isNullable
in interfaceRelDataType
- Overrides:
isNullable
in classRelDataTypeImpl
- Returns:
- whether type allows null values
-
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
-
getStructKind
public StructKind getStructKind()
Description copied from interface:RelDataType
Returns the rule for resolving the fields of a structured type, orStructKind.NONE
if this is not a structured type.- Specified by:
getStructKind
in interfaceRelDataType
- Overrides:
getStructKind
in classRelDataTypeImpl
- Returns:
- the StructKind that determines how this type's fields are resolved
-
generateTypeString
protected void generateTypeString(java.lang.StringBuilder sb, boolean withDetail)
Description copied from class:RelDataTypeImpl
Generates a string representation of this type.- Specified by:
generateTypeString
in classRelDataTypeImpl
- Parameters:
sb
- StringBuffer into which to generate the stringwithDetail
- when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;
-
writeReplace
private java.lang.Object writeReplace()
PerSerializable
API, provides a replacement object to be written during serialization.This implementation converts this RelRecordType into a SerializableRelRecordType, whose
readResolve
method converts it back to a RelRecordType during deserialization.
-
-