val lines: Dataset[String] = session.read.textFile("")
val words: Dataset[String] = lines.flatMap(_.split(" "))
linesdataSetflatMapdataSetIDEAflatMap:
def flatMap[U : Encoder](func: T => TraversableOnce[U]): Dataset[U] =
mapPartitions(_.flatMap(func))
question:
_ .split ("") is equivalent to a function. The input parameter is String, and the return type is split"s result type Array [String],
while the flatmap method is defined to receive func: T = > TraversableOnce [U], it is obvious that T here is of type String,
and Array [String] is not of type TraversableOnce [U], because Array does not implement the trait of TraversableOnce,
so my question is: why did I pass a function like _ .split ("") to flatMap,flatMap without reporting an error?
in a nutshell, the method type I passed in doesn"t seem to match the method type required by flatMap, does it?