public class GenericIndexed<T> extends Object implements Indexed<T>
V1 Storage Format:
byte 1: version (0x1) byte 2 == 0x1 =>; allowReverseLookup bytes 3-6 =>; numBytesUsed bytes 7-10 =>; numElements bytes 10-((numElements * 4) + 10): integers representing *end* offsets of byte serialized values bytes ((numElements * 4) + 10)-(numBytesUsed + 2): 4-byte integer representing length of value, followed by bytes for value
V2 Storage Format Meta, header and value files are separate and header file stored in native endian byte order. Meta File: byte 1: version (0x2) byte 2 == 0x1 =>; allowReverseLookup bytes 3-6: numberOfElementsPerValueFile expressed as power of 2. That means all the value files contains same number of items except last value file and may have fewer elements. bytes 7-10 =>; numElements bytes 11-14 =>; columnNameLength bytes 15-columnNameLength =>; columnName
Header file name is identified as: String.format("%s_header", columnName) value files are identified as: String.format("%s_value_%d", columnName, fileNumber) number of value files == numElements/numberOfElementsPerValueFile
Modifier and Type | Field and Description |
---|---|
static ObjectStrategy<String> |
STRING_STRATEGY |
static byte |
VERSION_ONE |
static byte |
VERSION_TWO |
Modifier and Type | Method and Description |
---|---|
static <T> GenericIndexed<T> |
fromArray(T[] objects,
ObjectStrategy<T> strategy) |
static <T> GenericIndexed<T> |
fromIterable(Iterable<T> objectsIterable,
ObjectStrategy<T> strategy) |
T |
get(int index) |
Class<? extends T> |
getClazz() |
static int |
getNumberOfFilesRequired(int bagSize,
long numWritten) |
long |
getSerializedSize() |
int |
indexOf(T value)
Returns the index of "value" in this GenericIndexed object, or (-(insertion point) - 1) if the value is not
present, in the manner of Arrays.binarySearch.
|
Iterator<T> |
iterator() |
static <T> GenericIndexed<T> |
read(ByteBuffer buffer,
ObjectStrategy<T> strategy) |
static <T> GenericIndexed<T> |
read(ByteBuffer buffer,
ObjectStrategy<T> strategy,
SmooshedFileMapper fileMapper) |
io.druid.segment.data.GenericIndexed.BufferIndexed |
singleThreaded()
Create a non-thread-safe Indexed, which may perform better than the underlying Indexed.
|
int |
size() |
void |
writeToChannel(WritableByteChannel channel) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static final byte VERSION_ONE
public static final byte VERSION_TWO
public static final ObjectStrategy<String> STRING_STRATEGY
public static int getNumberOfFilesRequired(int bagSize, long numWritten)
public static <T> GenericIndexed<T> fromArray(T[] objects, ObjectStrategy<T> strategy)
public static <T> GenericIndexed<T> fromIterable(Iterable<T> objectsIterable, ObjectStrategy<T> strategy)
public static <T> GenericIndexed<T> read(ByteBuffer buffer, ObjectStrategy<T> strategy)
public static <T> GenericIndexed<T> read(ByteBuffer buffer, ObjectStrategy<T> strategy, SmooshedFileMapper fileMapper)
public int indexOf(T value)
public long getSerializedSize()
public void writeToChannel(WritableByteChannel channel) throws IOException
IOException
public io.druid.segment.data.GenericIndexed.BufferIndexed singleThreaded()
Copyright © 2011–2017. All rights reserved.