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
-
Method Summary
Modifier and TypeMethodDescriptionstatic VectorContainer
coerceContainer
(VectorAccessible in, BatchSchema toSchema, BufferAllocator allocator) 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 schemastatic TupleMetadata
fromBatchSchema
(BatchSchema batchSchema) static List<SchemaPath>
getSchemaPaths
(TupleMetadata schema) Returns list ofSchemaPath
for fields taken from specified schema.static BatchSchema
mergeSchemas
(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 ofSchemaPath
for fields taken from specified schema.- Parameters:
schema
- the source of fields to return- Returns:
- list of
SchemaPath
-