public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, recordCount_); } for (int i = 0; i < field_.size(); i++) { output.writeMessage(2, field_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBool(3, carriesTwoByteSelectionVector_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(4, affectedRowsCount_); } getUnknownFields().writeTo(output); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, recordCount_); } for (int i = 0; i < field_.size(); i++) { output.writeMessage(2, field_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBool(3, carriesTwoByteSelectionVector_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(4, affectedRowsCount_); } getUnknownFields().writeTo(output); }
public int write(WritableBatch batch, SelectionVector2 sv2) throws IOException { checkNotNull(batch); checkNotNull(channel); final Timer.Context timerContext = metrics.timer(WRITER_TIMER).time(); final DrillBuf[] incomingBuffers = batch.getBuffers(); final UserBitShared.RecordBatchDef batchDef = batch.getDef(); int bytesWritten = batchDef.getSerializedSize(); /* Write the metadata to the file */ batchDef.writeDelimitedTo(output); /* If we have a selection vector, dump it to file first */ if (sv2 != null) { final int dataLength = sv2.getCount() * SelectionVector2.RECORD_SIZE; ByteBuffer buffer = sv2.getBuffer(false).nioBuffer(0, dataLength); while (buffer.remaining() > 0) { bytesWritten += channel.write(buffer); } } /* Dump the array of ByteBuf's associated with the value vectors */ for (DrillBuf buf : incomingBuffers) { /* dump the buffer into the OutputStream */ ByteBuffer buffer = buf.nioBuffer(); while (buffer.remaining() > 0) { bytesWritten += channel.write(buffer); } } timeNs += timerContext.stop(); this.bytesWritten += bytesWritten; return bytesWritten; }