0

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.

1
  • If you have function bigToSmallArray then you just have to do rdd ofSmallArrays = rddOfBigArrays.map(bigToSmallArray) Commented Dec 25, 2015 at 23:10

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This works for the column. What if i want to select the rows, for example row(2) to row(8)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.