converting par array to array in scala

933 views Asked by At

How can we convert ParArray[(Double, Double, Double, Double, Double)] to Array[(Double, Double, Double, Double, Double)]

I have to do this as part of creating the data frame using sc.parallelize(Array[(Double,...)])

Apart from hardcoding (like below) is there any other way? for(x1 <- 0 until a.length){ new_a(x1)(0) = a(x1)._1 new_a(x1)(1) = a(x1)._2 new_a(x1)(2) = a(x1)._3 new_a(x1)(3) = a(x1)._4 new_a(x1)(4) = a(x1)._5 }

1

There are 1 answers

0
Philipp On

See http://docs.scala-lang.org/overviews/parallel-collections/conversions.html#converting-between-sequential-and-parallel-collections

val a: ParArray[(Double, Double, Double, Double, Double)] = ??? val rdd = sc.parallelize(a.seq)