Object/Class

zio.spark.sql

SparkSession

Related Docs: class SparkSession | package sql

Permalink

object SparkSession extends Serializable

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SparkSession
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class Builder(builder: org.apache.spark.sql.SparkSession.Builder, extraConfigs: Map[String, String], hiveSupport: Boolean = false) extends Product with Serializable

    Permalink
  2. trait Conf extends AnyRef

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def attempt[Out](f: (org.apache.spark.sql.SparkSession) ⇒ Out)(implicit trace: Trace): SIO[Out]

    Permalink
  6. def builder: Builder

    Permalink

    Creates a SparkSession.Builder.

    Creates a SparkSession.Builder.

    See UnderlyingSparkSession.builder for more information.

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def close(implicit trace: Trace): RIO[SparkSession, Unit]

    Permalink

    Closes the current SparkSession.

  9. def conf: URIO[SparkSession, Conf]

    Permalink
  10. def createDataFrame(rowRDD: RDD[Row], schema: StructType): RIO[SparkSession, DataFrame]

    Permalink

    Creates a DataFrame from an RDD containing Rows using the given schema.

    Creates a DataFrame from an RDD containing Rows using the given schema. It is important to make sure that the structure of every Row of the provided RDD matches the provided schema. Otherwise, there will be runtime exception. Example:

    import org.apache.spark.sql._
    import org.apache.spark.sql.types._
    val sparkSession = new org.apache.spark.sql.SparkSession(sc)
    
    val schema =
      StructType(
        StructField("name", StringType, false) ::
        StructField("age", IntegerType, true) :: Nil)
    
    val people =
      sc.textFile("examples/src/main/resources/people.txt").map(
        _.split(",")).map(p => Row(p(0), p(1).trim.toInt))
    val dataFrame = sparkSession.createDataFrame(people, schema)
    dataFrame.printSchema
    // root
    // |-- name: string (nullable = false)
    // |-- age: integer (nullable = true)
    
    dataFrame.createOrReplaceTempView("people")
    sparkSession.sql("select name from people").collect.foreach(println)
    Since

    2.0.0

  11. def createDataFrame[A <: Product](data: Seq[A])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A]): RIO[SparkSession, DataFrame]

    Permalink

    Creates a DataFrame from a local Seq of Product.

    Creates a DataFrame from a local Seq of Product.

    Since

    2.0.0

  12. def createDataFrame[A <: Product](rdd: RDD[A])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A]): RIO[SparkSession, DataFrame]

    Permalink

    Creates a DataFrame from an RDD of Product (e.g.

    Creates a DataFrame from an RDD of Product (e.g. case classes, tuples).

    Since

    2.0.0

  13. def createDataset[T](data: RDD[T])(implicit arg0: Encoder[T]): RIO[SparkSession, Dataset[T]]

    Permalink

    Creates a Dataset from an RDD of a given type.

    Creates a Dataset from an RDD of a given type. This method requires an encoder (to convert a JVM object of type T to and from the internal Spark SQL representation) that is generally created automatically through implicits from a SparkSession, or can be created explicitly by calling static methods on Encoders.

    Since

    2.0.0

  14. def createDataset[T](data: Seq[T])(implicit arg0: Encoder[T]): RIO[SparkSession, Dataset[T]]

    Permalink

    Creates a Dataset from a local Seq of data of a given type.

    Creates a Dataset from a local Seq of data of a given type. This method requires an encoder (to convert a JVM object of type T to and from the internal Spark SQL representation) that is generally created automatically through implicits from a SparkSession, or can be created explicitly by calling static methods on Encoders.

    Example

    import spark.implicits._
    case class Person(name: String, age: Long)
    val data = Seq(Person("Michael", 29), Person("Andy", 30), Person("Justin", 19))
    val ds = spark.createDataset(data)
    
    ds.show()
    // +-------+---+
    // |   name|age|
    // +-------+---+
    // |Michael| 29|
    // |   Andy| 30|
    // | Justin| 19|
    // +-------+---+
    Since

    2.0.0

  15. def emptyDataset[T](implicit arg0: Encoder[T]): RIO[SparkSession, Dataset[T]]

    Permalink

    Creates a new Dataset of type T containing zero elements.

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def read: DataFrameReader[WithoutSchema]

    Permalink

    Creates a DataFrameReader.

  26. def readStream: DataStreamReader

    Permalink

    Creates a DataStreamReader.

  27. def sql(sqlText: String)(implicit trace: Trace): RIO[SparkSession, DataFrame]

    Permalink

    Executes a SQL query using Spark.

  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  29. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped