package mapper
Type Members
- class DataFrameColumnMapper[T] extends ColumnMapper[T]
The root package of Cassandra connector for Apache Spark.
The root package of Cassandra connector for Apache Spark. Offers handy implicit conversions that add Cassandra-specific methods to SparkContext and RDD.
Call cassandraTable method on the SparkContext object to create a CassandraRDD exposing Cassandra tables as Spark RDDs.
Call RDDFunctions saveToCassandra
function on any RDD
to save distributed collection to a Cassandra table.
Example:
CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 }; CREATE TABLE test.words (word text PRIMARY KEY, count int); INSERT INTO test.words(word, count) VALUES ("and", 50);
import com.datastax.spark.connector._ val sparkMasterHost = "127.0.0.1" val cassandraHost = "127.0.0.1" val keyspace = "test" val table = "words" // Tell Spark the address of one Cassandra node: val conf = new SparkConf(true).set("spark.cassandra.connection.host", cassandraHost) // Connect to the Spark cluster: val sc = new SparkContext("spark://" + sparkMasterHost + ":7077", "example", conf) // Read the table and print its contents: val rdd = sc.cassandraTable(keyspace, table) rdd.toArray().foreach(println) // Write two rows to the table: val col = sc.parallelize(Seq(("of", 1200), ("the", "863"))) col.saveToCassandra(keyspace, table) sc.stop()
Contains a cql.CassandraConnector object which is used to connect to a Cassandra cluster and to send CQL statements to it.
Contains a cql.CassandraConnector object which is used to connect
to a Cassandra cluster and to send CQL statements to it. CassandraConnector
provides a Scala-idiomatic way of working with Session
object
and takes care of connection pooling and proper resource disposal.
Contains com.datastax.spark.connector.rdd.CassandraTableScanRDD class that is the main entry point for analyzing Cassandra data from Spark.
Contains com.datastax.spark.connector.rdd.CassandraTableScanRDD class that is the main entry point for analyzing Cassandra data from Spark.
Useful stuff that didn't fit elsewhere.
Useful stuff that didn't fit elsewhere.
Contains components for writing RDDs to Cassandra
Contains components for writing RDDs to Cassandra