Class ColumnBuilder

java.lang.Object
org.apache.drill.exec.physical.resultSet.impl.ColumnBuilder

public class ColumnBuilder extends Object
Algorithms for building a column given a metadata description of the column and the parent context that will hold the column.

Does not support recursive column creation. For the most part, composite columns (maps, map arrays, unions and lists) must start empty. Build the composite first, then add its members using the writer for the column. This ensures a uniform API for adding columns whether done dynamically at read time or statically at create time.

The single exception is the case of a list with exactly one type: in this case the list metadata must contain that one type so the code knows how to build the nullable array writer for that column.

Merges the project list with the column to be built. If the column is not projected (not in the list), then creates a dummy writer. Issues an error if the column is projected, but the implied projection type is incompatible with the actual type. (Such as trying to project an INT as x[0].)

This class builds the internal structure of a vector. If building a "container" vector (map, list, repeated list or union), this class expects the container to be added empty, then the members to be added one by one. See BuildFromSchema for the class that builds up a compound structure.

  • Constructor Details

    • ColumnBuilder

      public ColumnBuilder()
  • Method Details

    • buildColumn

      public ColumnState buildColumn(ContainerState parent, ColumnMetadata columnSchema)
      Implementation of the work to add a new column to this tuple given a schema description of the column.
      Parameters:
      parent - container of vectors
      columnSchema - schema of the column as provided by the client using the result set loader. This is the schema of the data to be loaded
      Returns:
      writer for the new column