Demo entry 6755473

highlighter

   

Submitted by anonymous on Aug 01, 2018 at 03:18
Language: Scala. Code size: 398 Bytes.

package ai.something.else

import org.apache.spark.sql.types.{StructField, StructType}
import org.apache.spark.sql.{DataFrame, Row, SparkSession}

case class DataFrameBuilder(input: Seq[Row] = Seq(), schema: Seq[StructField] = Seq()) {
  def build(spark: SparkSession): DataFrame = {
    spark.createDataFrame(
      spark.sparkContext.parallelize(input),
      StructType(schema))
  }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).