【发布时间】:2017-10-30 19:43:10
【问题描述】:
您能否建议解决在运行 MapReduce 时出现在 FixedInputFormat 中的错误:Partial record found at the end of split
我正在分析为 Hive 自定义 FileInputFormat,并且正在研究来自以下 github 的 FixedInputFormat:
https://github.com/apache/hadoop/tree/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input
我复制了FixedInputFormat 和FixedRecordReader,并创建了一个映射器和驱动程序来测试它(0 个减速器)。
在 Mapper 中调用这个 FixedInputFormat 如下:
Configuration conf = new Configuration(true);
conf.set("fs.default.name", "file:///");
conf.setInt("fixedlengthinputformat.record.length",50);
job.setInputFormatClass(FixedLengthInputFormat.class);
数据文件如下(用3条记录测试):
000yyy022222222xxxxxxx 11111
splitsize 计算为 152 而不是 150,我收到以下错误:
java.lang.Exception: java.io.IOException: Partial record(length = 2) 在拆分结束时找到。 INFO customFixed.FixedLengthRecordReader:在拆分中期望 4 条记录,每条记录的长度为 50 字节,有效大小为 152 字节
我正在 Windows 中从 Intellij 运行它以进行分析。
这种方法有什么问题吗? 您能否建议解决此错误,我将不胜感激。
谢谢。
【问题讨论】: