Package

com.datastax.spark

connector

Permalink

package connector

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()
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. connector
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait BatchSize extends AnyRef

    Permalink
  2. case class BytesInBatch(batchSize: Int) extends BatchSize with Product with Serializable

    Permalink
  3. class CassandraSparkExtensions extends (SparkSessionExtensions) ⇒ Unit with Logging

    Permalink
  4. final class CassandraTableScanPairRDDFunctions[K, V] extends Serializable

    Permalink
  5. final class CassandraTableScanRDDFunctions[R] extends Serializable

    Permalink
  6. implicit final class ColumnNameFunctions extends AnyVal

    Permalink
  7. sealed trait ColumnSelector extends AnyRef

    Permalink
  8. class DatasetFunctions[K] extends Serializable

    Permalink

    Provides Cassandra-specific methods on org.apache.spark.sql.DataFrame

  9. class PairRDDFunctions[K, V] extends Serializable

    Permalink
  10. class RDDFunctions[T] extends WritableToCassandra[T] with Serializable

    Permalink

    Provides Cassandra-specific methods on RDD

  11. case class RowsInBatch(batchSize: Int) extends BatchSize with Product with Serializable

    Permalink
  12. case class SomeColumns(columns: ColumnRef*) extends ColumnSelector with Product with Serializable

    Permalink
  13. class SparkContextFunctions extends Serializable

    Permalink

    Provides Cassandra-specific methods on SparkContext

Value Members

  1. object AllColumns extends ColumnSelector with Product with Serializable

    Permalink
  2. object BatchSize

    Permalink
  3. object DocUtil

    Permalink
  4. object PartitionKeyColumns extends ColumnSelector with Product with Serializable

    Permalink
  5. object PrimaryKeyColumns extends ColumnSelector with Product with Serializable

    Permalink
  6. object SomeColumns extends Serializable

    Permalink
  7. package cql

    Permalink

    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.

  8. package japi

    Permalink
  9. package mapper

    Permalink
  10. package rdd

    Permalink

    Contains com.datastax.spark.connector.rdd.CassandraTableScanRDD class that is the main entry point for analyzing Cassandra data from Spark.

  11. package streaming

    Permalink
  12. implicit def toCassandraTableScanFunctions[T](rdd: CassandraTableScanRDD[T]): CassandraTableScanRDDFunctions[T]

    Permalink
  13. implicit def toCassandraTableScanRDDPairFunctions[K, V](rdd: CassandraTableScanRDD[(K, V)]): CassandraTableScanPairRDDFunctions[K, V]

    Permalink
  14. implicit def toDataFrameFunctions(dataFrame: DataFrame): DatasetFunctions[Row]

    Permalink
  15. implicit def toDatasetFunctions[K](dataset: Dataset[K])(implicit arg0: Encoder[K]): DatasetFunctions[K]

    Permalink
  16. implicit def toNamedColumnRef(columnName: String): ColumnName

    Permalink
  17. implicit def toPairRDDFunctions[K, V](rdd: RDD[(K, V)]): PairRDDFunctions[K, V]

    Permalink
  18. implicit def toRDDFunctions[T](rdd: RDD[T]): RDDFunctions[T]

    Permalink
  19. implicit def toSparkContextFunctions(sc: SparkContext): SparkContextFunctions

    Permalink
  20. package types

    Permalink
  21. package util

    Permalink

    Useful stuff that didn't fit elsewhere.

  22. package writer

    Permalink

    Contains components for writing RDDs to Cassandra

Inherited from AnyRef

Inherited from Any

Ungrouped