My initial RDD; Array[Array[String]], looks something like:
a b h c ....... d e x q
d r d x ....... e q g m
f e u t ....... q t g y
a b h c ....... d e x q
d r d x ....... e q g m
f e u t ....... q t g y
....
....
New RDD; Array[Array[String]], that contains:
u t ...... q t
h c ...... d e
Any idea on how to work on it? Size of the array is large, so one could want the sub-array of any size. Thanks in advance.
It looks like all you need here is just drop*
:
rdd.map(_.drop(2).dropRight(2))
And if you're in doubt it is usually useful to check Scala collections docs .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.