private List<Split> getSplitsForPartitions(CassandraTableHandle cassTableHandle, List<Partition> partitions)
{
String schema = cassTableHandle.getSchemaName();
String table = cassTableHandle.getTableName();
HostAddressFactory hostAddressFactory = new HostAddressFactory();
ImmutableList.Builder<Split> builder = ImmutableList.builder();
for (Partition partition : partitions) {
checkArgument(partition instanceof CassandraPartition, "partitions are no CassandraPartitions");
CassandraPartition cassandraPartition = (CassandraPartition) partition;
Set<Host> hosts = cassandraSession.getReplicas(schema, cassandraPartition.getKeyAsByteBuffer());
List<HostAddress> addresses = hostAddressFactory.toHostAddressList(hosts);
CassandraSplit split = new CassandraSplit(connectorId, schema, table, cassandraPartition.getPartitionId(), null, true, addresses);
builder.add(split);
}
return builder.build();
}