Class LogicalTypeParser


  • @PublicEvolving
    public final class LogicalTypeParser
    extends Object
    Parser for creating instances of LogicalType from a serialized string created with LogicalType.asSerializableString().

    In addition to the serializable string representations, this parser also supports common shortcuts for certain types. This includes:

    • STRING as a synonym for VARCHAR(INT_MAX)
    • BYTES as a synonym for VARBINARY(INT_MAX)
    • NUMERIC and DEC as synonyms for DECIMAL
    • INTEGER as a synonym for INT
    • DOUBLE PRECISION as a synonym for DOUBLE
    • TIME WITHOUT TIME ZONE as a synonym for TIME
    • TIMESTAMP WITHOUT TIME ZONE as a synonym for TIMESTAMP
    • TIMESTAMP WITH LOCAL TIME ZONE as a synonym for TIMESTAMP_LTZ
    • type ARRAY as a synonym for ARRAY<type>
    • type MULTISET as a synonym for MULTISET<type>
    • ROW(...) as a synonym for ROW<...>
    • type NULL as a synonym for type

    Furthermore, it returns UnresolvedUserDefinedType for unknown types (partially or fully qualified such as [catalog].[database].[type]).

    • Constructor Detail

      • LogicalTypeParser

        public LogicalTypeParser()
    • Method Detail

      • parse

        public static LogicalType parse​(String typeString,
                                        ClassLoader classLoader)
        Parses a type string. All types will be fully resolved except for UnresolvedUserDefinedTypes.
        Parameters:
        typeString - a string like "ROW(field1 INT, field2 BOOLEAN)"
        classLoader - class loader for loading classes of the RAW type
        Throws:
        ValidationException - in case of parsing errors.