0

我正在编写一个减速器,每个键的值可能是非常大的数字(大于long值的范围)。我计划BigInteger用作值的类型,我注意到在 pig 中定义了一个类BigIntegerWritable 。pig-0.11.0.jar不过,我还是用库pig-0.11.0-withouthadoop.jar来编译的。它找不到BigIntegerWritable.

这是我用来编译的命令:

javac -classpath /var/hadoop/hadoop-core-1.0.4.jar:/var/pig/pig-0.11.0.jar wordcount.java wordcountReducer.java wordcountMapper.java

这是错误消息:

wordcountReducer.java:8: error: cannot find symbol
import org.apache.pig.backend.hadoop.BigIntegerWritable;
                                ^
symbol:   class BigIntegerWritable
location: package org.apache.pig.backend.hadoop
wordcountReducer.java:18: error: cannot find symbol
implements Reducer<Text, LongWritable, Text, BigIntegerWritable> {
                                           ^
symbol: class BigIntegerWritable
wordcountReducer.java:21: error: cannot find symbol
OutputCollector<Text, BigIntegerWritable> output, Reporter reporter)
                        ^
symbol:   class BigIntegerWritable
location: class wordcountReducer
wordcountReducer.java:28: error: cannot find symbol
output.collect(key, new BigIntegerWritable(wordNumber));
                        ^
symbol:   class BigIntegerWritable
location: class wordcountReducer
4 errors
4

1 回答 1

1

我相当肯定BigIntegerWritable在 Pig 0.12 中成为了一个东西,如此处所示。所以你需要那个版本。尽管如此,我认为在这里包含 Pig 只是为了获得一个帮助你的减速器的类是不合适的。

我认为您最好自己编写BigIntegerWritable. 这不会太难,因为它已经有了往返的方法byte[]。只是IntWritable用作模型。

于 2013-10-24T04:17:19.360 回答