public class LogicalType extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LOGICAL_TYPE_PROP |
Constructor and Description |
---|
LogicalType(String logicalTypeName) |
Modifier and Type | Method and Description |
---|---|
Schema |
addToSchema(Schema schema)
Add this logical type to the given Schema.
|
String |
getName()
Get the name of this logical type.
|
void |
validate(Schema schema)
Validate this logical type for the given Schema.
|
public static final String LOGICAL_TYPE_PROP
public LogicalType(String logicalTypeName)
public String getName()
This name is set as the Schema property "logicalType".
public Schema addToSchema(Schema schema)
The "logicalType" property will be set to this type's name, and other type-specific properties may be added. The Schema is first validated to ensure it is compatible.
schema
- a SchemaIllegalArgumentException
- if the type and schema are incompatiblepublic void validate(Schema schema)
This will throw an exception if the Schema is incompatible with this type. For example, a date is stored as an int and is incompatible with a fixed Schema.
schema
- a SchemaIllegalArgumentException
- if the type and schema are incompatibleCopyright © 2009–2022 The Apache Software Foundation. All rights reserved.