July 2017
Intermediate to advanced
796 pages
18h 55m
English
The maximum of the column value of one of the columns in the DataFrame. An example is if you want to find the maximum temperature of a city.
The max API has several implementations, as follows. The exact API used depends on the specific use case.
def max(columnName: String): ColumnAggregate function: returns the maximum value of the column in a group.def max(e: Column): ColumnAggregate function: returns the maximum value of the expression in a group.
Let's look at an example of invoking max on the DataFrame to print the maximum Population:
import org.apache.spark.sql.functions._scala> statesPopulationDF.select(max("Population")).show+---------------+|max(Population)|+---------------+| 39250017|+---------------+
Read now
Unlock full access