<commit_before>/*
 * Copyright DataStax, Inc.
 *
 * Please see the included license file for details.
 */
package com.datastax.bdp.spark

import com.datastax.dse.driver.api.core.config.DseDriverConfigLoader
import com.datastax.dse.driver.api.core.{DseProtocolVersion, DseSession}
import com.datastax.oss.driver.api.core.CqlSession
import com.datastax.spark.connector.cql._
import com.datastax.spark.connector.rdd.ReadConf
import com.datastax.spark.connector.util.{ConfigParameter, DeprecatedConfigParameter}
import org.apache.spark.SparkEnv
import org.slf4j.LoggerFactory

object DseCassandraConnectionFactory extends CassandraConnectionFactory {
  @transient
  lazy private val logger = LoggerFactory.getLogger("com.datastax.bdp.spark.DseCassandraConnectionFactory")

  override def createSession(conf: CassandraConnectorConf): CqlSession = {
    val loader = DefaultConnectionFactory.connectorConfigBuilder(conf, DseDriverConfigLoader.programmaticBuilder())

/* TODO:

    val dseBuilder = DseCluster.builder()<commit_msg>Add ContinuousPaging Timeouts to Config<commit_after>/*
 * Copyright DataStax, Inc.
 *
 * Please see the included license file for details.
 */
package com.datastax.bdp.spark

import java.time.Duration

import com.datastax.dse.driver.api.core.config.{DseDriverConfigLoader, DseDriverOption}
import com.datastax.dse.driver.api.core.{DseProtocolVersion, DseSession}
import com.datastax.oss.driver.api.core.CqlSession
import com.datastax.spark.connector.cql._
import com.datastax.spark.connector.rdd.ReadConf
import com.datastax.spark.connector.util.{ConfigParameter, DeprecatedConfigParameter}
import org.apache.spark.SparkEnv
import org.slf4j.LoggerFactory

object DseCassandraConnectionFactory extends CassandraConnectionFactory {
  @transient
  lazy private val logger = LoggerFactory.getLogger("com.datastax.bdp.spark.DseCassandraConnectionFactory")

  override def createSession(conf: CassandraConnectorConf): CqlSession = {
    val loader = DefaultConnectionFactory.connectorConfigBuilder(conf, DseDriverConfigLoader.programmaticBuilder())

    loader.withDuration(DseDriverOption.CONTINUOUS_PAGING_TIMEOUT_FIRST_PAGE, Duration.ofMillis(conf.readTimeoutMillis))
    loader.withDuration(DseDriverOption.CONTINUOUS_PAGING_TIMEOUT_OTHER_PAGES, Duration.ofMillis(conf.readTimeoutMillis))

/* TODO:

    val dseBuilder = DseCluster.builder()
{'fraction_non_alphanumeric': 0.0892554991539763, 'fraction_numerical': 0.0008460236886632825, 'mean_word_length': 6.437106918238993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '3440311', 'n_tokens_mistral': 741, 'n_tokens_neox': 721, 'n_words': 120}