public void write(TetherData datum, NullWritable ignore) throws IOException { writer.appendEncoded(datum.buffer()); } public void close(Reporter reporter) throws IOException {
@Override public void write(Event event) throws IOException { if (dataFileWriter == null) { initialize(event); } dataFileWriter.appendEncoded(ByteBuffer.wrap(event.getBody())); }
public void write(TetherData datum, NullWritable ignore) throws IOException { writer.appendEncoded(datum.buffer()); } public void close(Reporter reporter) throws IOException {
@Override public boolean write(List<ByteBuffer> batch) { try { for (ByteBuffer byteBuffer : batch) { if (numWrites++ % 1000 == 0) { logger.debug("Written {} elements", numWrites); } writer.appendEncoded(byteBuffer); } } catch (IOException e) { throw new UncheckedIOException(e); } logger.debug("[" + Thread.currentThread().getName() + "] Written " + batch.size()); return true; }
public void write(TetherData datum, NullWritable ignore) throws IOException { writer.appendEncoded(datum.buffer()); } public void close(Reporter reporter) throws IOException {
@Override public boolean write(List<ByteBuffer> batch) { for (ByteBuffer byteBuffer : batch) { if (numWrites++ % 1000 == 0) { logger.debug("Written {} elements", numWrites); } try { writer.appendEncoded(byteBuffer); } catch (IOException e) { e.printStackTrace(); return false; } } logger.debug("[" + Thread.currentThread().getName() + "] Written " + batch.size()); return true; }
@Override public void write(Event event) throws IOException { if (dataFileWriter == null) { initialize(event); } dataFileWriter.appendEncoded(ByteBuffer.wrap(event.getBody())); }
void append(ILoggingEvent event) throws IOException { // If the event is already a LoggingEvent, we don't need to re-encode. if (event instanceof LoggingEvent) { ByteBuffer encoded = ((LoggingEvent) event).getEncoded(); if (encoded != null) { // TODO: CDAP-8735 Remove the copying after upgraded to Avro 1.7.4+ dataFileWriter.appendEncoded(ByteBuffers.copy(encoded)); } else { dataFileWriter.append(((LoggingEvent) event).getRecord()); } return; } dataFileWriter.append(serializer.toGenericRecord(event)); }
void append(ILoggingEvent event) throws IOException { // If the event is already a LoggingEvent, we don't need to re-encode. if (event instanceof LoggingEvent) { ByteBuffer encoded = ((LoggingEvent) event).getEncoded(); if (encoded != null) { // TODO: CDAP-8735 Remove the copying after upgraded to Avro 1.7.4+ dataFileWriter.appendEncoded(ByteBuffers.copy(encoded)); } else { dataFileWriter.append(((LoggingEvent) event).getRecord()); } return; } dataFileWriter.append(serializer.toGenericRecord(event)); }