Package org.apache.drill.exec.store.avro
Class AvroSchemaUtil
java.lang.Object
org.apache.drill.exec.store.avro.AvroSchemaUtil
Utility class that provides methods to interact with Avro schema.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TupleMetadataconvert(org.apache.avro.Schema schema) Converts Avro schema into Drill metadata description of the schema.static org.apache.avro.SchemaextractSchemaFromNullable(org.apache.avro.Schema schema, String columnName) Avro represents nullable type as union of null and another schema: ["null", "some-type"].
-
Field Details
-
AVRO_LOGICAL_TYPE_PROPERTY
- See Also:
-
DECIMAL_LOGICAL_TYPE
- See Also:
-
TIMESTAMP_MICROS_LOGICAL_TYPE
- See Also:
-
TIMESTAMP_MILLIS_LOGICAL_TYPE
- See Also:
-
DATE_LOGICAL_TYPE
- See Also:
-
TIME_MICROS_LOGICAL_TYPE
- See Also:
-
TIME_MILLIS_LOGICAL_TYPE
- See Also:
-
DURATION_LOGICAL_TYPE
- See Also:
-
-
Constructor Details
-
AvroSchemaUtil
public AvroSchemaUtil()
-
-
Method Details
-
convert
Converts Avro schema into Drill metadata description of the schema.- Parameters:
schema- Avro schema- Returns:
- metadata description of the schema
- Throws:
UserException- if schema contains unsupported types
-
extractSchemaFromNullable
public static org.apache.avro.Schema extractSchemaFromNullable(org.apache.avro.Schema schema, String columnName) Avro represents nullable type as union of null and another schema: ["null", "some-type"]. This method extracts non-nullable schema for given union schema.- Parameters:
schema- Avro schemacolumnName- column name- Returns:
- non-nullable Avro schema
- Throws:
UserException- if given schema is not a union or represents complex union
-