These notes are merely random tricks that I learn in my journey with Scala.
Spark
Spark has transformation functions.
Facts to take into account
CombineByKeyis preferred overGroupByKey.- Dealing with
SparkandHadooprequire us to have a in mind that we are working in a distrubuted setting. - The
-byKeymethods operate onPairwiseRDDs.
Scala
Seq and Vector vs BufferList
To add an element to Seq I use this: :+.
apply functions
I liked this one, to get the element i from a Seq object, we write this: seq apply i.
Scope of variables
Be careful, the variable variable is out of the scope!
if (true) {
var variable = "value"
}
println(variable)
More concepts that I need to learn
- The
yieldinstruction. - The
applyfunctions. - Difference between
object,class,case class, andtrait. GrowableandShrinkableobjects.