col
Selects column based on the column name and returns it as a TypedColumn.
For example:
dataset.col<_, Int>("a")
Content copied to clipboard
Helper function to quickly get a TypedColumn (or Column) from a dataset in a refactor-safe manner.
val dataset: Dataset<YourClass> = ...
val columnA: TypedColumn<YourClass, TypeOfA> = dataset.col(YourClass::a)
Content copied to clipboard
See also
Returns a TypedColumn based on the given column name and type DsType.
This is just a shortcut to the function from org.apache.spark.sql.functions combined with an as call. For all the functions, simply add import org.apache.spark.sql.functions.*
to your file.
See also
Returns a Column based on the given column name.
Returns a Column based on the given class attribute, not connected to a dataset.
val dataset: Dataset<YourClass> = ...
val new: Dataset<Tuple2<TypeOfA, TypeOfB>> = dataset.select( col(YourClass::a), col(YourClass::b) )
Content copied to clipboard