def groupByKey(self, numPartitions=None, partitionFunc=portable_hash):
        def createCombiner(x):
            return [x]
        def mergeValue(xs, x):
            xs.append(x)
            return xs
        def mergeCombiners(a, b):
            a.extend(b)
            return a
        memory = self._memory_limit()
        serializer = self._jrdd_deserializer
        agg = Aggregator(createCombiner, mergeValue, mergeCombiners)
        def combine(iterator):
            merger = ExternalMerger(agg, memory * 0.9, serializer)
            merger.mergeValues(iterator)
            return merger.items()
        locally_combined = self.mapPartitions(combine, preservesPartitioning=True)
        shuffled = locally_combined.partitionBy(numPartitions, partitionFunc)
        def groupByKey(it):
            merger = ExternalGroupBy(agg, memory, serializer)
            merger.mergeCombiners(it)
            return merger.items()
        return shuffled.mapPartitions(groupByKey, True).mapValues(ResultIterable)