Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3193#discussion_r20253867
  
    --- Diff: python/pyspark/rdd.py ---
    @@ -316,6 +316,34 @@ def sample(self, withReplacement, fraction, seed=None):
             assert fraction >= 0.0, "Negative fraction value: %s" % fraction
             return self.mapPartitionsWithIndex(RDDSampler(withReplacement, 
fraction, seed).func, True)
     
    +    def randomSplit(self, weights, seed=None):
    +        """
    +        Randomly splits this RDD with the provided weights.
    +
    +        :param weights: weights for splits, will be normalized if they 
don't sum to 1
    +        :param seed: random seed
    +        :return: split RDDs in an list
    +
    +        >>> rdd = sc.parallelize(range(10), 1)
    +        >>> rdd1, rdd2, rdd3 = rdd.randomSplit([0.4, 0.6, 1.0], 11)
    +        >>> rdd1.collect()
    +        [3, 6]
    +        >>> rdd2.collect()
    +        [0, 5, 7]
    +        >>> rdd3.collect()
    +        [1, 2, 4, 8, 9]
    +        """
    +        ser = BatchedSerializer(PickleSerializer(), 1)
    --- End diff --
    
    Though `randomSplit` doesn't care the record type, we have to separate 
individual records. Do we need `BatchedSerializer` here or everything has to be 
batched now? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to