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:
Serializable,RelDataType,RelDataTypeFamily
- Direct Known Subclasses:
JavaRecordType
RelRecordType represents a structured type having named fields.
- See Also:
-
Field Summary
Fields inherited from class org.apache.calcite.rel.type.RelDataTypeImpl
digest, fieldList, NON_NULLABLE_SUFFIXFields inherited from interface org.apache.calcite.rel.type.RelDataType
PRECISION_NOT_SPECIFIED, SCALE_NOT_SPECIFIED -
Constructor Summary
ConstructorsConstructorDescriptionRelRecordType(List<RelDataTypeField> fields) Creates aRecordType.RelRecordType(StructKind kind, List<RelDataTypeField> fields) Creates aRecordType.RelRecordType(StructKind kind, List<RelDataTypeField> fields, boolean nullable) Creates aRecordType. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgenerateTypeString(StringBuilder sb, boolean withDetail) Generates a string representation of this type.protected @Nullable Map<String,RelDataTypeField> Returns a map from field names to fields.intGets the JDBC-defined precision for values of this type.Gets theSqlTypeNameof this type.Returns the rule for resolving the fields of a structured type, orStructKind.NONEif this is not a structured type.booleanQueries whether this type allows null values.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, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.calcite.rel.type.RelDataType
equalsSansFieldNames, equalsSansFieldNamesAndNullability, getMeasureElementType, isMeasure
-
Constructor Details
-
RelRecordType
Creates aRecordType. This should only be called from a factory method.- Parameters:
kind- Name resolution policyfields- List of fieldsnullable- Whether this record type allows null values
-
RelRecordType
Creates aRecordType. This should only be called from a factory method. Shorthand forRelRecordType(kind, fields, false). -
RelRecordType
Creates aRecordType. This should only be called from a factory method. Shorthand forRelRecordType(StructKind.FULLY_QUALIFIED, fields, false).
-
-
Method Details
-
getSqlTypeName
Description copied from class:RelDataTypeImplGets theSqlTypeNameof this type. Sub-classes must override the method to ensure the resulting value is non-nullable.- Specified by:
getSqlTypeNamein interfaceRelDataType- Overrides:
getSqlTypeNamein classRelDataTypeImpl- Returns:
- SqlTypeName, never null
-
isNullable
public boolean isNullable()Description copied from interface:RelDataTypeQueries whether this type allows null values.- Specified by:
isNullablein interfaceRelDataType- Overrides:
isNullablein classRelDataTypeImpl- Returns:
- whether type allows null values
-
getPrecision
public int getPrecision()Description copied from interface:RelDataTypeGets 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:
getPrecisionin interfaceRelDataType- Overrides:
getPrecisionin 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
Description copied from interface:RelDataTypeReturns the rule for resolving the fields of a structured type, orStructKind.NONEif this is not a structured type.- Specified by:
getStructKindin interfaceRelDataType- Overrides:
getStructKindin classRelDataTypeImpl- Returns:
- the StructKind that determines how this type's fields are resolved
-
getFieldMap
Description copied from class:RelDataTypeImplReturns a map from field names to fields.Matching is case-sensitive.
If several fields have the same name, the map contains the first.
A
dynamic star fieldis indexed under its own name and "" (the empty string).If the map is null, the type must do lookup the long way.
- Overrides:
getFieldMapin classRelDataTypeImpl
-
generateTypeString
Description copied from class:RelDataTypeImplGenerates a string representation of this type.- Specified by:
generateTypeStringin 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;
-