0

Here is the sample piece of code. I am using an array of RDDS to store objects. I would like to use flatMap on this array of RDDS and store that into a dataframe.

var ArrayofRDDs: ArrayBuffer[T] = null
for(i <- 1 to 10) {
  val data = <A function that returns an object of type T>
  ArrayofRDDs :+ data
}

Can someone help with how to use flatMap on the Array of RDDs?

0

1 Answer 1

2

how to use flatMap on the Array of RDDs

Simply don't. RDDs are not GenTraversableOnce and cannot be converted to one without using some variant of collect. If you want to combine multiple RDDs just use SparkContext.union.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.