Class SqlTypeFactoryImpl

    • Constructor Detail

    • Method Detail

      • createSqlType

        public RelDataType createSqlType​(SqlTypeName typeName)
        Description copied from interface: RelDataTypeFactory
        Creates a SQL type with no precision or scale.
        Parameters:
        typeName - Name of the type, for example SqlTypeName.BOOLEAN, never null
        Returns:
        canonical type descriptor
      • createSqlType

        public RelDataType createSqlType​(SqlTypeName typeName,
                                         int precision)
        Description copied from interface: RelDataTypeFactory
        Creates a SQL type with length (precision) but no scale.
        Parameters:
        typeName - Name of the type, for example SqlTypeName.VARCHAR. Never null.
        precision - Maximum length of the value (non-numeric types) or the precision of the value (numeric/datetime types). Must be non-negative or RelDataType.PRECISION_NOT_SPECIFIED.
        Returns:
        canonical type descriptor
      • createSqlType

        public RelDataType createSqlType​(SqlTypeName typeName,
                                         int precision,
                                         int scale)
        Description copied from interface: RelDataTypeFactory
        Creates a SQL type with precision and scale.
        Parameters:
        typeName - Name of the type, for example SqlTypeName.DECIMAL. Never null.
        precision - Precision of the value. Must be non-negative or RelDataType.PRECISION_NOT_SPECIFIED.
        scale - scale of the values, i.e. the number of decimal places to shift the value. For example, a NUMBER(10,3) value of "123.45" is represented "123450" (that is, multiplied by 10^3). A negative scale is valid.
        Returns:
        canonical type descriptor
      • createUnknownType

        public RelDataType createUnknownType()
        Description copied from interface: RelDataTypeFactory
        Creates a SQL type that represents the "unknown" type. It is only equal to itself, and is distinct from the NULL type.
        Returns:
        unknown type
      • createMultisetType

        public RelDataType createMultisetType​(RelDataType type,
                                              long maxCardinality)
        Description copied from interface: RelDataTypeFactory
        Creates a multiset type. Multisets are unordered collections of elements.
        Parameters:
        type - type of the elements of the multiset
        maxCardinality - maximum collection size, or -1 for unlimited
        Returns:
        canonical multiset type descriptor
      • createArrayType

        public RelDataType createArrayType​(RelDataType elementType,
                                           long maxCardinality)
        Description copied from interface: RelDataTypeFactory
        Creates an array type. Arrays are ordered collections of elements.
        Parameters:
        elementType - type of the elements of the array
        maxCardinality - maximum array size, or -1 for unlimited
        Returns:
        canonical array type descriptor
      • createMapType

        public RelDataType createMapType​(RelDataType keyType,
                                         RelDataType valueType)
        Description copied from interface: RelDataTypeFactory
        Creates a map type. Maps are unordered collections of key/value pairs.
        Parameters:
        keyType - type of the keys of the map
        valueType - type of the values of the map
        Returns:
        canonical map type descriptor
      • createSqlIntervalType

        public RelDataType createSqlIntervalType​(SqlIntervalQualifier intervalQualifier)
        Description copied from interface: RelDataTypeFactory
        Creates a SQL interval type.
        Parameters:
        intervalQualifier - contains information if it is a year-month or a day-time interval along with precision information
        Returns:
        canonical type descriptor
      • createTypeWithCharsetAndCollation

        public RelDataType createTypeWithCharsetAndCollation​(RelDataType type,
                                                             java.nio.charset.Charset charset,
                                                             SqlCollation collation)
        Description copied from interface: RelDataTypeFactory
        Creates a type that is the same as another type but with possibly different charset or collation. For types without a concept of charset or collation this function must throw an error.
        Parameters:
        type - input type
        charset - charset to assign
        collation - collation to assign
        Returns:
        output type, same as input type except with specified charset and collation
      • leastRestrictive

        public RelDataType leastRestrictive​(java.util.List<RelDataType> types)
        Description copied from interface: RelDataTypeFactory
        Returns the most general of a set of types (that is, one type to which they can all be cast), or null if conversion is not possible. The result may be a new type that is less restrictive than any of the input types, e.g. leastRestrictive(INT, NUMERIC(3, 2)) could be NUMERIC(12, 2).
        Specified by:
        leastRestrictive in interface RelDataTypeFactory
        Overrides:
        leastRestrictive in class RelDataTypeFactoryImpl
        Parameters:
        types - input types to be combined using union (not null, not empty)
        Returns:
        canonical union type descriptor
      • createTypeWithNullability

        public RelDataType createTypeWithNullability​(RelDataType type,
                                                     boolean nullable)
        Description copied from interface: RelDataTypeFactory
        Creates a type that is the same as another type but with possibly different nullability. The output type may be identical to the input type. For type systems without a concept of nullability, the return value is always the same as the input.
        Specified by:
        createTypeWithNullability in interface RelDataTypeFactory
        Overrides:
        createTypeWithNullability in class RelDataTypeFactoryImpl
        Parameters:
        type - input type
        nullable - true to request a nullable type; false to request a NOT NULL type
        Returns:
        output type, same as input type except with specified nullability
      • assertBasic

        private void assertBasic​(SqlTypeName typeName)
      • leastRestrictiveSqlType

        private RelDataType leastRestrictiveSqlType​(java.util.List<RelDataType> types)
      • createDoublePrecisionType

        private RelDataType createDoublePrecisionType()