I have a Scala program that I want to execute using Spark shell, now when I copy paste into spark shell it doesn't work, I have to copy line by line inside.
How should I copy all the program inside the shell ?
Thanks.
In spark-shell, you just need use the command ":paste"
scala> :paste
// Entering paste mode (ctrl-D to finish)
val empsalary = Seq(
Salary("sales", 1, 5000),
Salary("personnel", 2, 3900),
Salary("sales", 3, 4800),
Salary("sales", 4, 4800),
Salary("personnel", 5, 3500),
Salary("develop", 7, 4200),
Salary("develop", 8, 6000),
Salary("develop", 9, 4500),
Salary("develop", 10, 5200),
Salary("develop", 11, 5200))
.toDS.toDF
Then use ctrl-D to quit this mode. You can see output:
// Exiting paste mode, now interpreting.
empsalary: org.apache.spark.sql.DataFrame = [depName: string, empNo: bigint ... 1 more field]