public class RowBasedFrameWriter extends Object implements FrameWriter
FrameType.ROW_BASED.
Row-based frames have two regions: an offset region and data region.
The offset region has one integer per row containing the ending position of each row within the data region.
The data region has each row laid out back to back. Each row has a header section with one int per field, containing
the end position of that field relative to the start of the row. This header is followed by the fields.| Modifier and Type | Field and Description |
|---|---|
static int |
NUM_REGIONS |
static int |
ROW_DATA_REGION |
static int |
ROW_OFFSET_REGION |
| Constructor and Description |
|---|
RowBasedFrameWriter(RowSignature signature,
List<KeyColumn> sortColumns,
List<FieldWriter> fieldWriters,
Supplier<MemoryRange<org.apache.datasketches.memory.Memory>> rowMemorySupplier,
AppendableMemory rowOrderMemory,
AppendableMemory rowOffsetMemory,
AppendableMemory dataMemory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addSelection()
Write the current row to the frame that is under construction, if there is enough space to do so.
|
void |
close() |
int |
getNumRows()
Returns the number of rows written so far.
|
long |
getTotalSize()
Returns the number of bytes that would be written by
FrameWriter.writeTo(org.apache.datasketches.memory.WritableMemory, long) if called now. |
long |
writeTo(org.apache.datasketches.memory.WritableMemory memory,
long startPosition)
Writes the frame to the provided memory location, which must have at least
FrameWriter.getTotalSize() bytes available. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoByteArraypublic static final int ROW_OFFSET_REGION
public static final int ROW_DATA_REGION
public static final int NUM_REGIONS
public RowBasedFrameWriter(RowSignature signature, List<KeyColumn> sortColumns, List<FieldWriter> fieldWriters, @Nullable Supplier<MemoryRange<org.apache.datasketches.memory.Memory>> rowMemorySupplier, @Nullable AppendableMemory rowOrderMemory, AppendableMemory rowOffsetMemory, AppendableMemory dataMemory)
public boolean addSelection()
FrameWriter
If this method returns false on an empty frame, or in a situation where starting a new frame is impractical,
it is conventional (although not required) for the caller to throw FrameRowTooLargeException.
addSelection in interface FrameWriterpublic int getNumRows()
FrameWritergetNumRows in interface FrameWriterpublic long getTotalSize()
FrameWriterFrameWriter.writeTo(org.apache.datasketches.memory.WritableMemory, long) if called now.getTotalSize in interface FrameWriterpublic long writeTo(org.apache.datasketches.memory.WritableMemory memory,
long startPosition)
FrameWriterFrameWriter.getTotalSize() bytes available.
Once this method is called, the frame writer is no longer usable and must be closed.
Returns the number of bytes written, which will equal FrameWriter.getTotalSize().writeTo in interface FrameWriterpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface FrameWriterCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.