Spark中链式调用的例子:
sc.textFile(“hdfs://...”).flatMap(_.split(“ ”)).map(_, 1).reduceByKey(_ +_).map(x => (x._2, x._1)).sortByKey(false).map(x=> (x._2, x_1)).saveAsTextFile(“hdfs://…")
class Animal {def breathe : this.type = this} //在scala中,任何类和对象都有个type属性,可能返回类、对象或者空。这里的type返回的是cat对象
class Cat extends Animal{def eat : this.type = this}
ob