use of com.yahoo.document.BucketIdFactory in project vespa by vespa-engine.
the class BucketSelectorTestCase method assertBucketCount.
public void assertBucketCount(String expr, int count) throws Exception {
BucketIdFactory factory = new BucketIdFactory();
BucketSelector selector = new BucketSelector(factory);
Set<BucketId> buckets = selector.getBucketList(expr);
assertEquals(count, buckets == null ? 0 : buckets.size());
}
use of com.yahoo.document.BucketIdFactory in project vespa by vespa-engine.
the class BucketSelectorTestCase method assertBucket.
public void assertBucket(String expr, BucketId bucket) throws Exception {
BucketIdFactory factory = new BucketIdFactory();
BucketSelector selector = new BucketSelector(factory);
Set<BucketId> buckets = selector.getBucketList(expr);
assertEquals(1, buckets == null ? 0 : buckets.size());
assertEquals(bucket, buckets.toArray()[0]);
}
use of com.yahoo.document.BucketIdFactory in project vespa by vespa-engine.
the class BucketSelectorTestCase method assertBuckets.
public void assertBuckets(String expr, Set<BucketId> expected) throws Exception {
BucketIdFactory factory = new BucketIdFactory();
BucketSelector selector = new BucketSelector(factory);
Set<BucketId> actual = new TreeSet<BucketId>(selector.getBucketList(expr));
assertEquals(expected, actual);
}
use of com.yahoo.document.BucketIdFactory in project vespa by vespa-engine.
the class BucketIdFactoryTestCase method testNormalUsage.
public void testNormalUsage() {
BucketIdFactory factory = new BucketIdFactory();
assertEquals(BucketId.COUNT_BITS, factory.getCountBitCount());
assertEquals(64, factory.getLocationBitCount() + factory.getGidBitCount() + BucketId.COUNT_BITS);
}
use of com.yahoo.document.BucketIdFactory in project vespa by vespa-engine.
the class VisitorIteratorTestCase method testExplicitDistributionImportNoTruncation.
public void testExplicitDistributionImportNoTruncation() throws ParseException {
BucketIdFactory idFactory = new BucketIdFactory();
ProgressToken p = new ProgressToken();
VisitorIterator iter = VisitorIterator.createFromDocumentSelection("id.user == 1234 or id.user == 6789 or id.user == 8009", idFactory, 20, p);
assertEquals(20, iter.getDistributionBitCount());
assertEquals(20, p.getDistributionBitCount());
assertEquals(20, iter.getBucketSource().getDistributionBitCount());
iter.update(iter.getNext().getSuperbucket(), ProgressToken.FINISHED_BUCKET);
// Make sure no truncation is done on import
String serialized = p.toString();
ProgressToken p2 = new ProgressToken(serialized);
BucketIdFactory idFactory2 = new BucketIdFactory();
VisitorIterator iter2 = VisitorIterator.createFromDocumentSelection("id.user == 1234 or id.user == 6789 or id.user == 8009", idFactory2, 1, p2);
assertEquals(20, iter2.getDistributionBitCount());
assertEquals(20, p2.getDistributionBitCount());
assertEquals(20, iter2.getBucketSource().getDistributionBitCount());
assertEquals(2, p2.getPendingBucketCount());
assertEquals(1, p2.getFinishedBucketCount());
assertEquals(3, p2.getTotalBucketCount());
}
Aggregations