Class AvroSchemaUtil

java.lang.Object
org.apache.drill.exec.store.avro.AvroSchemaUtil

public class AvroSchemaUtil extends Object
Utility class that provides methods to interact with Avro schema.
  • Field Details

  • Constructor Details

    • AvroSchemaUtil

      public AvroSchemaUtil()
  • Method Details

    • convert

      public static TupleMetadata convert(org.apache.avro.Schema schema)
      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 schema
      columnName - column name
      Returns:
      non-nullable Avro schema
      Throws:
      UserException - if given schema is not a union or represents complex union