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

public class RelRecordType extends RelDataTypeImpl implements Serializable
RelRecordType represents a structured type having named fields.
See Also:
  • Constructor Details

    • RelRecordType

      public RelRecordType(StructKind kind, List<RelDataTypeField> fields, boolean nullable)
      Creates a RecordType. This should only be called from a factory method.
      Parameters:
      kind - Name resolution policy
      fields - List of fields
      nullable - Whether this record type allows null values
    • RelRecordType

      public RelRecordType(StructKind kind, List<RelDataTypeField> fields)
      Creates a RecordType. This should only be called from a factory method. Shorthand for RelRecordType(kind, fields, false).
    • RelRecordType

      public RelRecordType(List<RelDataTypeField> fields)
      Creates a RecordType. This should only be called from a factory method. Shorthand for RelRecordType(StructKind.FULLY_QUALIFIED, fields, false).
  • Method Details

    • getSqlTypeName

      public SqlTypeName getSqlTypeName()
      Description copied from class: RelDataTypeImpl
      Gets the SqlTypeName of this type. Sub-classes must override the method to ensure the resulting value is non-nullable.
      Specified by:
      getSqlTypeName in interface RelDataType
      Overrides:
      getSqlTypeName in class RelDataTypeImpl
      Returns:
      SqlTypeName, never null
    • isNullable

      public boolean isNullable()
      Description copied from interface: RelDataType
      Queries whether this type allows null values.
      Specified by:
      isNullable in interface RelDataType
      Overrides:
      isNullable in class RelDataTypeImpl
      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 interface RelDataType
      Overrides:
      getPrecision in class RelDataTypeImpl
      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, or StructKind.NONE if this is not a structured type.
      Specified by:
      getStructKind in interface RelDataType
      Overrides:
      getStructKind in class RelDataTypeImpl
      Returns:
      the StructKind that determines how this type's fields are resolved
    • getFieldMap

      protected @Nullable Map<String,RelDataTypeField> getFieldMap()
      Description copied from class: RelDataTypeImpl
      Returns 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 field is indexed under its own name and "" (the empty string).

      If the map is null, the type must do lookup the long way.

      Overrides:
      getFieldMap in class RelDataTypeImpl
    • generateTypeString

      protected void generateTypeString(StringBuilder sb, boolean withDetail)
      Description copied from class: RelDataTypeImpl
      Generates a string representation of this type.
      Specified by:
      generateTypeString in class RelDataTypeImpl
      Parameters:
      sb - StringBuilder into which to generate the string
      withDetail - when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;