(Since version 1.6.0) use org.apache.spark.sql.QueryExecution
(Since version 1.6.0) use org.apache.spark.sql.SparkPlanner
Append dataframe to cache table in Spark.
Append dataframe to cache table in Spark.
default storage level is MEMORY_AND_DISK
@todo -> return type?
Create approximate structure to query top-K with time series support.
Create approximate structure to query top-K with time series support.
the qualified name of the top-K structure
provide lot more details and examples to explain creating and using TopK with time series
Create a stratified sample table.
Create a stratified sample table.
the qualified name of the table
provide lot more details and examples to explain creating and using sample tables with time series and otherwise
Creates a Snappy managed JDBC table which takes a free format ddl string.
Creates a Snappy 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. Unlike SqlContext.createExternalTable this API creates a persistent catalog entry.
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(Seq(1, 2, 3), Seq(7, 8, 9), Seq(9, 2, 3), Seq(4, 2, 3), Seq(5, 6, 7)) val rdd = sc.parallelize(data, data.length).map(s => new Data(s(0), s(1), s(2))) val dataDF = snc.createDataFrame(rdd) dataDF.write.format("jdbc").mode(SaveMode.Append).saveAsTable("jdbcTable")
Name of the table
Provider name 'ROW' and 'JDBC'.
Table schema as a string interpreted by provider
Properties for table creation. See options list for different tables. https://github.com/SnappyDataInc/snappydata/blob/master/docs/rowAndColumnTables.md
DataFrame for the table
Creates a Snappy managed table.
Creates a Snappy managed table. Any relation providers (e.g. parquet, jdbc etc) supported by Spark & Snappy can be created here. Unlike SqlContext.createExternalTable this API creates a persistent catalog entry.
case class Data(col1: Int, col2: Int, col3: Int) val props = Map.empty[String, String] val data = Seq(Seq(1, 2, 3), Seq(7, 8, 9), Seq(9, 2, 3), Seq(4, 2, 3), Seq(5, 6, 7)) val rdd = sc.parallelize(data, data.length).map(s => new Data(s(0), s(1), s(2))) val dataDF = snc.createDataFrame(rdd) snappyContext.createTable(tableName, "column", dataDF.schema, props)
Name of the table
Provider name such as 'COLUMN', 'ROW', 'JDBC', 'PARQUET' etc.
Table schema
Properties for table creation. See options list for different tables. https://github.com/SnappyDataInc/snappydata/blob/master/docs/rowAndColumnTables.md
DataFrame for the table
Creates a Snappy managed table.
Creates a Snappy managed table. Any relation providers (e.g. parquet, jdbc etc) supported by Spark & Snappy can be created here. Unlike SqlContext.createExternalTable this API creates a persistent catalog entry.
val airlineDF = snappyContext.createTable(stagingAirline, "parquet", Map("path" -> airlinefilePath))
Name of the table
Provider name such as 'COLUMN', 'ROW', 'JDBC', 'PARQUET' etc.
Properties for table creation
DataFrame for the table
Delete all rows in table that match passed filter expression
Delete all rows in table that match passed filter expression
table name
SQL WHERE criteria to select rows that will be updated
number of rows deleted
Drop a SnappyData table created by a call to SnappyContext.
Drop a SnappyData table created by a call to SnappyContext.createTable
table to be dropped
attempt drop only if the table exists
Insert one or more org.apache.spark.sql.Row into an existing table A user can insert a DataFrame using foreachPartition.
Insert one or more org.apache.spark.sql.Row into an existing table A user can insert a DataFrame using foreachPartition...
someDataFrame.foreachPartition (x => snappyContext.insert ("MyTable", x.toSeq) )
number of rows inserted
Upsert one or more org.apache.spark.sql.Row into an existing table upsert a DataFrame using foreachPartition.
Upsert one or more org.apache.spark.sql.Row into an existing table upsert a DataFrame using foreachPartition...
someDataFrame.foreachPartition (x => snappyContext.put ("MyTable", x.toSeq) )
why do we need this method? K is optional in the above method
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.
- The topK structure that is to be queried.
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.
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.
Optional. Number of elements to be queried. This is to be passed only for stream summary
returns the top K elements with their respective frequencies between two time
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?
:: DeveloperApi ::
:: DeveloperApi ::
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
Empties the contents of the table without deleting the catalog entry.
Empties the contents of the table without deleting the catalog entry.
full table name to be truncated
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" )
table name which needs to be updated
SQL WHERE criteria to select rows that will be updated
A single Row containing all updated column values. They MUST match the updateColumn list passed
List of all column names being updated
(Since version 1.3.0) use createDataFrame
(Since version 1.3.0) use createDataFrame
(Since version 1.3.0) use createDataFrame
(Since version 1.3.0) use createDataFrame
(Since version 1.4.0) use read.jdbc()
(Since version 1.4.0) use read.jdbc()
(Since version 1.4.0) use read.jdbc()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.json()
(Since version 1.4.0) Use read.format(source).schema(schema).options(options).load()
(Since version 1.4.0) Use read.format(source).schema(schema).options(options).load()
(Since version 1.4.0) Use read.format(source).options(options).load()
(Since version 1.4.0) Use read.format(source).options(options).load()
(Since version 1.4.0) Use read.format(source).load(path)
(Since version 1.4.0) Use read.load(path)
(Since version 1.4.0) Use read.parquet()
Main entry point for SnappyData extensions to Spark. A SnappyContext extends Spark's org.apache.spark.sql.SQLContext to work with Row and Column tables. Any DataFrame can be managed as SnappyData tables and any table can be accessed as a DataFrame. This is similar to HiveContext - integrates the SQLContext functionality with the Snappy store.
When running in the embedded mode (i.e. Spark executor collocated with Snappy data store), Applications typically submit Jobs to the Snappy-JobServer (provide link) and do not explicitly create a SnappyContext. A single shared context managed by SnappyData makes it possible to re-use Executors across client connections or applications.
SnappyContext uses a HiveMetaStore for catalog , which is persistent. This enables table metadata info recreated on driver restart.
User should use obtain reference to a SnappyContext instance as below val snc: SnappyContext = SnappyContext.getOrCreate(sparkContext)
Provide links to above descriptions
,document describing the Job server API
https://github.com/SnappyDataInc/snappydata#interacting-with-snappydata
https://github.com/SnappyDataInc/snappydata#step-1---start-the-snappydata-cluster