My questions is:
In line number 5: What is the operation of the symbol of single apostrophes(')? Cannot understand very clearly that how withColumn function is working over here. Also Please elaborate how it is displaying like these Column order- |id |text |upper |.
Code:
1. val dataset = Seq((0, "hello"),(1, "world")).toDF("id","text")
2. val upper: String => String =_.toUpperCase
3. import org.apache.spark.sql.functions.udf
4. val upperUDF = udf(upper)
5. dataset.withColumn("upper", upperUDF('text)).show
Output:
+---------+---------+---------+
|id |text |upper |
+---------+---------+---------+
| 0 | hello |HELLO |
| 1 | world |WORLD |
+---------+---------+---------+