<commit_before># Documentation

## 5-minute quick start guide

In this tutorial, you'll learn how to setup a very simple Spark application for reading and writing data from/to Cassandra.
Before you start, you need to have basic knowledge of Apache Cassandra and Apache Spark.
Refer to [Cassandra documentation](http://www.datastax.com/documentation/cassandra/2.0/cassandra/gettingStartedCassandraIntro.html) 
and [Spark documentation](https://spark.apache.org/docs/0.9.1/). 

### Prerequisites

Install and launch a Cassandra 2.0 cluster and a Spark cluster.   

Configure a new Scala project with the following dependencies:

 - Apache Spark 0.9 or 1.0 and its dependencies
 - Apache Cassandra thrift and clientutil libraries matching the version of Cassandra  
 - DataStax Cassandra driver for your Cassandra version 
 
This driver does not depend on the Cassandra server code.   
- For a detailed dependency list, see project dependencies in the `project/CassandraSparkBuild.scala` file.
- For dependency versions, see `project/Versions.scala` file.

Add the `spark-cassandra-connector` jar and its dependency jars to the following classpaths:

    "com.datastax.spark" %% "spark-cassandra-connector" % Version

 - the classpath of your project
 - the classpath of every Spark cluster node
 
This driver is also compatible with Spark distribution provided in 
[DataStax Enterprise 4.5](http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/newFeatures.html).
 
### Preparing example Cassandra schema
Create a simple keyspace and table in Cassandra. Run the following statements in `cqlsh`:

```sql
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 };
CREATE TABLE test.kv(key text PRIMARY KEY, value int);
```
      
Then insert some example data:

```sql
INSERT INTO test.kv(key, value) VALUES ('key1', 1);
INSERT INTO test.kv(key, value) VALUES ('key2', 2);
```
 
Now you're ready to write your first Spark program using Cassandra.

### Setting up `SparkContext`   
Before creating the `SparkContext`, set the `spark.cassandra.connection.host` property to the address of one 
of the Cassandra nodes:

```scala
val conf = new SparkConf(true)
   .set("spark.cassandra.connection.host", "127.0.0.1")
```
       <commit_msg>SPARKC-23: Updated Quickstart with CLASSPATH Instructions<commit_after># Documentation

## 5-minute quick start guide

In this tutorial, you'll learn how to setup a very simple Spark application for reading and writing data from/to Cassandra.
Before you start, you need to have basic knowledge of Apache Cassandra and Apache Spark.
Refer to [Cassandra documentation](http://www.datastax.com/documentation/cassandra/2.0/cassandra/gettingStartedCassandraIntro.html) 
and [Spark documentation](https://spark.apache.org/docs/0.9.1/). 

### Prerequisites

Install and launch a Cassandra 2.0 cluster and a Spark cluster.   

Configure a new Scala project with the following dependencies:

 - Apache Spark 0.9 or 1.0 and its dependencies
 - Apache Cassandra thrift and clientutil libraries matching the version of Cassandra  
 - DataStax Cassandra driver for your Cassandra version 
 
This driver does not depend on the Cassandra server code.   
- For a detailed dependency list, see project dependencies in the `project/CassandraSparkBuild.scala` file.
- For dependency versions, see `project/Versions.scala` file.

Add the `spark-cassandra-connector` jar and its dependency jars to the following classpaths:

    "com.datastax.spark" %% "spark-cassandra-connector" % Version

 - the classpath of your project
 - the classpath of every Spark cluster node
 
The easiest way to do this is to make the assembled connector jar using

     sbt assembly
     
This will generate a jar file with all of the required dependencies in 

     spark-cassandra-connector/spark-cassandra-connector/target/scala-2.10/spark-cassandra-connector-assembly-*.jar
     
Then add this jar to your Spark classpath by adding the following line to your spark-env.sh

    SPARK_CLASSPATH=spark-cassandra-connector/spark-cassandra-connector/target/scala-2.10/spark-cassandra-connector-assembly-$CurrentVersion-SNAPSHOT.jar
 
This driver is also compatible with Spark distribution provided in 
[DataStax Enterprise 4.5](http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/newFeatures.html).
 
### Preparing example Cassandra schema
Create a simple keyspace and table in Cassandra. Run the following statements in `cqlsh`:

```sql
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 };
CREATE TABLE test.kv(key text PRIMARY KEY, value int);
```
      
Then insert some example data:

```sql
INSERT INTO test.kv(key, value) VALUES ('key1', 1);
INSERT INTO test.kv(key, value) VALUES ('key2', 2);
```
 
Now you're ready to write your first Spark program using Cassandra.

### Setting up `SparkContext`   
Before creating the `SparkContext`, set the `spark.cassandra.connection.host` property to the address of one 
of the Cassandra nodes:

```scala
val conf = new SparkConf(true)
   .set("spark.cassandra.connection.host", "127.0.0.1")
```
       
{'fraction_non_alphanumeric': 0.08579710144927537, 'fraction_numerical': 0.011980676328502415, 'mean_word_length': 4.4426919032597265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3583382', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1432, 'n_words': 566}