This is a sample code snippet to work with domain objects and SnappyStore column tables.
Utility class to start embedded Kafka and publish messages
Utility class to start embedded Kafka and publish messages
Converts an input stream message into an org.apache.spark.sql.Row instance
An example that shows how to join between collocated tables
An example that shows how to join between collocated tables
This example can be run either in local mode (in which case the example runs collocated with Spark+SnappyData Store in the same JVM) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to your SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.CollocatedJoinExample
To submit this example as a job to an already running cluster
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name CollocatedJoinExample --class org.apache.spark.examples.snappydata.CollocatedJoinExample --app-jar examples/jars/quickstart.jar --lead [leadHost:port]
Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id]
The output of the job will be redirected to a file named CollocatedJoinExample.out
An example that shows how to create column tables in SnappyData using SQL or APIs.
An example that shows how to create column tables in SnappyData using SQL or APIs.
This example can be run either in local mode (in which case the example runs collocated with Spark+SnappyData Store in the same JVM) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to you SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.CreateColumnTable quickstart/src/main/resources
To submit this example as a job to an already running cluster
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name CreateColumnTable --class org.apache.spark.examples.snappydata.CreateColumnTable --app-jar examples/jars/quickstart.jar --lead [leadHost:port] --conf data_resource_folder=../../quickstart/src/main/resources Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id] The output of the job will be redirected to a file named CreateColumnTable.out
An example that shows how to create partitioned row tables in SnappyData using SQL or APIs.
An example that shows how to create partitioned row tables in SnappyData using SQL or APIs.
This example can be run either in local mode (in which case the example runs collocated with Spark+SnappyData Store in the same JVM) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to your SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.CreatePartitionedRowTable
To submit this example as a job to an already running cluster
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name CreatePartitionedRowTable --class org.apache.spark.examples.snappydata.CreatePartitionedRowTable --app-jar examples/jars/quickstart.jar --lead [leadHost:port] Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id] The output of the job will be redirected to a file named CreatePartitionedRowTable.out
An example that shows how to create replicated row tables in SnappyData using SQL or APIs.
An example that shows how to create replicated row tables in SnappyData using SQL or APIs.
This example can be run either in local mode (in which case the example runs collocated with Spark+SnappyData Store in the same JVM) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to you SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.CreateReplicatedRowTable
To submit this example as a job to an already running cluster
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name CreateReplicatedRowTable --class org.apache.spark.examples.snappydata.CreateReplicatedRowTable --app-jar examples/jars/quickstart.jar --lead [leadHost:port] Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id] The output of the job will be redirected to a file named CreateReplicatedRowTable.out
An example that shows JDBC operations on SnappyData system
An example that shows JDBC operations on SnappyData system
Before running this example, ensure that SnappyData cluster is started and running. To start the cluster execute the following command: sbin/snappy-start-all.sh
Run the example using following command:
bin/run-example snappydata.JDBCExample
An example that shows JDBC operations on SnappyData system
An example that shows JDBC operations on SnappyData system
Before running this example, ensure that SnappyData cluster is started and running. To start the cluster execute the following command: sbin/snappy-start-all.sh
This example shows how an application can interact with SnappyStore in Split cluster mode.
This example shows how an application can interact with SnappyStore in Split cluster mode. By this mode an application can access metastore of an existing running SnappyStore. Hence it can query tables, write to tables which reside in a SnappyStore.
To run this example you need to set up a Snappy Cluster first . To do the same, follow the steps mentioned below.
1. Go to SNAPPY_HOME. Your Snappy installation directory.
2. Start a Snappy cluster ./sbin/snappy-start-all.sh This will start a simple cluster with one data node, one lead node and a locator
3. Open Snappy Shell ./bin/snappy-sql This will open Snappy shell which can be used to create and query tables.
4. Connect to the Snappy Cluster. On the shell prompt type connect client 'localhost:1527';
5. Create a column table and insert some rows in SnappyStore. Type the followings in Snappy Shell.
CREATE TABLE SNAPPY_COL_TABLE(r1 Integer, r2 Integer) USING COLUMN;
insert into SNAPPY_COL_TABLE VALUES(1,1); insert into SNAPPY_COL_TABLE VALUES(2,2);
6. Run this example to see how this program interacts with the Snappy Cluster table (SNAPPY_COL_TABLE) that we created. This program also creates a table in SnappyStore. After running this example you can also query the table from Snappy shell e.g. select count(*) from TestColumnTable.
bin/run-example snappydata.SmartConnectorExample
An example showing usage of streaming with SnappyData
An example showing usage of streaming with SnappyData
To run the example in local mode go to your SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.StreamingExample
This example starts embedded Kafka and publishes messages(advertising bids) on it to be processed in SnappyData as streaming data. In SnappyData, streams are managed declaratively by creating a stream table(adImpressionStream). A continuous query is executed on the stream and its result is processed and publisher_bid_counts table is modified based on the streaming data
We also update a row table to maintain the no of distinct bids so far(example of storing and updating a state of streaming data)
For more details on streaming with SnappyData refer to: http://snappydatainc.github.io/snappydata/programming_guide /stream_processing_using_sql/#stream-processing-using-sql
An example showing usage of structured streaming with SnappyData
An example showing usage of structured streaming with SnappyData
To run the example in local mode go to your SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.StructuredStreamingExample
To run this on your local machine, you need to first run a Netcat server
$ nc -lk 9999
For more details on streaming with SnappyData refer to: http://snappydatainc.github.io/snappydata/programming_guide /stream_processing_using_sql/#stream-processing-using-sql
An example that shows how to create sample tables in SnappyData and execute approaximate queries using Synopsis Data Engine feature.
An example that shows how to create sample tables in SnappyData and execute approaximate queries using Synopsis Data Engine feature.
Refer to http://snappydatainc.github.io/snappydata/aqp/ for more details on Synopsis Data Engine
This example can be run either in local mode(in which it will spawn a single node SnappyData system) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to you SnappyData product distribution directory and type following command on the command prompt
bin/run-example snappydata.SynopsisDataExample quickstart/data
To submit this example as a job to an already running cluster
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name SynopsisDataExample --class org.apache.spark.examples.snappydata.SynopsisDataExample --app-jar examples/jars/quickstart.jar --lead [leadHost:port] --conf data_resource_folder=../../quickstart/data Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id] The output of the job will be redirected to a file named SynopsisDataExample.out
This is a sample code snippet to work with JSON files and SnappyStore column tables.
This is a sample code snippet to work with JSON files and SnappyStore column tables. Run with
bin/run-example snappydata.WorkingWithJson quickstart/src/main/resourcesAlso you can run this example by submitting as a job.
cd $SNAPPY_HOME bin/snappy-job.sh submit --app-name JsonApp --class org.apache.spark.examples.snappydata.WorkingWithJson --app-jar examples/jars/quickstart.jar --lead [leadHost:port] --conf json_resource_folder=../../quickstart/src/main/resources Check the status of your job id bin/snappy-job.sh status --lead [leadHost:port] --job-id [job-id]
This is a sample code snippet to work with domain objects and SnappyStore column tables.
This example can be run either in local mode (in which case the example runs collocated with Spark+SnappyData Store in the same JVM) or can be submitted as a job to an already running SnappyData cluster.
To run the example in local mode go to your SnappyData product distribution directory and type following command on the command prompt
To submit this example as a job to an already running cluster