Search in sources :

Example 1 with VectorValueMatcher

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);
}
Also used : VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher)

Example 2 with VectorValueMatcher

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;
        }
    };
}
Also used : BaseVectorValueMatcher(org.apache.druid.query.filter.vector.BaseVectorValueMatcher) VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher) ReadableVectorMatch(org.apache.druid.query.filter.vector.ReadableVectorMatch) VectorMatch(org.apache.druid.query.filter.vector.VectorMatch) ReadableVectorMatch(org.apache.druid.query.filter.vector.ReadableVectorMatch) BaseVectorValueMatcher(org.apache.druid.query.filter.vector.BaseVectorValueMatcher)

Example 3 with VectorValueMatcher

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);
}
Also used : VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher) BaseVectorValueMatcher(org.apache.druid.query.filter.vector.BaseVectorValueMatcher) BooleanFilter(org.apache.druid.query.filter.BooleanFilter) Filter(org.apache.druid.query.filter.Filter)

Example 4 with VectorValueMatcher

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));
}
Also used : VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher)

Example 5 with VectorValueMatcher

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);
}
Also used : BaseVectorValueMatcher(org.apache.druid.query.filter.vector.BaseVectorValueMatcher) VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher) BooleanFilter(org.apache.druid.query.filter.BooleanFilter) Filter(org.apache.druid.query.filter.Filter)

Aggregations

VectorValueMatcher (org.apache.druid.query.filter.vector.VectorValueMatcher)5 BaseVectorValueMatcher (org.apache.druid.query.filter.vector.BaseVectorValueMatcher)3 BooleanFilter (org.apache.druid.query.filter.BooleanFilter)2 Filter (org.apache.druid.query.filter.Filter)2 ReadableVectorMatch (org.apache.druid.query.filter.vector.ReadableVectorMatch)1 VectorMatch (org.apache.druid.query.filter.vector.VectorMatch)1