use of org.apache.druid.query.filter.vector.VectorValueMatcher in project druid by druid-io.
the class FilteredVectorOffset method create.
public static FilteredVectorOffset create(final VectorOffset baseOffset, final VectorColumnSelectorFactory baseColumnSelectorFactory, final Filter filter) {
// This is not the same logic as the row-by-row FilteredOffset, which uses bitmaps whenever possible.
// I am not convinced that approach is best in all cases (it's potentially too eager) and also have not implemented
// it for vector matchers yet. So let's keep this method simple for now, and try to harmonize them in the future.
Preconditions.checkState(filter.canVectorizeMatcher(baseColumnSelectorFactory), "Cannot vectorize");
final VectorValueMatcher filterMatcher = filter.makeVectorMatcher(baseColumnSelectorFactory);
return new FilteredVectorOffset(baseOffset, filterMatcher);
}
use of org.apache.druid.query.filter.vector.VectorValueMatcher in project druid by druid-io.
the class NotFilter method makeVectorMatcher.
@Override
public VectorValueMatcher makeVectorMatcher(final VectorColumnSelectorFactory factory) {
final VectorValueMatcher baseMatcher = baseFilter.makeVectorMatcher(factory);
return new BaseVectorValueMatcher(baseMatcher) {
final VectorMatch scratch = VectorMatch.wrap(new int[factory.getMaxVectorSize()]);
@Override
public ReadableVectorMatch match(final ReadableVectorMatch mask) {
final ReadableVectorMatch baseMatch = baseMatcher.match(mask);
scratch.copyFrom(mask);
scratch.removeAll(baseMatch);
assert scratch.isValid(mask);
return scratch;
}
};
}
use of org.apache.druid.query.filter.vector.VectorValueMatcher in project druid by druid-io.
the class AndFilter method makeVectorMatcher.
@Override
public VectorValueMatcher makeVectorMatcher(final VectorColumnSelectorFactory factory) {
final VectorValueMatcher[] matchers = new VectorValueMatcher[filters.size()];
int i = 0;
for (Filter filter : filters) {
matchers[i++] = filter.makeVectorMatcher(factory);
}
return makeVectorMatcher(matchers);
}
use of org.apache.druid.query.filter.vector.VectorValueMatcher in project druid by druid-io.
the class FilteredAggregatorFactory method factorizeVector.
@Override
public VectorAggregator factorizeVector(VectorColumnSelectorFactory columnSelectorFactory) {
Preconditions.checkState(canVectorize(columnSelectorFactory), "Cannot vectorize");
final VectorValueMatcher valueMatcher = filter.makeVectorMatcher(columnSelectorFactory);
return new FilteredVectorAggregator(valueMatcher, delegate.factorizeVector(columnSelectorFactory));
}
use of org.apache.druid.query.filter.vector.VectorValueMatcher in project druid by druid-io.
the class OrFilter method makeVectorMatcher.
@Override
public VectorValueMatcher makeVectorMatcher(final VectorColumnSelectorFactory factory) {
final VectorValueMatcher[] matchers = new VectorValueMatcher[filters.size()];
int i = 0;
for (Filter filter : filters) {
matchers[i++] = filter.makeVectorMatcher(factory);
}
return makeVectorMatcher(matchers);
}
Aggregations