Hey,
With Scala, we can define a Scala function inside another. This is what a local function looks like:
Let's take an example:
scala> def outer(){
| println("In outer")
| def inner(){
| println("In inner")
| }
| inner()
| }
outer: ()Unit
scala> outer()
The output will be:
In outer
In inner
One other example for your clear visual here:
scala> def outer(a:Int){
| println("In outer")
| def inner(){
| println(a*3)
| }
| inner()
| }
outer: (a: Int)Unit
scala> outer(3)
The Output will be
In outer
9
If you want to know more about Apache Spark Scala, It's highly recommended to go for the Spark Training today.