com.bazaarvoice.emodb.sor.condition.PartitionCondition Maven / Gradle / Ivy
The newest version!
package com.bazaarvoice.emodb.sor.condition;
/**
* Condition to explicitly partition the events based on a hash of the document ID. The condition takes two parameters:
*
*
* - The total number of partitions
* - A condition which tests whether the partition for the current document is a match
*
*
* For example, the following two conditions should roughly split all matching documents between them:
*
*
* and({..,"type":"review"},partition(2:1))
* and({..,"type":"review"},partition(2:2))
*
*
* Note that partitions are 1-based and so for a number of partitions p
the possible matching conditions
* are the integers in [1..p]
. There are some checks preventing the client from providing invalid
* conditions but these are non-exhaustive and do not cover meaningless conditions. For example, the following
* conditions will result no matches:
*
*
* partition(4: ge(5))
* partition(4: and(1,2))
*
*/
public interface PartitionCondition extends Condition {
/**
* Total number of partitions. Must be a positive integer.
*/
int getNumPartitions();
/**
* Condition to evaluate whether the partition for the current document matches. Most commonly this will be
* a simple equality condition such as eq(1)
which can be shortened to just 1
.
*/
Condition getCondition();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy