public class SimpleEqualityPartitioner extends Object implements Partitioner
getKeys(Query)
returns a set of size 1. This means the queries need not be duplicated after
partitioning. However, getKeys(BulletRecord)
will return a set of keys representing the queries that this
record needs to presented to. The size of this can be up to 2^(# of fields), where each of the keys is the join
of all combinations of null and the actual value in the record for each field in field order with the delimiter.
Ex: If fields are [A, B.c, D] and a record has these values: [A: foo, B.c: bar, D: baz, ...], the keys will be the
the concatenation of the following items in each tuple using the configured delimiter (not necessarily in this order):
[foo, bar, baz]
[foo, null, baz]
[foo, bar, null]
[foo, null, null]
[null, bar, baz]
[null, bar, null]
[null, null, baz]
[null, null, null]
Using these keys and presenting the record to all the queries with the same key will ensure that the record is
seen by exactly only the queries that need to see it.Modifier and Type | Field and Description |
---|---|
static char |
DISAMBIGUATOR |
Constructor and Description |
---|
SimpleEqualityPartitioner(BulletConfig config)
Constructor that takes a
BulletConfig instance with definitions for the various settings this needs. |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getKeys(com.yahoo.bullet.record.BulletRecord record)
Returns the partitioning keys for this
BulletRecord instance. |
Set<String> |
getKeys(Query query)
Returns the partitioning keys for this
Query instance. |
public static final char DISAMBIGUATOR
public SimpleEqualityPartitioner(BulletConfig config)
BulletConfig
instance with definitions for the various settings this needs.
Delimiter: BulletConfig.EQUALITY_PARTITIONER_DELIMITER
and
Fields to partition on: BulletConfig.EQUALITY_PARTITIONER_FIELDS
config
- The non-null config containing settings for this class.public Set<String> getKeys(Query query)
Query
instance.
This partitioner ensures that queries are not stored in duplicate by returning only key for a query (the list
that is returned is of size 1).getKeys
in interface Partitioner
query
- The query to partition for.Set
of Strings representing the keys for this query.public Set<String> getKeys(com.yahoo.bullet.record.BulletRecord record)
Partitioner
BulletRecord
instance.getKeys
in interface Partitioner
record
- The record to partition.Set
of Strings representing the keys for this record.Copyright © 2021. All rights reserved.