'_partition.lst'不存在错误

时间:2012-10-23 09:19:30

标签: hadoop partitioning

我尝试使用'RandomSampler'来分区映射器结果。这是相关的代码:

JobConf conf = new JobConf(SortExample.class);
conf.setJobName("sortexample");
...
conf.setPartitionerClass(TotalOrderPartitioner.class);
InputSampler.Sampler<IntWritable, Text> sampler =
    new InputSampler.RandomSampler<IntWritable, Text>(0.1, 100);
InputSampler.writePartitionFile(conf, sampler); 
conf.setNumReduceTasks(2);

根据我的理解,采样器将写入一个文件,默认情况下,_patition.lst描述作业将自动用于决定将哪些键/值对发送到哪个reducer的分区。 但运行后,我收到以下错误:

ava.lang.RuntimeException: Error in configuring object
        at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:93)
        at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:64)
        at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:117)
        at org.apache.hadoop.mapred.MapTask$OldOutputCollector.<init>(MapTask.java:574)
        at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:436)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:372)
        at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1083)
        at org.apache.hadoop.mapred.Child.main(Child.java:249)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:88)
        ... 10 more
Caused by: java.lang.IllegalArgumentException: Can't read partitions file
        at org.apache.hadoop.mapred.lib.TotalOrderPartitioner.configure(TotalOrderPartitioner.java:91)
        ... 15 more
Caused by: java.io.FileNotFoundException: File _partition.lst does not exist.

我不知道文件'_partition.lst'在哪里?这里肯定有一些误解,我感谢任何帮助〜

1 个答案:

答案 0 :(得分:0)

我认为你需要在其中一个InputSample内部类上调用getSample()。这就是通过InputFormat读取文件并实际确定哪些拆分应该放入_partition.lst文件的内容。