【问题标题】:converting par array to array in scala在scala中将par数组转换为数组
【发布时间】:2017-01-05 19:52:57
【问题描述】:

我们如何将ParArray[(Double, Double, Double, Double, Double)] 转换为Array[(Double, Double, Double, Double, Double)]

作为使用sc.parallelize(Array[(Double,...)]) 创建数据框的一部分,我必须这样做

除了硬编码(如下所示)还有其他方法吗? 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 }

【问题讨论】:

    标签: scala-2.10


    【解决方案1】:

    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)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-08
      • 1970-01-01
      • 2015-07-05
      • 2020-04-27
      • 2018-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多