You are missing ;
to separate the 2 statements.
Programming in Scala, First Edition
In a Scala program, a semicolon at the end of a statement is usually optional. You can type one if you want but you don't have to
if the statement appears by itself on a single line.
On the other hand, a semicolon is required if you write multiple statements on a single line:
val s = "hello"; println(s)
Sample working example Error
(exactly as in your code):
scala> val rnd = Math.random() val n = Math.abs(rnd)
<console>:1: error: ';' expected but 'val' found.
val rnd = Math.random() val n = Math.abs(rnd)
^
Sample working example Fixed
:
scala> val rnd = Math.random(); val n = Math.abs(rnd)
rnd: Double = 0.5940919229549699
n: Double = 0.5940919229549699
So, in your case, you have 2 options to make it work:
Option1:
val bankDF = bankrdd.toDF(); bankDF.registerTempTable("bankfull")
Option2:
val bankDF = bankrdd.toDF()
bankDF.registerTempTable("bankfull")
with the following output:
scala> val bankDF = bankrdd.toDF(); bankDF.registerTempTable("bankfull")
warning: there was one deprecation warning; re-run with -deprecation for details
bankDF: org.apache.spark.sql.DataFrame = [value: string]