Class SchemaUtil

java.lang.Object
org.apache.drill.exec.record.SchemaUtil

public class SchemaUtil extends Object
Utility class for dealing with changing schemas
  • Constructor Details

    • SchemaUtil

      public SchemaUtil()
  • Method Details

    • mergeSchemas

      public static BatchSchema mergeSchemas(BatchSchema... schemas)
      Returns the merger of schemas. The merged schema will include the union all columns. If there is a type conflict between columns with the same schemapath but different types, the merged schema will contain a Union type.
      Parameters:
      schemas -
      Returns:
    • coerceContainer

      public static VectorContainer coerceContainer(VectorAccessible in, BatchSchema toSchema, OperatorContext context)
      Creates a copy a record batch, converting any fields as necessary to coerce it into the provided schema
      Parameters:
      in -
      toSchema -
      context -
      Returns:
    • coerceContainer

      public static VectorContainer coerceContainer(VectorAccessible in, BatchSchema toSchema, BufferAllocator allocator)
    • fromBatchSchema

      public static TupleMetadata fromBatchSchema(BatchSchema batchSchema)
    • getSchemaPaths

      public static List<SchemaPath> getSchemaPaths(TupleMetadata schema)
      Returns list of SchemaPath for fields taken from specified schema.
      Parameters:
      schema - the source of fields to return
      Returns:
      list of SchemaPath