Reputation: 111
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.
Upvotes: 0
Views: 495
Reputation: 330073
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.
Upvotes: 1