если у меня есть класс Main, я хочу прочитать регистры таблицы de Hbase, как настроить класс Job, что такое InputFormat? в job.setInputFormatClass и какие типы значений в Map (ключ / значение)
открытый класс Main расширяет инструмент Configuracion и реализует инструмент {
Path pathEntrada;
Path pathSalida;
SystemaFds fs;
Job job;
public Main() throws IOException {
super();
fs=new SystemaFds();
}
public static void main(String[] args) throws Exception {
int res=ToolRunner.run(new Main(), args);
System.exit(res);
}
@Override
public Configuration getConf() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setConf(Configuration arg0) {
// TODO Auto-generated method stub
}
@Override
public int run(String[] arg) throws Exception {
String archivoEntrada="input/parrafos.txt";
String archivoSalida="output/parrafos.txt";
job=new Job(this.conf,"EquilibradoCargas");
job.setInputFormatClass(TextInputFormat.class);
job.setJarByClass(Main.class);
job.setMapperClass(Map.class);
job.setReducerClass(Reduce.class);
this.pathEntrada=new Path(archivoEntrada); InputFormatPersonalizado.addInputPath(job,this.pathEntrada);
this.pathSalida=new Path(archivoSalida);
if (this.fs.existeArchivo(archivoSalida))
{
this.fs.borrarArchivo(archivoSalida);
}
TextOutputFormat.setOutputPath(job,this.pathSalida);
and what are the types of values in Map (key / value)
job.setOutputFormatClass(TextOutputFormat.class);
//Especificamos los tipos de datos para clave/valor
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setJobName("Parrafos");
boolean ejecutar=job.waitForCompletion(true);
if (ejecutar)
{
return 0;
}
else
{
return 1;
}
}
}
открытый класс Карта расширяет Mapper {
private final static IntWritable one=new IntWritable(1);
private Text word= new Text();
public void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
}
}
публичный класс Reduce extends Reducer {
public Reduce() {
}
//Vamos a sobreEscribir el metodo reduce
public void reduce(Text key, Iterable<IntWritable> val, Context context) throws IOException, InterruptedException
{
}
}