code: def test_medium_dataset(self):
      # SPARK-39179: Test external group by for medium dataset
      m = ExternalGroupBy(self.agg, 5, partitions=3)
      m.mergeValues(self.data)
      self.assertTrue(m.spills >= 1)
      self.assertEqual(
          sum(sum(v) for k, v in m.items()), 2 * sum(range(self.N))
      )
  
imports: import random
  import unittest
  import tempfile
  import os
  from py4j.protocol import Py4JJavaError
  from pyspark import shuffle, CPickleSerializer, SparkConf, SparkContext
  from pyspark.shuffle import Aggregator, ExternalMerger, ExternalSorter, SimpleAggregator, Merger, ExternalGroupBy
label_desc: Use image node_id 2 for calling the ExternalGroupByTests obj's underlying member method code with example usage: obj.test_medium_dataset() without return types