Class ArrowRecordBatch
java.lang.Object
org.apache.arrow.vector.ipc.message.ArrowRecordBatch
- All Implemented Interfaces:
AutoCloseable
,ArrowMessage
,FBSerializable
POJO representation of a RecordBatch IPC message
(https://arrow.apache.org/docs/format/Columnar.html#recordbatch-message).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.arrow.vector.ipc.message.ArrowMessage
ArrowMessage.ArrowMessageVisitor<T>
-
Constructor Summary
ConstructorDescriptionArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers) ArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression) ArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, boolean alignBuffers) Construct a record batch from nodes.ArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, boolean alignBuffers, boolean retainBuffers) Construct a record batch from nodes.ArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, List<Long> variadicBufferCounts, boolean alignBuffers) Construct a record batch from nodes.ArrowRecordBatch
(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, List<Long> variadicBufferCounts, boolean alignBuffers, boolean retainBuffers) Construct a record batch from nodes. -
Method Summary
Modifier and TypeMethodDescription<T> T
accepts
(ArrowMessage.ArrowMessageVisitor<T> visitor) cloneWithTransfer
(BufferAllocator allocator) Create a new ArrowRecordBatch which has the same information as this batch but whose buffers are owned by that Allocator.void
close()
Releases the buffers.long
Computes the size of the serialized body for this recordBatch.Get the record batch buffers.Get the serialized layout.int
byte
Returns the flatbuffer enum value indicating the type of the message.getNodes()
Get the nodes in this record batch.Get the record batch variadic buffer counts.toString()
int
writeTo
(com.google.flatbuffers.FlatBufferBuilder builder) Returns the number of bytes taken to serialize the data in builder after writing to it.
-
Constructor Details
-
ArrowRecordBatch
-
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 batchnodes
- field level infobuffers
- will be retained until this recordBatch is closedbodyCompression
- 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 batchnodes
- field level infobuffers
- will be retained until this recordBatch is closedbodyCompression
- 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.
-
ArrowRecordBatch
public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, List<Long> variadicBufferCounts, boolean alignBuffers) Construct a record batch from nodes.- Parameters:
length
- how many rows in this batchnodes
- field level infobuffers
- will be retained until this recordBatch is closedbodyCompression
- compression info.variadicBufferCounts
- the number of buffers in each variadic section.alignBuffers
- Whether to align buffers to an 8 byte boundary.
-
ArrowRecordBatch
public ArrowRecordBatch(int length, List<ArrowFieldNode> nodes, List<ArrowBuf> buffers, ArrowBodyCompression bodyCompression, List<Long> variadicBufferCounts, boolean alignBuffers, boolean retainBuffers) Construct a record batch from nodes.- Parameters:
length
- how many rows in this batchnodes
- field level infobuffers
- will be retained until this recordBatch is closedbodyCompression
- compression info.variadicBufferCounts
- the number of buffers in each variadic section.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 interfaceArrowMessage
-
getLength
public int getLength() -
getBodyCompression
-
getNodes
Get the nodes in this record batch.- Returns:
- the FieldNodes corresponding to the schema
-
getBuffers
Get the record batch buffers.- Returns:
- the buffers containing the data
-
getVariadicBufferCounts
Get the record batch variadic buffer counts.- Returns:
- the variadic buffer counts
-
cloneWithTransfer
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
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 interfaceFBSerializable
-
accepts
- Specified by:
accepts
in interfaceArrowMessage
-
close
public void close()Releases the buffers.- Specified by:
close
in interfaceAutoCloseable
-
toString
-
computeBodyLength
public long computeBodyLength()Computes the size of the serialized body for this recordBatch.- Specified by:
computeBodyLength
in interfaceArrowMessage
-