use of org.apache.druid.query.filter.DruidLongPredicate in project druid by druid-io.
the class LongVectorValueMatcher method makeMatcher.
@Override
public VectorValueMatcher makeMatcher(final DruidPredicateFactory predicateFactory) {
final DruidLongPredicate predicate = predicateFactory.makeLongPredicate();
return new BaseVectorValueMatcher(selector) {
final VectorMatch match = VectorMatch.wrap(new int[selector.getMaxVectorSize()]);
@Override
public ReadableVectorMatch match(final ReadableVectorMatch mask) {
final long[] vector = selector.getLongVector();
final int[] selection = match.getSelection();
final boolean[] nulls = selector.getNullVector();
final boolean hasNulls = canHaveNulls && nulls != null;
int numRows = 0;
for (int i = 0; i < mask.getSelectionSize(); i++) {
final int rowNum = mask.getSelection()[i];
if (hasNulls && nulls[rowNum]) {
if (predicate.applyNull()) {
selection[numRows++] = rowNum;
}
} else if (predicate.applyLong(vector[rowNum])) {
selection[numRows++] = rowNum;
}
}
match.setSelectionSize(numRows);
assert match.isValid(mask);
return match;
}
};
}
use of org.apache.druid.query.filter.DruidLongPredicate in project druid by druid-io.
the class ValueMatchers method makeLongValueMatcher.
public static ValueMatcher makeLongValueMatcher(final BaseLongColumnValueSelector selector, final DruidPredicateFactory predicateFactory) {
final DruidLongPredicate predicate = predicateFactory.makeLongPredicate();
return new ValueMatcher() {
@Override
public boolean matches() {
if (selector.isNull()) {
return predicate.applyNull();
}
return predicate.applyLong(selector.getLong());
}
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector) {
inspector.visit("selector", selector);
inspector.visit("predicate", predicate);
}
};
}
Aggregations