code: public <K> CassandraJavaPairRDD<K, R> keyAndApplyPartitionerFrom(
              RowReaderFactory<K> rrf,
              RowWriterFactory<K> rwf,
              Class<K> keyClass,
              CassandraJavaPairRDD<K, ?> otherRDD) {
  
          ClassTag<K> keyClassTag = JavaApiHelper.getClassTag(keyClass);
  
          CassandraRDD<Tuple2<K, R>> newRDD =  this.rdd()
              .keyBy(keyClassTag, rrf, rwf)
              .withPartitioner(otherRDD.rdd().partitioner());
  
          return new CassandraJavaPairRDD<>(newRDD, keyClassTag, classTag());
      }
docs: Builds a K/V Pair RDD using the partitioner from an existing
  CassandraTableScanPairRDD. Since we cannot determine ahead of time
  the type of the PairRDD or the type of it's partitioner this method will
  throw exceptions if the Partitioner is not a CassandraPartitioner at
  runtime.