use of com.linkedin.pinot.core.common.predicate.NEqPredicate in project pinot by linkedin.
the class Predicate method newPredicate.
public static Predicate newPredicate(FilterQueryTree filterQueryTree) {
assert (filterQueryTree.getChildren() == null) || filterQueryTree.getChildren().isEmpty();
final FilterOperator filterType = filterQueryTree.getOperator();
final String column = filterQueryTree.getColumn();
final List<String> value = filterQueryTree.getValue();
Predicate predicate = null;
switch(filterType) {
case EQUALITY:
predicate = new EqPredicate(column, value);
break;
case RANGE:
predicate = new RangePredicate(column, value);
break;
case REGEX:
predicate = new RegexPredicate(column, value);
break;
case NOT:
predicate = new NEqPredicate(column, value);
break;
case NOT_IN:
predicate = new NotInPredicate(column, value);
break;
case IN:
predicate = new InPredicate(column, value);
break;
default:
throw new UnsupportedOperationException("Unsupported filterType:" + filterType);
}
return predicate;
}
use of com.linkedin.pinot.core.common.predicate.NEqPredicate in project pinot by linkedin.
the class RealtimeSegmentTest method testNoMatchFilteringMetricPredicateWithInvIdx.
@Test
public void testNoMatchFilteringMetricPredicateWithInvIdx() throws Exception {
DataSource ds1 = segmentWithInvIdx.getDataSource("count");
List<String> rhs = new ArrayList<String>();
rhs.add("890662862");
Predicate predicate = new NEqPredicate("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.predicate.NEqPredicate 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);
}
Aggregations