Class SingleSchemaInference

java.lang.Object
org.apache.drill.exec.physical.resultSet.model.single.SingleSchemaInference

public class SingleSchemaInference extends Object
Produce a metadata schema from a vector container. Used when given a record batch without metadata.

At runtime, a vector container is a holder for a batch of rows. Here we are concerned with metadata where we see a vector container as implementing a tree of column schemas, expressed as the MaterializedField associated with a vector. The tree structure comes from the structured vectors such as maps, unions, lists and so on.

This class is, essentially, a tree converter: it converts a tree of vectors to a tree of metadata.

The schema is inferred recursively by walking the vector tree that defines a batches's structure. For a classic relational tuple, the tree has just a vector container and a set of primitive vectors. But, once we add array (repeated), variant (LIST, UNION) and tuple (MAP) columns, the tree grows quite complex.

  • Constructor Details

    • SingleSchemaInference

      public SingleSchemaInference()
  • Method Details