public abstract class DictionaryValuesWriter extends ValuesWriter implements RequiresFallback
| Modifier and Type | Class and Description |
|---|---|
static class |
DictionaryValuesWriter.PlainBinaryDictionaryValuesWriter |
static class |
DictionaryValuesWriter.PlainDoubleDictionaryValuesWriter |
static class |
DictionaryValuesWriter.PlainFixedLenArrayDictionaryValuesWriter |
static class |
DictionaryValuesWriter.PlainFloatDictionaryValuesWriter |
static class |
DictionaryValuesWriter.PlainIntegerDictionaryValuesWriter |
static class |
DictionaryValuesWriter.PlainLongDictionaryValuesWriter |
| Modifier and Type | Field and Description |
|---|---|
protected ByteBufferAllocator |
allocator |
protected long |
dictionaryByteSize |
protected boolean |
dictionaryTooBig |
protected IntList |
encodedValues |
protected Encoding |
encodingForDictionaryPage |
protected boolean |
firstPage
indicates if this is the first page being processed
|
protected int |
lastUsedDictionaryByteSize |
protected int |
lastUsedDictionarySize |
protected int |
maxDictionaryByteSize |
| Modifier | Constructor and Description |
|---|---|
protected |
DictionaryValuesWriter(int maxDictionaryByteSize,
Encoding encodingForDataPage,
Encoding encodingForDictionaryPage,
ByteBufferAllocator allocator) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
clearDictionaryContent()
clear/free the underlying dictionary content
|
void |
close()
Called to close the values writer.
|
protected DictionaryPage |
dictPage(ValuesWriter dictPageWriter) |
void |
fallBackAllValuesTo(ValuesWriter writer)
When falling back to a different encoding we must re-encode all the values seen so far
|
protected abstract void |
fallBackDictionaryEncodedData(ValuesWriter writer) |
long |
getAllocatedSize()
|
long |
getBufferedSize()
used to decide if we want to work to the next page
|
BytesInput |
getBytes() |
protected abstract int |
getDictionarySize() |
Encoding |
getEncoding()
called after getBytes() and before reset()
|
boolean |
isCompressionSatisfying(long rawSize,
long encodedSize)
Before writing the first page we will verify if the encoding is worth it.
|
String |
memUsageString(String prefix) |
void |
reset()
called after getBytes() to reset the current buffer and start writing the next page
|
void |
resetDictionary()
reset the dictionary when a new block starts
|
boolean |
shouldFallBack()
In the case of a dictionary based encoding we will fallback if the dictionary becomes too big
|
toDictPageAndClose, writeBoolean, writeByte, writeBytes, writeDouble, writeFloat, writeInteger, writeLongprotected final Encoding encodingForDictionaryPage
protected final int maxDictionaryByteSize
protected boolean dictionaryTooBig
protected long dictionaryByteSize
protected int lastUsedDictionaryByteSize
protected int lastUsedDictionarySize
protected IntList encodedValues
protected boolean firstPage
protected ByteBufferAllocator allocator
protected DictionaryValuesWriter(int maxDictionaryByteSize,
Encoding encodingForDataPage,
Encoding encodingForDictionaryPage,
ByteBufferAllocator allocator)
protected DictionaryPage dictPage(ValuesWriter dictPageWriter)
public boolean shouldFallBack()
RequiresFallbackshouldFallBack in interface RequiresFallbackpublic boolean isCompressionSatisfying(long rawSize,
long encodedSize)
RequiresFallbackisCompressionSatisfying in interface RequiresFallbackrawSize - the size if encoded with plainencodedSize - the size as encoded by the current encodingpublic void fallBackAllValuesTo(ValuesWriter writer)
RequiresFallbackfallBackAllValuesTo in interface RequiresFallbackwriter - the new encoder to write the current values toprotected abstract void fallBackDictionaryEncodedData(ValuesWriter writer)
public long getBufferedSize()
ValuesWritergetBufferedSize in class ValuesWriterpublic long getAllocatedSize()
ValuesWritergetAllocatedSize in class ValuesWriterpublic BytesInput getBytes()
getBytes in class ValuesWriterpublic Encoding getEncoding()
ValuesWritergetEncoding in class ValuesWriterpublic void reset()
ValuesWriterreset in class ValuesWriterpublic void close()
ValuesWriterclose in interface AutoCloseableclose in class ValuesWriterpublic void resetDictionary()
ValuesWriterresetDictionary in class ValuesWriterprotected abstract void clearDictionaryContent()
protected abstract int getDictionarySize()
public String memUsageString(String prefix)
memUsageString in class ValuesWriterCopyright © 2024 The Apache Software Foundation. All rights reserved.