public virtual void TestPipesPartitioner() { PipesPartitioner <IntWritable, Text> partitioner = new PipesPartitioner <IntWritable , Text>(); JobConf configuration = new JobConf(); Submitter.GetJavaPartitioner(configuration); partitioner.Configure(new JobConf()); IntWritable iw = new IntWritable(4); // the cache empty NUnit.Framework.Assert.AreEqual(0, partitioner.GetPartition(iw, new Text("test"), 2)); // set data into cache PipesPartitioner.SetNextPartition(3); // get data from cache NUnit.Framework.Assert.AreEqual(3, partitioner.GetPartition(iw, new Text("test"), 2)); }
/// <summary>The task output a record with a partition number attached.</summary> /// <exception cref="System.IO.IOException"/> public virtual void PartitionedOutput(int reduce, K key, V value) { PipesPartitioner.SetNextPartition(reduce); collector.Collect(key, value); }