Package app.babylon.table.column
Interface ColumnCategorical.Builder<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
Column.Builder,ColumnObject.Builder<T>
- Enclosing interface:
ColumnCategorical<T>
Builder for dictionary-encoded categorical columns.
-
Method Summary
Modifier and TypeMethodDescriptionAppends a value to the column.addNull()Appends an unset row.build()Materialises the current builder contents as an immutable column.buildAs(Column.Type transformedType) Builds a column by parsing each distinct source value as the supplied target type.Methods inherited from interface app.babylon.table.column.Column.Builder
add, add, add
-
Method Details
-
add
Description copied from interface:ColumnObject.BuilderAppends a value to the column.- Specified by:
addin interfaceColumnObject.Builder<T>- Parameters:
x- the value to append, which may benull- Returns:
- this builder
-
addNull
ColumnCategorical.Builder<T> addNull()Description copied from interface:ColumnObject.BuilderAppends an unset row.- Specified by:
addNullin interfaceColumn.Builder- Specified by:
addNullin interfaceColumnObject.Builder<T>- Returns:
- this builder
-
build
ColumnCategorical<T> build()Description copied from interface:Column.BuilderMaterialises the current builder contents as an immutable column.- Specified by:
buildin interfaceColumn.Builder- Specified by:
buildin interfaceColumnObject.Builder<T>- Returns:
- the built column
-
buildAs
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 aString. The categorical dictionary can be parsed once during materialisation, rather than first building an immutableColumnCategorical<String>and then transforming that immutable column afterward. This is therefore preferred overbuild()followed byColumnCategorical.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 followstransformedType, 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 likebuild()and returns the categorical column directly.- Specified by:
buildAsin interfaceColumnObject.Builder<T>- Parameters:
transformedType- the target column type- Returns:
- an immutable column whose logical type is
transformedType
-