@SuppressWarnings("rawtypes") private AvroCollector getCollector(String namedOutput, Reporter reporter, Schema schema) throws IOException{ return getCollector(namedOutput,null,reporter,namedOutput,schema); }
@SuppressWarnings("rawtypes") private AvroCollector getCollector(String namedOutput,Schema schema, Reporter reporter, String baseFileName) throws IOException{ //namedOutputs.add(baseFileName); return getCollector(namedOutput,null,reporter,baseFileName,schema); }
/** * Gets the output collector for a named output. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @return the output collector for the given named output * @throws IOException thrown if output collector could not be created * @deprecated Use {@link #collect} method for collecting output */ @SuppressWarnings({"unchecked", "rawtypes"}) public AvroCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter,namedOutput,null); }
/** * Gets the output collector for a named output. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param multiName the multiname * @return the output collector for the given named output * @throws IOException thrown if output collector could not be created */ @SuppressWarnings("rawtypes") public AvroCollector getCollector(String namedOutput,String multiName, Reporter reporter) throws IOException{ return getCollector(namedOutput,multiName,reporter,namedOutput,null); }
/** * Output Collector for the default schema. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param datum output data * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput, Reporter reporter,Object datum) throws IOException{ getCollector(namedOutput,reporter).collect(datum); }
/** * OutputCollector with custom schema. * <p/> * * @param namedOutput the named output name (this will the output file name) * @param reporter the reporter * @param datum output data * @param schema schema to use for this output * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput, Reporter reporter, Schema schema,Object datum) throws IOException{ getCollector(namedOutput,reporter,schema).collect(datum); }
/** * OutputCollector with custom schema and file name. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param baseOutputPath outputfile name to use. * @param datum output data * @param schema schema to use for this output * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput,Reporter reporter,Schema schema,Object datum,String baseOutputPath) throws IOException{ getCollector(namedOutput,null,reporter,baseOutputPath,schema).collect(datum); }
@Override public void map(Utf8 text, AvroCollector<Pair<Utf8, Long>> collector, Reporter reporter) throws IOException { StringTokenizer tokens = new StringTokenizer(text.toString()); while (tokens.hasMoreTokens()) { String tok = tokens.nextToken(); collector.collect(new Pair<>(new Utf8(tok), 1L)); amos.getCollector("myavro2", reporter).collect(new Pair<Utf8, Long>(new Utf8(tok), 1L).toString()); } }
@Override public void reduce(Utf8 word, Iterable<Long> counts, AvroCollector<Pair<Utf8, Long>> collector, Reporter reporter) throws IOException { long sum = 0; for (long count : counts) sum += count; Pair<Utf8, Long> outputvalue = new Pair<>(word, sum); amos.getCollector("myavro", reporter).collect(outputvalue); amos.collect("myavro1", reporter, outputvalue.toString()); amos.collect("myavro", reporter, new Pair<Utf8, Long>(new Utf8(""), 0L).getSchema(), outputvalue, "testavrofile"); amos.collect("myavro", reporter, Schema.create(Schema.Type.STRING), outputvalue.toString(), "testavrofile1"); collector.collect(new Pair<>(word, sum)); }
@SuppressWarnings("rawtypes") private AvroCollector getCollector(String namedOutput,Schema schema, Reporter reporter, String baseFileName) throws IOException{ //namedOutputs.add(baseFileName); return getCollector(namedOutput,null,reporter,baseFileName,schema); }
@SuppressWarnings("rawtypes") private AvroCollector getCollector(String namedOutput, Reporter reporter, Schema schema) throws IOException{ return getCollector(namedOutput,null,reporter,namedOutput,schema); }
/** * Gets the output collector for a named output. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param multiName the multiname * @return the output collector for the given named output * @throws IOException thrown if output collector could not be created */ @SuppressWarnings("rawtypes") public AvroCollector getCollector(String namedOutput,String multiName, Reporter reporter) throws IOException{ return getCollector(namedOutput,multiName,reporter,namedOutput,null); }
/** * Gets the output collector for a named output. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @return the output collector for the given named output * @throws IOException thrown if output collector could not be created * @deprecated Use {@link #collect} method for collecting output */ @SuppressWarnings({"unchecked", "rawtypes"}) public AvroCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter,namedOutput,null); }
/** * Output Collector for the default schema. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param datum output data * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput, Reporter reporter,Object datum) throws IOException{ getCollector(namedOutput,reporter).collect(datum); }
/** * OutputCollector with custom schema. * <p/> * * @param namedOutput the named output name (this will the output file name) * @param reporter the reporter * @param datum output data * @param schema schema to use for this output * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput, Reporter reporter, Schema schema,Object datum) throws IOException{ getCollector(namedOutput,reporter,schema).collect(datum); }
/** * OutputCollector with custom schema and file name. * <p/> * * @param namedOutput the named output name * @param reporter the reporter * @param baseOutputPath outputfile name to use. * @param datum output data * @param schema schema to use for this output * @throws IOException thrown if output collector could not be created */ public void collect(String namedOutput,Reporter reporter,Schema schema,Object datum,String baseOutputPath) throws IOException{ getCollector(namedOutput,null,reporter,baseOutputPath,schema).collect(datum); }