매퍼마다 얻을 수있는 행 수를 제한하려고합니다. 내 코드는 다음과 같이 간다 : 샘플의 마지막 줄에서NLineInputFormat에 hadoop 입력 형식을 설정하는 방법은 무엇입니까?
package com.iathao.mapreduce;
import java.io.IOException;
import java.net.MalformedURLException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.lib.NLineInputFormat;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.regexp.RESyntaxException;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
public class Main {
public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException, RESyntaxException {
try {
if (args.length != 2) {
System.err.println("Usage: NewMaxTemperature <input path> <output path>");
System.exit(-1);
}
Job job = new Job();
job.setJarByClass(Main.class);
job.getConfiguration().set("mapred.max.map.failures.percent", "100");
// job.getConfiguration().set("mapred.map.max.attempts", "10");
//NLineInputFormat. .setNumLinesPerSplit(job, 1);
job.setInputFormatClass(NLineInputFormat.class);
(job.setInputFormatClass (NLineInputFormat.class)) 나는 다음과 같은 오류 얻을 :
The method setInputFormatClass(Class<? extends InputFormat>) in the type Job is not applicable for the arguments (Class<NLineInputFormat>)
는 어떻게 든 잘못을 받으셨어요을 NLineInputFormat 클래스?
사실 실제로 NLineInputFormat은 hadoop 0.20의 새 API에 구현되지 않았습니다. 불운 한 것보다 오래된 API를 사용하려고합니다. –
0.21에 새로운 API가 있지만 안정 버전이 아닙니다. trunk 또는 0.23 분기에서 코드를 다운로드하여 Linux 컴퓨터에 빌드 할 수도 있습니다. 트렁크 또는 0.23 분기에서 코드를 가져 오는 것은 많은 새로운 기능에 대한 액세스를 제공합니다. 그러나 트렁크 나 0.23 지점은 계속 변화하고 안정된 상태가 아닙니다. –