Package org.apache.drill.exec.record
Class SchemaUtil
java.lang.Object
org.apache.drill.exec.record.SchemaUtil
Utility class for dealing with changing schemas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VectorContainercoerceContainer(VectorAccessible in, BatchSchema toSchema, BufferAllocator allocator) static VectorContainercoerceContainer(VectorAccessible in, BatchSchema toSchema, OperatorContext context) Creates a copy a record batch, converting any fields as necessary to coerce it into the provided schemastatic TupleMetadatafromBatchSchema(BatchSchema batchSchema) static List<SchemaPath> getSchemaPaths(TupleMetadata schema) Returns list ofSchemaPathfor fields taken from specified schema.static BatchSchemamergeSchemas(BatchSchema... schemas) Returns the merger of schemas.
-
Constructor Details
-
SchemaUtil
public SchemaUtil()
-
-
Method Details
-
mergeSchemas
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
-
getSchemaPaths
Returns list ofSchemaPathfor fields taken from specified schema.- Parameters:
schema- the source of fields to return- Returns:
- list of
SchemaPath
-