Class

io.snappydata.collection

ByteBufferHashMap

Related Doc: package collection

Permalink

final class ByteBufferHashMap extends AnyRef

A HashMap implementation using a serialized ByteBuffer for key data and another one for value data. Key data is required to hold fixed-width values while the value data will be written back-to-back as new data is inserted into the map. Key data is stored in the following format:

  .------------------------ Offset into value data (4 bytes)
  |   .-------------------- Hash code (4 bytes)
  |   |
  |   |        .----------- Fixed-width fields of key data
  |   |        |        .-- Padding for 8 byte word alignment
  V   V        V        V
+---+---+-------------+---+
|   |   | ... ... ... |   |
+---+---+-------------+---+
 \-----/ \------------/\--/
  header      body    padding

If key has variable length data, then it should be appended to the value data. The offset+hash code is read as a single long where LSB is used for hash code while MSB is used for offset, so the two can be reverse in actual memory layout on big-endian machines. Since there is no disk storage of this map so no attempt is made to have consistent endianness or memory layout of the data.

Rehash of the map (when loadFactor exceeds) moves around the above key fields to create a new array as per the new hash locations. The value fields are left untouched with the headers of keys having the offsets into value array as before the rehash.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ByteBufferHashMap
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ByteBufferHashMap(initialCapacity: Int, loadFactor: Double, keySize: Int, valueSize: Int, allocator: BufferAllocator, keyData: ByteBufferData = null, valueData: ByteBufferData = null, valueDataPosition: Long = 0L)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addDictionaryString(key: UTF8String): Int

    Permalink

    Add a new string to the map for dictionaries.

    Add a new string to the map for dictionaries. The key field has the index of the value i.e. (n - 1) for nth distinct string added to the map, with the offset into the value. The string itself is stored back to back in the value portion with its size at the start being variable length. This exactly matches the end format of the dictionary encoding that stores the dictionary string back-to-back in index order and expected by DictionaryDecoders. So the encoder can use the final value serialized array as is for putting into the encoded column batch (followed by the dictionary indexes of actual values themselves).

    The encoded values are read in the initialization of DictionaryDecoder and put into an array, and looked up by its readUTF8String method.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def duplicate(): ByteBufferHashMap

    Permalink
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. var keyData: ByteBufferData

    Permalink
  15. val loadFactor: Double

    Permalink
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def release(): Unit

    Permalink
  20. def reset(): Unit

    Permalink
  21. def size: Int

    Permalink
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. var valueData: ByteBufferData

    Permalink
  25. var valueDataPosition: Long

    Permalink
  26. def valueDataSize: Long

    Permalink
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped