@PublicEvolving public final class LogicalTypeParser extends Object
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 and Description |
---|
LogicalTypeParser() |
Modifier and Type | Method and Description |
---|---|
static LogicalType |
parse(String typeString)
Deprecated.
You should use
parse(String, ClassLoader) to correctly load user types |
static LogicalType |
parse(String typeString,
ClassLoader classLoader)
Parses a type string.
|
public static LogicalType parse(String typeString, ClassLoader classLoader)
UnresolvedUserDefinedType
s.typeString
- a string like "ROW(field1 INT, field2 BOOLEAN)"classLoader
- class loader for loading classes of the RAW typeValidationException
- in case of parsing errors.@Deprecated public static LogicalType parse(String typeString)
parse(String, ClassLoader)
to correctly load user typesUnresolvedUserDefinedType
s.typeString
- a string like "ROW(field1 INT, field2 BOOLEAN)"ValidationException
- in case of parsing errors.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.