編寫示例代碼以測試hadoop中的customdata。我收到以下錯誤:IntWritable.set(IntWritable)拋出錯誤
The method set(int) in the type IntWritable is not applicable for the arguments (IntWritable)
我已經檢查了set
方法IntWritable.set(int value)
。 如何將hadoop IntWritable
轉換爲Int
,然後返回IntWritable#set
方法將轉換回IntWritable
。
public class customText implements Writable{
private Text depName;
//default constr
private IntWritable depId;
customText(){
this.depName = new Text();
this.depId = new IntWritable();
}
customText(Text depName , IntWritable depId){
this.depName.set(depName);
this.depId.set(depId);
我也試過this.depid=depId
但它沒有奏效。
感謝
['IntWritable.get()'](https://hadoop.apache.org/docs/r2.6.2/api/org/apache/hadoop/io/IntWritable.html#get())?真的,你應該在發佈問題之前總是查閱文檔。 – Seelenvirtuose