expect(recordWriterFactory.create(eq(writerSchema), anyObject(GenericData.class),
/** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public RecordWriter<AvroKey<T>, NullWritable> getRecordWriter(TaskAttemptContext context) throws IOException { Configuration conf = context.getConfiguration(); // Get the writer schema. Schema writerSchema = AvroJob.getOutputKeySchema(conf); boolean isMapOnly = context.getNumReduceTasks() == 0; if (isMapOnly) { Schema mapOutputSchema = AvroJob.getMapOutputKeySchema(conf); if (mapOutputSchema != null) { writerSchema = mapOutputSchema; } } if (null == writerSchema) { throw new IOException( "AvroKeyOutputFormat requires an output schema. Use AvroJob.setOutputKeySchema()."); } GenericData dataModel = AvroSerialization.createDataModel(conf); return mRecordWriterFactory.create (writerSchema, dataModel, getCompressionCodec(context), getAvroFileOutputStream(context), getSyncInterval(context)); } }
/** * Constructor. */ public AvroKeyOutputFormat() { this(new RecordWriterFactory()); }
return mRecordWriterFactory.create (writerSchema, dataModel, getCompressionCodec(context), out, getSyncInterval(context));
/** * Constructor. */ public AvroKeyOutputFormat() { this(new RecordWriterFactory()); }