public interface Fields
This interface is experimental, but the API is not solidified and we reserve the right to make backwards incompatible changes without pushing up the library's version.
Implement at your own risk.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Fields.UpdateCallback
An UpdateCallback is a callback provided to calls that potentially update buckets.
|
| Modifier and Type | Field and Description |
|---|---|
static byte |
COMPRESSED_DENSE_VERSION
Compressed dense version
|
static byte |
HASH_SPARSE_VERSION
Hash sparse version
|
static byte |
NAIVE_DENSE_VERSION
Naive dense version
|
static Fields.UpdateCallback |
NOOP_CB
Returns a new No-Op Callback
|
static byte |
SORTED_SPARSE_VERSION
Sorted sparse version
|
| Modifier and Type | Method and Description |
|---|---|
BucketIterator |
getBucketIterator()
Returns a BucketIterator over the buckets in this Fields object.
|
Preamble |
getPreamble()
Gets the Preamble
|
int |
intoByteArray(byte[] array,
int offset)
Fills the array starting from offset with the byte array representation of the fields
|
int |
numBytesToSerialize()
Provides an indication of how many bytes would be required to serialize the fields to
a byte[].
|
Fields |
toCompact()
Return the compact form of this fields object.
|
Fields |
unionBucketIterator(BucketIterator iter,
Fields.UpdateCallback cb)
Unions the provided BucketIterator into the current Fields object.
|
Fields |
unionCompressedAndExceptions(byte[] compressed,
int minVal,
com.yahoo.sketches.hll.OnHeapHash exceptions,
Fields.UpdateCallback cb)
Unions the provided compressed byte[] and exceptions hash into the current Fields object.
|
Fields |
unionInto(Fields recipient,
Fields.UpdateCallback cb)
Unions the current Fields into the Fields presented as an argument.
|
Fields |
updateBucket(int bucket,
byte val,
Fields.UpdateCallback callback)
Potentially updates a bucket in the underlying storage.
|
static final byte NAIVE_DENSE_VERSION
static final byte HASH_SPARSE_VERSION
static final byte SORTED_SPARSE_VERSION
static final byte COMPRESSED_DENSE_VERSION
static final Fields.UpdateCallback NOOP_CB
Preamble getPreamble()
Fields updateBucket(int bucket, byte val, Fields.UpdateCallback callback)
A callback *must* be provided which will be called whenever the provided val is greater than the currently stored value.
bucket - the bucket to updateval - the val to update tocallback - the callback to be called if the provided val is greater than the currentint intoByteArray(byte[] array,
int offset)
This should *not* include the preamble
array - given array to filloffset - starting with this offsetint numBytesToSerialize()
Fields toCompact()
BucketIterator getBucketIterator()
Fields unionInto(Fields recipient, Fields.UpdateCallback cb)
recipient.unionBucketIterator(getBucketIterator());
But, if there is a method that is more specific to the implementation, it can choose to
delegate to, e.g:
unionCompressedAndExceptions()
recipient - The fields to be unioned *into*cb - The callback to be called whenever a bucket value is updatedFields unionBucketIterator(BucketIterator iter, Fields.UpdateCallback cb)
iter - the BucketIterator to union into the current Fields objectcb - The callback to be called whenever a bucket value is updatedFields unionCompressedAndExceptions(byte[] compressed, int minVal, com.yahoo.sketches.hll.OnHeapHash exceptions, Fields.UpdateCallback cb)
compressed - a byte array of compressed, 4-bit values as used by OnHeapCompressedFieldsminVal - the minimum value (or "offset"). I.e. a 0 in a nibble from compressed represent
this actual valueexceptions - the exceptions hashcb - The callback to be called whenever a bucket value is updatedCopyright © 2015–2017 Yahoo! Inc.. All rights reserved.