July 2017
Intermediate to advanced
796 pages
18h 55m
English
Gets the first record in the RelationalGroupeddataset.
The first API has several implementations, as follows. The exact API used depends on the specific use case:
def first(columnName: String): ColumnAggregate function: returns the first value of a column in a group.def first(e: Column): ColumnAggregate function: returns the first value in a group.def first(columnName: String, ignoreNulls: Boolean): ColumnAggregate function: returns the first value of a column in a group.def first(e: Column, ignoreNulls: Boolean): ColumnAggregate function: returns the first value in a group.
Let's look at an example of invoking first on the DataFrame to output the first row:
import org.apache.spark.sql.functions._scala> statesPopulationDF.select(first("State")).show ...Read now
Unlock full access