コード例 #1
0
        public virtual void TestEmptyKey()
        {
            KeyFieldBasedPartitioner <Text, Text> kfbp = new KeyFieldBasedPartitioner <Text, Text
                                                                                       >();
            JobConf conf = new JobConf();

            conf.SetInt("num.key.fields.for.partition", 10);
            kfbp.Configure(conf);
            NUnit.Framework.Assert.AreEqual("Empty key should map to 0th partition", 0, kfbp.
                                            GetPartition(new Text(), new Text(), 10));
        }
コード例 #2
0
        public virtual void TestMultiConfigure()
        {
            KeyFieldBasedPartitioner <Text, Text> kfbp = new KeyFieldBasedPartitioner <Text, Text
                                                                                       >();
            JobConf conf = new JobConf();

            conf.Set(KeyFieldBasedPartitioner.PartitionerOptions, "-k1,1");
            kfbp.SetConf(conf);
            Text key     = new Text("foo\tbar");
            Text val     = new Text("val");
            int  partNum = kfbp.GetPartition(key, val, 4096);

            kfbp.Configure(conf);
            NUnit.Framework.Assert.AreEqual(partNum, kfbp.GetPartition(key, val, 4096));
        }