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 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
    • build

      Column build(Column.Type transformedType)
      Builds the categorical column by parsing each distinct source value through the supplied target type parser. 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. If the supplied target type is the same as the builder type, this behaves like build() and returns the categorical column directly.
      Specified by:
      build in interface ColumnObject.Builder<T>
      Parameters:
      transformedType - the target column type
      Returns:
      an immutable categorical column of the transformed type