def partition_by(num_partitions, partition_func=nil)
      num_partitions ||= default_reduce_partitions
      partition_func ||= 'lambda{|x| Spark::Digest.portable_hash(x.to_s)}'

      _partition_by(num_partitions, Spark::Command::PartitionBy::Basic, partition_func)
    end
def partition_by(num_partitions, partition_func=nil)
      num_partitions ||= default_reduce_partitions
      partition_func ||= 'lambda{|x| Spark::Digest.portable_hash(x.to_s)}'

      _partition_by(num_partitions, Spark::Command::PartitionBy::Basic, partition_func)
    end
Return a copy of the RDD partitioned using the specified partitioner.

 == Example:
   rdd = $sc.parallelize(["1","2","3","4","5"]).map(lambda {|x| [x, 1]})
   rdd.partitionBy(2).glom.collect
   # => [[["3", 1], ["4", 1]], [["1", 1], ["2", 1], ["5", 1]]]