Home > other >  The spark SQL column how to transform the data types
The spark SQL column how to transform the data types

Time:09-25

Column b is the string data type
Df group (" a "). The Max error (" b ")
Have a conversion API? Can you give me an example. Thanks

CodePudding user response:

Max method can only accept numeric columns, try HiveContext. SQL

CodePudding user response:

Cast ()

Df. Select (df (" colA ") cast (" int "))

CodePudding user response:

Max method only accept numeric type parameters, Int, Long, etc., if it is a String, Date, Timestamp type words to use agg (Max (" b "))
  • Related