Interface ColumnCategorical.Builder<T>

Type Parameters:
T - the value type
All Superinterfaces:
Column.Builder, ColumnObject.Builder<T>
Enclosing interface:
ColumnCategorical<T>

public static interface ColumnCategorical.Builder<T> extends ColumnObject.Builder<T>
Builder for dictionary-encoded categorical columns.
  • Method Details

    • add

      Description copied from interface: ColumnObject.Builder
      Appends a value to the column.
      Specified by:
      add in interface ColumnObject.Builder<T>
      Parameters:
      x - the value to append, which may be null
      Returns:
      this builder
    • addNull

      Description copied from interface: ColumnObject.Builder
      Appends an unset row.
      Specified by:
      addNull in interface Column.Builder
      Specified by:
      addNull in interface ColumnObject.Builder<T>
      Returns:
      this builder
    • build

      Description copied from interface: Column.Builder
      Materialises the current builder contents as an immutable column.
      Specified by:
      build in interface Column.Builder
      Specified by:
      build in interface ColumnObject.Builder<T>
      Returns:
      the built column
    • buildAs

      Column buildAs(Column.Type transformedType)
      Builds a column by parsing each distinct source value as the supplied target type. This is the natural path for building a typed categorical column from a string-like categorical builder when the target parser may still need to construct a String. The categorical dictionary can be parsed once during materialisation, rather than first building an immutable ColumnCategorical<String> and then transforming that immutable column afterward. This is therefore preferred over build() followed by ColumnCategorical.transform(Transformer) when the target values come from parsing the source categorical strings, because the parse work can be done during the build and the intermediate immutable string categorical column can be avoided. The returned column follows transformedType, not necessarily this categorical builder's interface. For example, a string-backed categorical builder may produce a primitive column when the target type is primitive. If the supplied target type is the same as the builder type, this behaves like build() and returns the categorical column directly.
      Specified by:
      buildAs in interface ColumnObject.Builder<T>
      Parameters:
      transformedType - the target column type
      Returns:
      an immutable column whose logical type is transformedType