All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.spark.connector.streaming.StreamingContextFunctions.scala Maven / Gradle / Ivy

The newest version!
package com.datastax.spark.connector.streaming

import com.datastax.spark.connector.cql.CassandraConnector
import com.datastax.spark.connector.rdd.{ReadConf, ValidRDDType}
import org.apache.spark.streaming.StreamingContext
import com.datastax.spark.connector.SparkContextFunctions
import com.datastax.spark.connector.rdd.partitioner.dht.Token
import com.datastax.spark.connector.rdd.reader.RowReaderFactory

/** Provides Cassandra-specific methods on `org.apache.spark.streaming.StreamingContext`.
  * @param ssc the Spark Streaming context
  */
class StreamingContextFunctions (ssc: StreamingContext) extends SparkContextFunctions(ssc.sparkContext) {
  import scala.reflect.ClassTag

  override def cassandraTable[T](keyspace: String, table: String,
                                 tokenRangeFilter: (Token[_], Token[_]) => Boolean = (_, _) => true)(
    implicit
      connector: CassandraConnector = CassandraConnector(ssc.sparkContext),
      readConf: ReadConf = ReadConf.fromSparkConf(sc.getConf),
      ct: ClassTag[T],
      rrf: RowReaderFactory[T],
      ev: ValidRDDType[T]): CassandraStreamingRDD[T] = {

    new CassandraStreamingRDD[T](ssc, connector, keyspace, table, readConf = readConf)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy