All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tribbloids.spookystuff.sparkbinding.DataFrameView.scala Maven / Gradle / Ivy

package com.tribbloids.spookystuff.sparkbinding

import org.apache.spark.rdd.RDD
import org.apache.spark.sql.DataFrame

import scala.collection.immutable.ListMap

/**
 * Created by peng on 12/06/14.
 */
class DataFrameView(val self: DataFrame) {

  def toMapRDD: RDD[Map[String,Any]] = {
    val headers = self.schema.fieldNames

    val result: RDD[Map[String,Any]] = self.map{
      row => ListMap(headers.zip(row.toSeq): _*)
    }

    result
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy