gpt4 book ai didi

Hadoop 2.2 MapFile 创建失败

转载 作者:行者123 更新时间:2023-12-02 20:07:39 25 4
gpt4 key购买 nike

我使用 Hadoop 2.2
我的代码创建了一个 MapFile 编写器,如下所示

Configuration conf = new Configuration();  
Path path = new Path(filename);
writer = new MapFile.Writer(conf,path,
SequenceFile.Writer.keyClass(key.getClass()),
SequenceFile.Writer.valueClass(value.getClass()),
SequenceFile.Writer.compression(SequenceFile.CompressionType.NONE));

我的关键类声明如下
public class ReportingKeyWritable extends BinaryComparable implements
WritableComparable<BinaryComparable> {

值类声明如下
public class ReportingValueWritable implements Writable

构造函数失败,出现以下异常
java.lang.IllegalArgumentException: key class or comparator option must be set
at org.apache.hadoop.io.MapFile$Writer.<init>(MapFile.java:246)
at DataLoader.main(DataLoader.java:66)

最佳答案

它会正常工作:

writer = new MapFile.Writer(conf,path,  
MapFile.Writer.keyClass(key.getClass()),
MapFile.Writer.valueClass(value.getClass()),
MapFile.Writer.compression(SequenceFile.CompressionType.NONE));

关于Hadoop 2.2 MapFile 创建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21009401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com