2013-10-24 32 views
0

我正在寫一個減速器,每個鍵的值可能非常大(大於long值的範圍)。我計劃使用BigInteger作爲值的類型,我注意到在豬中定義了一個類BigIntegerWritable。但是,我使用庫pig-0.11.0.jarpig-0.11.0-withouthadoop.jar進行編譯。它找不到BigIntegerWritable如何在Reducer中導入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 

回答

1

我相當肯定BigIntegerWritable豬0.12成爲東西看到here。所以你需要這個版本。即使如此,我認爲在這裏包括豬隻是爲了獲得一個課程來幫助你的減速機是不合適的。

我認爲你最好寫自己的BigIntegerWritable。這不會太難,因爲它已經有方法去往和從byte[]。只需使用IntWritable作爲模型。