Class ArrowRecordBatch

java.lang.Object
org.apache.arrow.vector.ipc.message.ArrowRecordBatch
All Implemented Interfaces:
AutoCloseable, ArrowMessage, FBSerializable

public class ArrowRecordBatch extends Object implements ArrowMessage
POJO representation of a RecordBatch IPC message (https://arrow.apache.org/docs/format/Columnar.html#recordbatch-message).
  • Constructor Details

    • ArrowRecordBatch

      public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers)
    • ArrowRecordBatch

      public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression)
    • ArrowRecordBatch

      public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, boolean alignBuffers)
      Construct a record batch from nodes.
      Parameters:
      length - how many rows in this batch
      nodes - field level info
      buffers - will be retained until this recordBatch is closed
      bodyCompression - compression info.
      alignBuffers - Whether to align buffers to an 8 byte boundary.
    • ArrowRecordBatch

      public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, boolean alignBuffers, boolean retainBuffers)
      Construct a record batch from nodes.
      Parameters:
      length - how many rows in this batch
      nodes - field level info
      buffers - will be retained until this recordBatch is closed
      bodyCompression - compression info.
      alignBuffers - Whether to align buffers to an 8 byte boundary.
      retainBuffers - Whether to retain() each source buffer in the constructor. If false, the caller is responsible for retaining the buffers beforehand.
  • Method Details

    • getMessageType

      public byte getMessageType()
      Description copied from interface: ArrowMessage
      Returns the flatbuffer enum value indicating the type of the message.
      Specified by:
      getMessageType in interface ArrowMessage
    • getLength

      public int getLength()
    • getBodyCompression

      public ArrowBodyCompression getBodyCompression()
    • getNodes

      public List<ArrowFieldNode> getNodes()
      Get the nodes in this record batch.
      Returns:
      the FieldNodes corresponding to the schema
    • getBuffers

      public List<ArrowBuf> getBuffers()
      Get the record batch buffers.
      Returns:
      the buffers containing the data
    • cloneWithTransfer

      public ArrowRecordBatch cloneWithTransfer(BufferAllocator allocator)
      Create a new ArrowRecordBatch which has the same information as this batch but whose buffers are owned by that Allocator.

      This will also close this record batch and make it no longer useful.

      Returns:
      A cloned ArrowRecordBatch
    • getBuffersLayout

      public List<ArrowBuffer> getBuffersLayout()
      Get the serialized layout.
      Returns:
      the serialized layout if we send the buffers on the wire
    • writeTo

      public int writeTo(com.google.flatbuffers.FlatBufferBuilder builder)
      Description copied from interface: FBSerializable
      Returns the number of bytes taken to serialize the data in builder after writing to it.
      Specified by:
      writeTo in interface FBSerializable
    • accepts

      public <T> T accepts(ArrowMessage.ArrowMessageVisitor<T> visitor)
      Specified by:
      accepts in interface ArrowMessage
    • close

      public void close()
      Releases the buffers.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • computeBodyLength

      public long computeBodyLength()
      Computes the size of the serialized body for this recordBatch.
      Specified by:
      computeBodyLength in interface ArrowMessage