Class CassandraIO.Read<T>

java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PBegin,PCollection<T>>
org.apache.beam.sdk.io.cassandra.CassandraIO.Read<T>
All Implemented Interfaces:
Serializable, HasDisplayData
Enclosing class:
CassandraIO

public abstract static class CassandraIO.Read<T> extends PTransform<PBegin,PCollection<T>>
A PTransform to read data from Apache Cassandra. See CassandraIO for more information on usage and configuration.
See Also:
  • Constructor Details

    • Read

      public Read()
  • Method Details

    • withHosts

      public CassandraIO.Read<T> withHosts(List<String> hosts)
      Specify the hosts of the Apache Cassandra instances.
    • withHosts

      public CassandraIO.Read<T> withHosts(ValueProvider<List<String>> hosts)
      Specify the hosts of the Apache Cassandra instances.
    • withPort

      public CassandraIO.Read<T> withPort(int port)
      Specify the port number of the Apache Cassandra instances.
    • withPort

      public CassandraIO.Read<T> withPort(ValueProvider<Integer> port)
      Specify the port number of the Apache Cassandra instances.
    • withKeyspace

      public CassandraIO.Read<T> withKeyspace(String keyspace)
      Specify the Cassandra keyspace where to read data.
    • withKeyspace

      public CassandraIO.Read<T> withKeyspace(ValueProvider<String> keyspace)
      Specify the Cassandra keyspace where to read data.
    • withTable

      public CassandraIO.Read<T> withTable(String table)
      Specify the Cassandra table where to read data.
    • withTable

      public CassandraIO.Read<T> withTable(ValueProvider<String> table)
      Specify the Cassandra table where to read data.
    • withQuery

      public CassandraIO.Read<T> withQuery(String query)
      Specify the query to read data.
    • withQuery

      public CassandraIO.Read<T> withQuery(ValueProvider<String> query)
      Specify the query to read data.
    • withEntity

      public CassandraIO.Read<T> withEntity(Class<T> entity)
      Specify the entity class (annotated POJO). The CassandraIO will read the data and convert the data as entity instances. The PCollection resulting from the read will contains entity elements.
    • withCoder

      public CassandraIO.Read<T> withCoder(Coder<T> coder)
      Specify the Coder used to serialize the entity in the PCollection.
    • withUsername

      public CassandraIO.Read<T> withUsername(String username)
      Specify the username for authentication.
    • withUsername

      public CassandraIO.Read<T> withUsername(ValueProvider<String> username)
      Specify the username for authentication.
    • withPassword

      public CassandraIO.Read<T> withPassword(String password)
      Specify the password used for authentication.
    • withPassword

      public CassandraIO.Read<T> withPassword(ValueProvider<String> password)
      Specify the password used for authentication.
    • withLocalDc

      public CassandraIO.Read<T> withLocalDc(String localDc)
      Specify the local DC used for the load balancing.
    • withLocalDc

      public CassandraIO.Read<T> withLocalDc(ValueProvider<String> localDc)
      Specify the local DC used for the load balancing.
    • withConsistencyLevel

      public CassandraIO.Read<T> withConsistencyLevel(String consistencyLevel)
      Specify the consistency level for the request (e.g. ONE, LOCAL_ONE, LOCAL_QUORUM, etc).
    • withConsistencyLevel

      public CassandraIO.Read<T> withConsistencyLevel(ValueProvider<String> consistencyLevel)
      Specify the consistency level for the request (e.g. ONE, LOCAL_ONE, LOCAL_QUORUM, etc).
    • withMinNumberOfSplits

      public CassandraIO.Read<T> withMinNumberOfSplits(Integer minNumberOfSplits)
      It's possible that system.size_estimates isn't populated or that the number of splits computed by Beam is still to low for Cassandra to handle it. This setting allows to enforce a minimum number of splits in case Beam cannot compute it correctly.
    • withMinNumberOfSplits

      public CassandraIO.Read<T> withMinNumberOfSplits(ValueProvider<Integer> minNumberOfSplits)
      It's possible that system.size_estimates isn't populated or that the number of splits computed by Beam is still to low for Cassandra to handle it. This setting allows to enforce a minimum number of splits in case Beam cannot compute it correctly.
    • withConnectTimeout

      public CassandraIO.Read<T> withConnectTimeout(Integer timeout)
      Specify the Cassandra client connect timeout in ms. See https://docs.datastax.com/en/drivers/java/3.8/com/datastax/driver/core/SocketOptions.html#setConnectTimeoutMillis-int-
    • withConnectTimeout

      public CassandraIO.Read<T> withConnectTimeout(ValueProvider<Integer> timeout)
      Specify the Cassandra client connect timeout in ms. See https://docs.datastax.com/en/drivers/java/3.8/com/datastax/driver/core/SocketOptions.html#setConnectTimeoutMillis-int-
    • withReadTimeout

      public CassandraIO.Read<T> withReadTimeout(Integer timeout)
      Specify the Cassandra client read timeout in ms. See https://docs.datastax.com/en/drivers/java/3.8/com/datastax/driver/core/SocketOptions.html#setReadTimeoutMillis-int-
    • withReadTimeout

      public CassandraIO.Read<T> withReadTimeout(ValueProvider<Integer> timeout)
      Specify the Cassandra client read timeout in ms. See https://docs.datastax.com/en/drivers/java/3.8/com/datastax/driver/core/SocketOptions.html#setReadTimeoutMillis-int-
    • withMapperFactoryFn

      public CassandraIO.Read<T> withMapperFactoryFn(SerializableFunction<Session,Mapper> mapperFactory)
      A factory to create a specific Mapper for a given Cassandra Session. This is useful to provide mappers that don't rely in Cassandra annotated objects.
    • withRingRanges

      public CassandraIO.Read<T> withRingRanges(Set<RingRange> ringRange)
    • withRingRanges

      public CassandraIO.Read<T> withRingRanges(ValueProvider<Set<RingRange>> ringRange)
    • withSsl

      public CassandraIO.Read<T> withSsl(SSLOptions sslOptions)
      Optionally, specify SSLOptions configuration to utilize SSL. See https://docs.datastax.com/en/developer/java-driver/3.11/manual/ssl/#jsse-programmatic
    • withSsl

      public CassandraIO.Read<T> withSsl(ValueProvider<SSLOptions> sslOptions)
      Optionally, specify SSLOptions configuration to utilize SSL. See https://docs.datastax.com/en/developer/java-driver/3.11/manual/ssl/#jsse-programmatic
    • expand

      public PCollection<T> expand(PBegin input)
      Description copied from class: PTransform
      Override this method to specify how this PTransform should be expanded on the given InputT.

      NOTE: This method should not be called directly. Instead apply the PTransform should be applied to the InputT using the apply method.

      Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).

      Specified by:
      expand in class PTransform<PBegin,PCollection<T>>