use of com.linkedin.pinot.core.common.Block in project pinot by linkedin.
the class RealtimeSegmentTest method testNoMatchFilteringMetricPredicateWithoutInvIdx.
@Test
public void testNoMatchFilteringMetricPredicateWithoutInvIdx() throws Exception {
DataSource ds1 = segmentWithoutInvIdx.getDataSource("count");
List<String> rhs = new ArrayList<String>();
rhs.add("890662862");
Predicate predicate = new NEqPredicate("count", rhs);
ScanBasedFilterOperator op = new ScanBasedFilterOperator(predicate, ds1, 0, segmentWithoutInvIdx.getRawDocumentCount() - 1);
Block b = op.nextBlock();
BlockDocIdIterator iterator = b.getBlockDocIdSet().iterator();
int counter = 0;
int docId = iterator.next();
while (docId != Constants.EOF) {
// shouldn't reach here.
Assert.assertTrue(false);
docId = iterator.next();
counter++;
}
Assert.assertEquals(counter, 0);
}
use of com.linkedin.pinot.core.common.Block in project pinot by linkedin.
the class RealtimeSegmentTest method testNoRangeMatchFilteringMetricPredicateWithInvIdx.
@Test
public void testNoRangeMatchFilteringMetricPredicateWithInvIdx() throws Exception {
DataSource ds1 = segmentWithInvIdx.getDataSource("count");
List<String> rhs = new ArrayList<String>();
rhs.add("[0\t\t100)");
Predicate predicate = new RangePredicate("count", rhs);
BitmapBasedFilterOperator op = new BitmapBasedFilterOperator(predicate, ds1, 0, segmentWithInvIdx.getRawDocumentCount() - 1);
Block b = op.nextBlock();
BlockDocIdIterator iterator = b.getBlockDocIdSet().iterator();
int counter = 0;
int docId = iterator.next();
while (docId != Constants.EOF) {
// shouldn't reach here.
Assert.assertTrue(false);
docId = iterator.next();
counter++;
}
Assert.assertEquals(counter, 0);
}
use of com.linkedin.pinot.core.common.Block in project pinot by linkedin.
the class RealtimeSegmentTest method testMetricPredicateWithoutInvIdx.
@Test
public void testMetricPredicateWithoutInvIdx() throws Exception {
DataSource ds1 = segmentWithoutInvIdx.getDataSource("count");
List<String> rhs = new ArrayList<String>();
rhs.add("890662862");
Predicate predicate = new EqPredicate("count", rhs);
ScanBasedFilterOperator op = new ScanBasedFilterOperator(predicate, ds1, 0, segmentWithoutInvIdx.getRawDocumentCount() - 1);
Block b = op.nextBlock();
BlockDocIdIterator iterator = b.getBlockDocIdSet().iterator();
DataSource ds2 = segmentWithoutInvIdx.getDataSource("count");
BlockSingleValIterator blockValIterator = (BlockSingleValIterator) ds2.nextBlock().getBlockValueSet().iterator();
int docId = iterator.next();
int counter = 0;
while (docId != Constants.EOF) {
blockValIterator.skipTo(docId);
Assert.assertEquals(ds1.getDictionary().get(blockValIterator.nextIntVal()), 890662862);
docId = iterator.next();
counter++;
}
Assert.assertEquals(counter, 100000);
}
use of com.linkedin.pinot.core.common.Block in project pinot by linkedin.
the class RealtimeSegmentTest method test1.
@Test
public void test1() throws Exception {
DataSource ds = segmentWithInvIdx.getDataSource("column1");
Block b = ds.nextBlock();
BlockValSet set = b.getBlockValueSet();
BlockSingleValIterator it = (BlockSingleValIterator) set.iterator();
BlockMetadata metadata = b.getMetadata();
while (it.next()) {
int dicId = it.nextIntVal();
}
}
use of com.linkedin.pinot.core.common.Block in project pinot by linkedin.
the class RealtimeSegmentTest method testRangeMatchFilteringMetricPredicateWithInvIdx.
@Test
public void testRangeMatchFilteringMetricPredicateWithInvIdx() throws Exception {
DataSource ds1 = segmentWithInvIdx.getDataSource("count");
List<String> rhs = new ArrayList<String>();
rhs.add("[0\t\t*)");
Predicate predicate = new RangePredicate("count", rhs);
BitmapBasedFilterOperator op = new BitmapBasedFilterOperator(predicate, ds1, 0, segmentWithInvIdx.getRawDocumentCount() - 1);
Block b = op.nextBlock();
BlockDocIdIterator iterator = b.getBlockDocIdSet().iterator();
DataSource ds2 = segmentWithInvIdx.getDataSource("count");
BlockSingleValIterator blockValIterator = (BlockSingleValIterator) ds2.nextBlock().getBlockValueSet().iterator();
int docId = iterator.next();
int counter = 0;
while (docId != Constants.EOF) {
blockValIterator.skipTo(docId);
Assert.assertEquals(ds1.getDictionary().get(blockValIterator.nextIntVal()), 890662862);
docId = iterator.next();
counter++;
}
Assert.assertEquals(counter, 100000);
}
Aggregations