Class MultiPartitionWriterStatistics
- All Implemented Interfaces:
MultiPartitionWriter,Closeable,AutoCloseable
MultiPartitionWriter that keeps simple statistics. Not thread safe.-
Method Summary
Modifier and TypeMethodDescriptionlongThe total number of buffers written.longThe total number of bytes written.voidclose()Close this writer.of(@NotNull MultiPartitionWriter writer) Creates a new statistics writer.voidResets the statistics.longrowCount()The total number of rows written.longThe total number of write calls.voidwriteDataToPartition(@NotNull String columnPartition, int numRows, @NotNull ByteBuffer buffer) Write all the row data to the given column partition.
-
Method Details
-
of
Creates a new statistics writer.- Parameters:
writer- the writer- Returns:
- the statistics writer
-
writeCount
public long writeCount()The total number of write calls.- Returns:
- the total number of write calls
-
rowCount
public long rowCount()The total number of rows written.- Returns:
- the total number of rows written
-
byteCount
public long byteCount()The total number of bytes written.- Returns:
- the total number of bytes written
-
bufferCount
public long bufferCount()The total number of buffers written.- Returns:
- the total number of buffers written
-
resetStatistics
public void resetStatistics()Resets the statistics. -
writeDataToPartition
public void writeDataToPartition(@NotNull @NotNull String columnPartition, int numRows, @NotNull @NotNull ByteBuffer buffer) throws IOException Description copied from interface:MultiPartitionWriterWrite all the row data to the given column partition.A write operation will return only after writing all the bytes, with the
buffer's position moved to its limit.On error, the
buffer's position will have been updated to account for the data that was successfully written; though, it is not safe to reuse this interface in an attempt to re-write the data (given the stateful nature of this interface).This is not meant to be called by third parties; the signature and documentation for this method is subject to change at any time.
This method is not guaranteed to be thread-safe. The assumption is that the caller only calls this method from exactly one thread, or uses concurrency control primitives that create a happens-before barrier between calls. thread-safe access as appropriate.
- Specified by:
writeDataToPartitionin interfaceMultiPartitionWriter- Parameters:
columnPartition- the column partition that the buffer should be written tonumRows- the number of rows represented inbuffer, must be positivebuffer- the buffer to write.- Throws:
IOException- if an IO error occurred
-
close
Description copied from interface:MultiPartitionWriterClose this writer. This method is thread-safe and may be invoked asynchronously, although asynchronous closure is discouraged as it may result in partially written data.If this writer has already been closed then this method returns immediately.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceMultiPartitionWriter- Throws:
IOException- if an error occurred while closing this writer
-