Class/Object

org.apache.spark.sql

SnappySession

Related Docs: object SnappySession | package sql

Permalink

class SnappySession extends SparkSession

Self Type
SnappySession
Linear Supertypes
SparkSession, internal.Logging, Closeable, AutoCloseable, Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SnappySession
  2. SparkSession
  3. Logging
  4. Closeable
  5. AutoCloseable
  6. Serializable
  7. Serializable
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SnappySession(_sc: SparkContext)

    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. def alterTable(tableName: String, isAddColumn: Boolean, column: StructField, extensions: String): Unit

    Permalink
  5. def appendToTempTableCache(df: DataFrame, table: String, storageLevel: StorageLevel = StorageLevel.MEMORY_AND_DISK): Unit

    Permalink

    Append dataframe to cache table in Spark.

    Append dataframe to cache table in Spark.

    storageLevel

    default storage level is MEMORY_AND_DISK

    returns

    @todo -> return type?

    Annotations
    @DeveloperApi()
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def baseRelationToDataFrame(baseRelation: BaseRelation): DataFrame

    Permalink

    Convert a BaseRelation created for external data sources into a DataFrame.

    Convert a BaseRelation created for external data sources into a DataFrame.

    Definition Classes
    SparkSession
    Since

    2.0.0

  8. lazy val catalog: Catalog

    Permalink

    Interface through which the user may create, drop, alter or query underlying databases, tables, functions etc.

    Interface through which the user may create, drop, alter or query underlying databases, tables, functions etc.

    Definition Classes
    SparkSession
    Since

    2.0.0

  9. def clear(): Unit

    Permalink
  10. def clearPlanCache(): Unit

    Permalink
  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def close(): Unit

    Permalink

    Close the session which will be unusable after this call.

    Close the session which will be unusable after this call.

    Definition Classes
    SnappySessionSparkSession → Closeable → AutoCloseable
  13. lazy val conf: RuntimeConfig

    Permalink

    Runtime configuration interface for Spark.

    Runtime configuration interface for Spark.

    This is the interface through which the user can get and set all Spark and Hadoop configurations that are relevant to Spark SQL. When getting the value of a config, this defaults to the value set in the underlying SparkContext, if any.

    Definition Classes
    SparkSession
    Since

    2.0.0

  14. def createApproxTSTopK(topKName: String, baseTable: String, keyColumnName: String, topkOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create approximate structure to query top-K with time series support.

    Create approximate structure to query top-K with time series support. Java friendly api.

    topKName

    the qualified name of the top-K structure

    baseTable

    the base table of the top-K structure, if any, or null

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using TopK with time series

  15. def createApproxTSTopK(topKName: String, baseTable: Option[String], keyColumnName: String, topkOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create approximate structure to query top-K with time series support.

    Create approximate structure to query top-K with time series support.

    topKName

    the qualified name of the top-K structure

    baseTable

    the base table of the top-K structure, if any

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using TopK with time series

  16. def createApproxTSTopK(topKName: String, baseTable: String, keyColumnName: String, inputDataSchema: StructType, topkOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create approximate structure to query top-K with time series support.

    Create approximate structure to query top-K with time series support. Java friendly api.

    topKName

    the qualified name of the top-K structure

    baseTable

    the base table of the top-K structure, if any, or null

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using TopK with time series

  17. def createApproxTSTopK(topKName: String, baseTable: Option[String], keyColumnName: String, inputDataSchema: StructType, topkOptions: Map[String, String], allowExisting: Boolean = false): DataFrame

    Permalink

    Create approximate structure to query top-K with time series support.

    Create approximate structure to query top-K with time series support.

    topKName

    the qualified name of the top-K structure

    baseTable

    the base table of the top-K structure, if any

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using TopK with time series

  18. def createDataFrame(rows: Seq[Row], schema: StructType): DataFrame

    Permalink
    Annotations
    @DeveloperApi()
  19. def createDataFrame(data: List[_], beanClass: Class[_]): DataFrame

    Permalink

    Applies a schema to a List of Java Beans.

    Applies a schema to a List of Java Beans.

    WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order.

    Definition Classes
    SparkSession
    Since

    1.6.0

  20. def createDataFrame(rdd: JavaRDD[_], beanClass: Class[_]): DataFrame

    Permalink

    Applies a schema to an RDD of Java Beans.

    Applies a schema to an RDD of Java Beans.

    WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order.

    Definition Classes
    SparkSession
    Since

    2.0.0

  21. def createDataFrame(rdd: RDD[_], beanClass: Class[_]): DataFrame

    Permalink

    Applies a schema to an RDD of Java Beans.

    Applies a schema to an RDD of Java Beans.

    WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order.

    Definition Classes
    SparkSession
    Since

    2.0.0

  22. def createDataFrame(rows: List[Row], schema: StructType): DataFrame

    Permalink

    :: DeveloperApi :: Creates a DataFrame from a java.util.List containing Rows using the given schema.

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

    Definition Classes
    SparkSession
    Annotations
    @DeveloperApi() @Evolving()
    Since

    2.0.0

  23. def createDataFrame(rowRDD: JavaRDD[Row], schema: StructType): DataFrame

    Permalink

    :: DeveloperApi :: Creates a DataFrame from a JavaRDD containing Rows using the given schema.

    :: DeveloperApi :: Creates a DataFrame from a JavaRDD 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.

    Definition Classes
    SparkSession
    Annotations
    @DeveloperApi() @Evolving()
    Since

    2.0.0

  24. def createDataFrame(rowRDD: RDD[Row], schema: StructType): DataFrame

    Permalink

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

    :: DeveloperApi :: 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)
    Definition Classes
    SparkSession
    Annotations
    @DeveloperApi() @Evolving()
    Since

    2.0.0

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

    Permalink

    :: Experimental :: Creates a DataFrame from a local Seq of Product.

    :: Experimental :: Creates a DataFrame from a local Seq of Product.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

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

    Permalink

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

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

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  27. def createDataFrameUsingRDD[A <: Product](rdd: RDD[A])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A]): DataFrame

    Permalink

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

    :: Experimental :: Creates a DataFrame from an RDD of Product (e.g. case classes, tuples). This method handles generic array datatype like Array[Decimal]

  28. def createDataset[T](data: RDD[T])(implicit arg0: Encoder[T]): Dataset[T]

    Permalink

    :: Experimental :: Creates a Dataset from an RDD of a given type.

    :: Experimental :: 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.

    Definition Classes
    SnappySessionSparkSession
    Since

    2.0.0

  29. def createDataset[T](data: List[T])(implicit arg0: Encoder[T]): Dataset[T]

    Permalink

    :: Experimental :: Creates a Dataset from a java.util.List of a given type.

    :: Experimental :: Creates a Dataset from a java.util.List 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.

    Java Example

    List<String> data = Arrays.asList("hello", "world");
    Dataset<String> ds = spark.createDataset(data, Encoders.STRING());
    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  30. def createDataset[T](data: Seq[T])(implicit arg0: Encoder[T]): Dataset[T]

    Permalink

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

    :: Experimental :: 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|
    // +-------+---+
    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  31. def createExternalTable(tableName: String, provider: String, schema: StructType, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create an external table from the given path based on a data source, a schema and a set of options.

    Create an external table from the given path based on a data source, a schema and a set of options. For inbuilt relation providers like row or column tables, use createTable.

    tableName

    Name of the table

    provider

    Provider name such as 'CSV', 'PARQUET' etc.

    schema

    Table schema

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  32. def createExternalTable(tableName: String, provider: String, schema: StructType, options: Map[String, String], allowExisting: Boolean = false): DataFrame

    Permalink

    Create an external table from the given path based on a data source, a schema and a set of options.

    Create an external table from the given path based on a data source, a schema and a set of options. For inbuilt relation providers like row or column tables, use createTable.

    tableName

    Name of the table

    provider

    Provider name such as 'CSV', 'PARQUET' etc.

    schema

    Table schema

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  33. def createExternalTable(tableName: String, provider: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create an external table from the given path based on a data source, a schema and a set of options.

    Create an external table from the given path based on a data source, a schema and a set of options. For inbuilt relation providers like row or column tables, use createTable.

    tableName

    Name of the table

    provider

    Provider name such as 'CSV', 'PARQUET' etc.

    options

    Properties for table creation

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  34. def createExternalTable(tableName: String, provider: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create an external table from the given path based on a data source, a schema and a set of options.

    Create an external table from the given path based on a data source, a schema and a set of options. For inbuilt relation providers like row or column tables, use createTable.

    tableName

    Name of the table

    provider

    Provider name such as 'CSV', 'PARQUET' etc.

    options

    Properties for table creation

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  35. def createIndex(indexName: String, baseTable: String, indexColumns: Seq[(String, Option[SortDirection])], options: Map[String, String]): Unit

    Permalink

    Create an index on a table.

    Create an index on a table.

    indexName

    Index name which goes in the catalog

    baseTable

    Fully qualified name of table on which the index is created.

    indexColumns

    Columns on which the index has to be created with the direction of sorting. Direction can be specified as None.

    options

    Options for indexes. For e.g. column table index - ("COLOCATE_WITH"->"CUSTOMER"). row table index - ("INDEX_TYPE"->"GLOBAL HASH") or ("INDEX_TYPE"->"UNIQUE")

  36. def createIndex(indexName: String, baseTable: String, indexColumns: List[String], sortOrders: List[Boolean], options: Map[String, String]): Unit

    Permalink

    Create an index on a table.

    Create an index on a table.

    indexName

    Index name which goes in the catalog

    baseTable

    Fully qualified name of table on which the index is created.

    indexColumns

    Columns on which the index has to be created along with the sorting direction.

    sortOrders

    Sorting direction for indexColumns. The direction of index will be ascending if value is true and descending when value is false. The values in this list must exactly match indexColumns list. Direction can be specified as null in which case ascending is used.

    options

    Options for indexes. For e.g. column table index - ("COLOCATE_WITH"->"CUSTOMER"). row table index - ("INDEX_TYPE"->"GLOBAL HASH") or ("INDEX_TYPE"->"UNIQUE")

  37. def createSampleTable(tableName: String, baseTable: String, schema: StructType, samplingOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create a stratified sample table.

    Create a stratified sample table. Java friendly version.

    tableName

    the qualified name of the table

    baseTable

    the base table of the sample table, if any, or null

    schema

    schema of the table

    samplingOptions

    sampling options like QCS, reservoir size etc.

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using sample tables with time series and otherwise

  38. def createSampleTable(tableName: String, baseTable: Option[String], schema: StructType, samplingOptions: Map[String, String], allowExisting: Boolean = false): DataFrame

    Permalink

    Create a stratified sample table.

    Create a stratified sample table.

    tableName

    the qualified name of the table

    baseTable

    the base table of the sample table, if any

    schema

    schema of the table

    samplingOptions

    sampling options like QCS, reservoir size etc.

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using sample tables with time series and otherwise

  39. def createSampleTable(tableName: String, baseTable: String, samplingOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create a stratified sample table.

    Create a stratified sample table. Java friendly version.

    tableName

    the qualified name of the table

    baseTable

    the base table of the sample table, if any, or null

    samplingOptions

    sampling options like QCS, reservoir size etc.

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using sample tables with time series and otherwise

  40. def createSampleTable(tableName: String, baseTable: Option[String], samplingOptions: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Create a stratified sample table.

    Create a stratified sample table.

    tableName

    the qualified name of the table

    baseTable

    the base table of the sample table, if any

    samplingOptions

    sampling options like QCS, reservoir size etc.

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    To do

    provide lot more details and examples to explain creating and using sample tables with time series and otherwise

  41. def createTable(tableName: String, provider: String, schemaDDL: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Creates a SnappyData managed JDBC table which takes a free format ddl string.

    Creates a SnappyData managed JDBC table which takes a free format ddl string. The ddl string should adhere to syntax of underlying JDBC store. SnappyData ships with inbuilt JDBC store, which can be accessed by Row format data store. The option parameter can take connection details.

       val props = Map(
         "url" -> s"jdbc:derby:$path",
         "driver" -> "org.apache.derby.jdbc.EmbeddedDriver",
         "poolImpl" -> "tomcat",
         "user" -> "app",
         "password" -> "app"
       )
    
    val schemaDDL = "(OrderId INT NOT NULL PRIMARY KEY,ItemId INT, ITEMREF INT)"
    snappyContext.createTable("jdbcTable", "jdbc", schemaDDL, props)

    Any DataFrame of the same schema can be inserted into the JDBC table using DataFrameWriter API.

    e.g.

    case class Data(col1: Int, col2: Int, col3: Int)
    
    val data = Seq(Data(1, 2, 3), Data(7, 8, 9), Data(9, 2, 3), Data(4, 2, 3), Data(5, 6, 7))
    val dataDF = snc.createDataset(data)(Encoders.product)
    dataDF.write.insertInto("jdbcTable")
    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    schemaDDL

    Table schema as a string interpreted by provider

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  42. def createTable(tableName: String, provider: String, schemaDDL: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Creates a SnappyData managed JDBC table which takes a free format ddl string.

    Creates a SnappyData managed JDBC table which takes a free format ddl string. The ddl string should adhere to syntax of underlying JDBC store. SnappyData ships with inbuilt JDBC store, which can be accessed by Row format data store. The option parameter can take connection details.

       val props = Map(
         "url" -> s"jdbc:derby:$path",
         "driver" -> "org.apache.derby.jdbc.EmbeddedDriver",
         "poolImpl" -> "tomcat",
         "user" -> "app",
         "password" -> "app"
       )
    
    val schemaDDL = "(OrderId INT NOT NULL PRIMARY KEY,ItemId INT, ITEMREF INT)"
    snappyContext.createTable("jdbcTable", "jdbc", schemaDDL, props)

    Any DataFrame of the same schema can be inserted into the JDBC table using DataFrameWriter API.

    e.g.

    case class Data(col1: Int, col2: Int, col3: Int)
    
    val data = Seq(Data(1, 2, 3), Data(7, 8, 9), Data(9, 2, 3), Data(4, 2, 3), Data(5, 6, 7))
    val dataDF = snc.createDataset(data)(Encoders.product)
    dataDF.write.insertInto("jdbcTable")
    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    schemaDDL

    Table schema as a string interpreted by provider

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  43. def createTable(tableName: String, provider: String, schema: StructType, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Creates a SnappyData managed table.

    Creates a SnappyData managed table. Any relation providers (e.g. row, column etc) supported by SnappyData can be created here.

    case class Data(col1: Int, col2: Int, col3: Int)
    val props = Map.empty[String, String]
    val data = Seq(Data(1, 2, 3), Data(7, 8, 9), Data(9, 2, 3), Data(4, 2, 3), Data(5, 6, 7))
    val dataDF = snc.createDataset(data)(Encoders.product)
    snappyContext.createTable(tableName, "column", dataDF.schema, props)

    For other external relation providers, use createExternalTable.

    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    schema

    Table schema

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  44. def createTable(tableName: String, provider: String, schema: StructType, options: Map[String, String], allowExisting: Boolean = false): DataFrame

    Permalink

    Creates a SnappyData managed table.

    Creates a SnappyData managed table. Any relation providers (e.g. row, column etc) supported by SnappyData can be created here.

    case class Data(col1: Int, col2: Int, col3: Int)
    val props = Map.empty[String, String]
    val data = Seq(Data(1, 2, 3), Data(7, 8, 9), Data(9, 2, 3), Data(4, 2, 3), Data(5, 6, 7))
    val dataDF = snc.createDataset(data)(Encoders.product)
    snappyContext.createTable(tableName, "column", dataDF.schema, props)

    For other external relation providers, use createExternalTable.

    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    schema

    Table schema

    options

    Properties for table creation. See options list for different tables. https://github.com/TIBCOSoftware/snappydata /blob/master/docs/programming_guide/tables_in_snappydata.md

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  45. def createTable(tableName: String, provider: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Creates a SnappyData managed table.

    Creates a SnappyData managed table. Any relation providers (e.g. row, column etc) supported by SnappyData can be created here.

    val airlineDF = snappyContext.createTable(stagingAirline,
      "column", Map("buckets" -> "29"))

    For other external relation providers, use createExternalTable.

    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    options

    Properties for table creation

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  46. def createTable(tableName: String, provider: String, options: Map[String, String], allowExisting: Boolean): DataFrame

    Permalink

    Creates a SnappyData managed table.

    Creates a SnappyData managed table. Any of the table types (e.g. row, column etc) supported by SnappyData can be created here.

    val airlineDF = snappyContext.createTable(stagingAirline,
      "column", Map("buckets" -> "29"))

    For other external relation providers, use createExternalTable.

    tableName

    Name of the table

    provider

    Provider name such as 'COLUMN', 'ROW' etc.

    options

    Properties for table creation

    allowExisting

    When set to true it will ignore if a table with the same name is present, else it will throw table exist exception

    returns

    DataFrame for the table

  47. def delete(tableName: String, filterExpr: String): Int

    Permalink

    Delete all rows in table that match passed filter expression

    Delete all rows in table that match passed filter expression

    tableName

    table name

    filterExpr

    SQL WHERE criteria to select rows that will be updated

    returns

    number of rows deleted

    Annotations
    @DeveloperApi()
  48. def dropIndex(indexName: String, ifExists: Boolean): Unit

    Permalink

    Drops an index on a table

    Drops an index on a table

    indexName

    Index name which goes in catalog

    ifExists

    Drop if exists, else exit gracefully

  49. def dropPolicy(policyName: String, ifExists: Boolean = false): Unit

    Permalink

    Drop a SnappyData Policy created by a call to createPolicy.

    Drop a SnappyData Policy created by a call to createPolicy.

    policyName

    Policy to be dropped

    ifExists

    attempt drop only if the Policy exists

  50. def dropTable(tableName: String, ifExists: Boolean = false): Unit

    Permalink

    Drop a table created by a call to createTable or createExternalTable.

    Drop a table created by a call to createTable or createExternalTable.

    tableName

    table to be dropped

    ifExists

    attempt drop only if the table exists

  51. def dropView(viewName: String, ifExists: Boolean = false): Unit

    Permalink

    Drop a view.

    Drop a view.

    viewName

    name of the view to be dropped

    ifExists

    attempt drop only if the view exists

  52. lazy val emptyDataFrame: DataFrame

    Permalink

    Returns a DataFrame with no rows or columns.

    Returns a DataFrame with no rows or columns.

    Definition Classes
    SparkSession
    Since

    2.0.0

  53. def emptyDataset[T](implicit arg0: Encoder[T]): Dataset[T]

    Permalink

    :: Experimental :: Creates a new Dataset of type T containing zero elements.

    :: Experimental :: Creates a new Dataset of type T containing zero elements.

    returns

    2.0.0

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
  54. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  56. def experimental: ExperimentalMethods

    Permalink

    :: Experimental :: A collection of methods that are considered experimental, but can be used to hook into the query planner for advanced functionality.

    :: Experimental :: A collection of methods that are considered experimental, but can be used to hook into the query planner for advanced functionality.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Unstable()
    Since

    2.0.0

  57. def externalCatalog: SnappyExternalCatalog

    Permalink
  58. def finalize(): Unit

    Permalink
    Definition Classes
    SparkSession → AnyRef
  59. def getClass(ctx: CodegenContext, baseTypes: Seq[(DataType, Boolean)], keyTypes: Seq[(DataType, Boolean)], types: Seq[(DataType, Boolean)], multimap: Boolean): Option[(String, String)]

    Permalink

    Get name of a previously registered class using addClass.

  60. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  61. def getCurrentSchema: String

    Permalink
  62. def getDDLSchema(schema: StructType): String

    Permalink
  63. def getDictionaryCode(ctx: CodegenContext, keyVar: String): Option[DictionaryCode]

    Permalink

    Get DictionaryCode for a previously registered variable in ExprCode using addDictionaryCode.

  64. def getPreviousQueryHints: Map[String, String]

    Permalink
  65. def getPrimaryKeys(schema: String, table: String): Array[String]

    Permalink

    Queries sys.indexes table and returns csv string of primary column names of given table

    Queries sys.indexes table and returns csv string of primary column names of given table

    schema

    schema that the table belongs to

    table

    table for which primary keys are to be found

    returns

    primary keys of given table as csv string

  66. def getSQLType(dataType: DataType): String

    Permalink
  67. def getUniqueIdForExecScala: Long

    Permalink
  68. def getWarnings: SQLWarning

    Permalink
  69. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  70. object implicits extends SQLImplicits with Serializable

    Permalink

    :: Experimental :: (Scala-specific) Implicit methods available in Scala for converting common Scala objects into DataFrames.

    :: Experimental :: (Scala-specific) Implicit methods available in Scala for converting common Scala objects into DataFrames.

    val sparkSession = SparkSession.builder.getOrCreate()
    import sparkSession.implicits._
    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  71. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean = false): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  72. def initializeLogIfNecessary(isInterpreter: Boolean): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  73. def insert(tableName: String, rows: ArrayList[ArrayList[_]]): Int

    Permalink

    Insert one or more org.apache.spark.sql.Row into an existing table

    Insert one or more org.apache.spark.sql.Row into an existing table

    java.util.ArrayList[java.util.ArrayList[_] rows = ...    *
     snSession.insert(tableName, rows)
    tableName

    table name for the insert operation

    rows

    list of rows to be inserted into the table

    returns

    number of rows inserted

    Annotations
    @Experimental()
  74. def insert(tableName: String, rows: Row*): Int

    Permalink

    Insert one or more org.apache.spark.sql.Row into an existing table

    Insert one or more org.apache.spark.sql.Row into an existing table

    snSession.insert(tableName, dataDF.collect(): _*)

    If insert is on a column table then a row insert can trigger an overflow to column store form row buffer. If the overflow fails due to some condition like low memory , then the overflow fails and exception is thrown, but row buffer values are kept as it is. Any user level counter of number of rows inserted might be invalid in such a case.

    tableName

    table name for the insert operation

    rows

    list of rows to be inserted into the table

    returns

    number of rows inserted

    Annotations
    @DeveloperApi()
  75. def internalCreateDataFrame(catalystRows: RDD[InternalRow], schema: StructType): DataFrame

    Permalink

    Creates a DataFrame from an RDD[Row].

    Creates a DataFrame from an RDD[Row]. User can specify whether the input rows should be converted to Catalyst rows.

    Definition Classes
    SnappySessionSparkSession
  76. def internalCreateDataFrame(catalystRows: Seq[InternalRow], schema: StructType): DataFrame

    Permalink
  77. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  78. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  79. def listenerManager: ExecutionListenerManager

    Permalink

    :: Experimental :: An interface to register custom org.apache.spark.sql.util.QueryExecutionListeners that listen for execution metrics.

    :: Experimental :: An interface to register custom org.apache.spark.sql.util.QueryExecutionListeners that listen for execution metrics.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  80. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  81. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  82. def logDebug(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  83. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  84. def logError(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  85. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  86. def logInfo(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  87. def logName: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  88. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  89. def logTrace(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  90. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  91. def logWarning(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  92. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  93. def newSession(): SnappySession

    Permalink

    Start a new session with isolated SQL configurations, temporary tables, registered functions are isolated, but sharing the underlying SparkContext and cached data.

    Start a new session with isolated SQL configurations, temporary tables, registered functions are isolated, but sharing the underlying SparkContext and cached data.

    Note: Other than the SparkContext, all shared state is initialized lazily. This method will force the initialization of the shared state to ensure that parent and child sessions are set up with the same shared state. If the underlying catalog implementation is Hive, this will initialize the metastore, which may take some time.

    Definition Classes
    SnappySessionSparkSession
    Since

    2.0.0

  94. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  96. def parseDataType(dataTypeString: String): DataType

    Permalink

    Parses the data type in our internal string representation.

    Parses the data type in our internal string representation. The data type string should have the same format as the one generated by toString in scala. It is only used by PySpark.

    Attributes
    protected[org.apache.spark.sql]
    Definition Classes
    SparkSession
  97. def preferPrimaries: Boolean

    Permalink
  98. final def prepareSQL(sqlText: String, skipPromote: Boolean = false): LogicalPlan

    Permalink
  99. def put(tableName: String, rows: ArrayList[ArrayList[_]]): Int

    Permalink

    Upsert one or more org.apache.spark.sql.Row into an existing table

    Upsert one or more org.apache.spark.sql.Row into an existing table

    java.util.ArrayList[java.util.ArrayList[_] rows = ...    *
     snSession.put(tableName, rows)
    tableName

    table name for the put operation

    rows

    list of rows to be put on the table

    returns

    number of rows successfully put

    Annotations
    @Experimental()
  100. def put(tableName: String, rows: Row*): Int

    Permalink

    Upsert one or more org.apache.spark.sql.Row into an existing table

    Upsert one or more org.apache.spark.sql.Row into an existing table

    snSession.put(tableName, dataDF.collect(): _*)
    tableName

    table name for the put operation

    rows

    list of rows to be put on the table

    returns

    number of rows successfully put

    Annotations
    @DeveloperApi()
  101. def queryApproxTSTopK(topK: String, startTime: Long, endTime: Long, k: Int): DataFrame

    Permalink
  102. def queryApproxTSTopK(topKName: String, startTime: String = null, endTime: String = null, k: Int = 1): DataFrame

    Permalink

    Fetch the topK entries in the Approx TopK synopsis for the specified time interval.

    Fetch the topK entries in the Approx TopK synopsis for the specified time interval. See _createTopK_ for how to create this data structure and associate this to a base table (i.e. the full data set). The time interval specified here should not be less than the minimum time interval used when creating the TopK synopsis.

    topKName

    - The topK structure that is to be queried.

    startTime

    start time as string of the format "yyyy-mm-dd hh:mm:ss". If passed as null, oldest interval is considered as the start interval.

    endTime

    end time as string of the format "yyyy-mm-dd hh:mm:ss". If passed as null, newest interval is considered as the last interval.

    k

    Optional. Number of elements to be queried. This is to be passed only for stream summary

    returns

    returns the top K elements with their respective frequencies between two time

    To do

    provide an example and explain the returned DataFrame. Key is the attribute stored but the value is a struct containing count_estimate, and lower, upper bounds? How many elements are returned if K is not specified?

  103. def range(start: Long, end: Long, step: Long, numPartitions: Int): Dataset[Long]

    Permalink

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with a step value, with partition number specified.

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with a step value, with partition number specified.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  104. def range(start: Long, end: Long, step: Long): Dataset[Long]

    Permalink

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with a step value.

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with a step value.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  105. def range(start: Long, end: Long): Dataset[Long]

    Permalink

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with step value 1.

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from start to end (exclusive) with step value 1.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  106. def range(end: Long): Dataset[Long]

    Permalink

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from 0 to end (exclusive) with step value 1.

    :: Experimental :: Creates a Dataset with a single LongType column named id, containing elements in a range from 0 to end (exclusive) with step value 1.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  107. def read: DataFrameReader

    Permalink

    Returns a DataFrameReader that can be used to read non-streaming data in as a DataFrame.

    Returns a DataFrameReader that can be used to read non-streaming data in as a DataFrame.

    sparkSession.read.parquet("/path/to/file.parquet")
    sparkSession.read.schema(schema).json("/path/to/file.json")
    Definition Classes
    SparkSession
    Since

    2.0.0

  108. def readStream: DataStreamReader

    Permalink

    :: Experimental :: Returns a DataStreamReader that can be used to read streaming data in as a DataFrame.

    :: Experimental :: Returns a DataStreamReader that can be used to read streaming data in as a DataFrame.

    sparkSession.readStream.parquet("/path/to/directory/of/parquet/files")
    sparkSession.readStream.schema(schema).json("/path/to/directory/of/json/files")
    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Evolving()
    Since

    2.0.0

  109. def saveStream[T](stream: DStream[T], aqpTables: Seq[String], transformer: Option[(RDD[T]) ⇒ RDD[Row]])(implicit v: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit

    Permalink

    :: DeveloperApi ::

    :: DeveloperApi ::

    Annotations
    @DeveloperApi()
    To do

    do we need this anymore? If useful functionality, make this private to sql package ... SchemaDStream should use the data source API? Tagging as developer API, for now

  110. def sessionCatalog: SnappySessionCatalog

    Permalink
  111. lazy val sessionState: SnappySessionState

    Permalink

    State isolated across sessions, including SQL configurations, temporary tables, registered functions, and everything else that accepts a org.apache.spark.sql.internal.SQLConf.

    State isolated across sessions, including SQL configurations, temporary tables, registered functions, and everything else that accepts a org.apache.spark.sql.internal.SQLConf.

    Definition Classes
    SnappySessionSparkSession
  112. def setCurrentSchema(schema: String): Unit

    Permalink

    Set current schema for the session.

    Set current schema for the session.

    schema

    schema name which goes in the catalog

  113. def setPreparedParamsTypeInfo(info: Array[Int]): Unit

    Permalink
  114. def setPreparedQuery(preparePhase: Boolean, paramSet: Option[ParameterValueSet]): Unit

    Permalink
  115. lazy val sharedState: SnappySharedState

    Permalink

    State shared across sessions, including the SparkContext, cached data, listener, and a catalog that interacts with external systems.

    State shared across sessions, including the SparkContext, cached data, listener, and a catalog that interacts with external systems.

    Definition Classes
    SnappySessionSparkSession
  116. def snappyParser: SnappyParser

    Permalink
  117. val sparkContext: SparkContext

    Permalink
    Definition Classes
    SparkSession
  118. def sql(sqlText: String): DataFrame

    Permalink

    Executes a SQL query using Spark, returning the result as a DataFrame.

    Executes a SQL query using Spark, returning the result as a DataFrame. The dialect that is used for SQL parsing can be configured with 'spark.sql.dialect'.

    Definition Classes
    SnappySessionSparkSession
    Since

    2.0.0

  119. val sqlContext: SnappyContext

    Permalink

    A wrapped version of this session in the form of a SQLContext, for backward compatibility.

    A wrapped version of this session in the form of a SQLContext, for backward compatibility.

    Definition Classes
    SnappySessionSparkSession
    Since

    2.0.0

  120. def sqlUncached(sqlText: String): DataFrame

    Permalink
    Annotations
    @DeveloperApi()
  121. def stop(): Unit

    Permalink

    Stop the underlying SparkContext.

    Stop the underlying SparkContext.

    Definition Classes
    SparkSession
    Since

    2.0.0

  122. def streams: StreamingQueryManager

    Permalink

    :: Experimental :: Returns a StreamingQueryManager that allows managing all the StreamingQuerys active on this.

    :: Experimental :: Returns a StreamingQueryManager that allows managing all the StreamingQuerys active on this.

    Definition Classes
    SparkSession
    Annotations
    @Experimental() @Unstable()
    Since

    2.0.0

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

    Permalink
    Definition Classes
    AnyRef
  124. def table(tableName: String): DataFrame

    Permalink

    Returns the specified table as a DataFrame.

    Returns the specified table as a DataFrame.

    Definition Classes
    SparkSession
    Since

    2.0.0

  125. def tableIdentifier(table: String): TableIdentifier

    Permalink
  126. def time[T](f: ⇒ T): T

    Permalink

    Executes some code block and prints to stdout the time taken to execute the block.

    Executes some code block and prints to stdout the time taken to execute the block. This is available in Scala only and is used primarily for interactive testing and debugging.

    Definition Classes
    SparkSession
    Annotations
    @Stable()
    Since

    2.1.0

  127. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  128. def truncateTable(table: String, ifExists: Boolean = false): Unit

    Permalink

    Empties the contents of the table without deleting the catalog entry.

    Empties the contents of the table without deleting the catalog entry.

    table

    full table name to be truncated

    ifExists

    attempt truncate only if the table exists

  129. def udf: UDFRegistration

    Permalink

    A collection of methods for registering user-defined functions (UDF).

    A collection of methods for registering user-defined functions (UDF).

    The following example registers a Scala closure as UDF:

    sparkSession.udf.register("myUDF", (arg1: Int, arg2: String) => arg2 + arg1)

    The following example registers a UDF in Java:

    sparkSession.udf().register("myUDF",
        new UDF2<Integer, String, String>() {
            @Override
            public String call(Integer arg1, String arg2) {
                return arg2 + arg1;
            }
       }, DataTypes.StringType);

    Or, to use Java 8 lambda syntax:

    sparkSession.udf().register("myUDF",
        (Integer arg1, String arg2) -> arg2 + arg1,
        DataTypes.StringType);
    Definition Classes
    SparkSession
    Since

    2.0.0

    Note

    The user-defined functions must be deterministic. Due to optimization, duplicate invocations may be eliminated or the function may even be invoked more times than it is present in the query.

  130. def update(tableName: String, filterExpr: String, newColumnValues: ArrayList[_], updateColumns: ArrayList[String]): Int

    Permalink

    Update all rows in table that match passed filter expression

    Update all rows in table that match passed filter expression

    snappyContext.update("jdbcTable", "ITEMREF = 3" , Row(99) , "ITEMREF" )
    tableName

    table name which needs to be updated

    filterExpr

    SQL WHERE criteria to select rows that will be updated

    newColumnValues

    A list containing all the updated column values. They MUST match the updateColumn list passed

    updateColumns

    List of all column names being updated

    Annotations
    @Experimental()
  131. def update(tableName: String, filterExpr: String, newColumnValues: Row, updateColumns: String*): Int

    Permalink

    Update all rows in table that match passed filter expression

    Update all rows in table that match passed filter expression

    snappyContext.update("jdbcTable", "ITEMREF = 3" , Row(99) , "ITEMREF" )
    tableName

    table name which needs to be updated

    filterExpr

    SQL WHERE criteria to select rows that will be updated

    newColumnValues

    A single Row containing all updated column values. They MUST match the updateColumn list passed

    updateColumns

    List of all column names being updated

    Annotations
    @DeveloperApi()
  132. def updateStructuredStreamingUITab(): Unit

    Permalink
  133. def updateUIWithStructuredStreamingTab(): Unit

    Permalink

    Adds or updates structured streaming UI tab.

    Adds or updates structured streaming UI tab. All session instances have their own SnappyStreamingQueryListener but shares same UI tab.

    Attributes
    protected
    Definition Classes
    SparkSession
  134. def version: String

    Permalink

    The version of Spark on which this application is running.

    The version of Spark on which this application is running.

    Definition Classes
    SparkSession
    Since

    2.0.0

  135. final def wait(): Unit

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

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

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

Inherited from SparkSession

Inherited from internal.Logging

Inherited from Closeable

Inherited from AutoCloseable

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

basic

Ungrouped