code: public List<DeepTokenRange> getRanges() {
          try {
  
              List<TokenRange> tokenRanges;
              ThriftClient client = ThriftClient.build(host, rpcPort);
              try {
                  tokenRanges = client.describe_local_ring(keyspace);
              } catch (TApplicationException e) {
                  if (e.getType() == TApplicationException.UNKNOWN_METHOD) {
                      tokenRanges = client.describe_ring(keyspace);
                  } else {
                      throw new DeepGenericException("Unknown server error", e);
                  }
              }
              client.close();
  
              List<DeepTokenRange> deepTokenRanges = new ArrayList<>(tokenRanges.size());
              for (TokenRange tokenRange : tokenRanges) {
                  Comparable start = tokenAsComparable(tokenRange.getStart_token());
                  Comparable end = tokenAsComparable(tokenRange.getEnd_token());
                  deepTokenRanges.add(new DeepTokenRange(start, end, tokenRange.getEndpoints()));
              }
  
              return deepTokenRanges;
          } catch (TException e) {
              throw new DeepGenericException("No available replicas for get ring token ranges", e);
          }
      }
docs: Returns the token ranges of the Cassandra ring that will be mapped to Spark partitions.
  The returned ranges are the Cassandra's physical ones, without any splitting.
  
  @return the list of Cassandra ring token ranges.