iemejia commented on a change in pull request #10546:
URL: https://github.com/apache/beam/pull/10546#discussion_r416976043



##########
File path: 
sdks/java/io/cassandra/src/main/java/org/apache/beam/sdk/io/cassandra/CassandraIO.java
##########
@@ -391,36 +393,57 @@ static Cluster getCluster(
                 .withSplitCount(splitCount)
                 .withMapperFactoryFn(this.mapperFactoryFn());
 
-        if (isMurmur3Partitioner(cluster)) {
-          LOG.info("Murmur3Partitioner detected, splitting");
-
-          List<BigInteger> tokens =
-              cluster.getMetadata().getTokenRanges().stream()
-                  .map(tokenRange -> new 
BigInteger(tokenRange.getEnd().getValue().toString()))
-                  .collect(Collectors.toList());
-
-          SplitGenerator splitGenerator =
-              new SplitGenerator(cluster.getMetadata().getPartitioner());
-
-          List<Read<T>> splits =
-              splitGenerator.generateSplits(splitCount, tokens).stream()
-                  .map(rr -> CassandraIO.<T>read().withRingRange(rr))
-                  .collect(Collectors.toList());
+        return input
+            .apply(Create.of(this))
+            .apply(ParDo.of(new SplitFn<T>()))
+            .setCoder(SerializableCoder.of(new TypeDescriptor<Read<T>>() {}))
+            .apply(Reshuffle.viaRandomKey())
+            .apply(readAll);

Review comment:
       Now we need to tackle this in two parts maybe, one is to implement the 
read with a `ReadFn` like method  and as a next step to get rid of all the 
methods on `ReadAll` to simplify it to its core.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to