use of org.apache.druid.segment.vector.VectorColumnSelectorFactory in project druid by druid-io.
the class FloatMinAggregationTest method setup.
@Before
public void setup() {
NullHandling.initializeForTests();
VectorValueSelector vectorValueSelector = EasyMock.createMock(VectorValueSelector.class);
EasyMock.expect(vectorValueSelector.getFloatVector()).andReturn(floatValues1).anyTimes();
EasyMock.expect(vectorValueSelector.getNullVector()).andReturn(null).anyTimes();
EasyMock.replay(vectorValueSelector);
vectorColumnSelectorFactory = EasyMock.createMock(VectorColumnSelectorFactory.class);
EasyMock.expect(vectorColumnSelectorFactory.getColumnCapabilities("fltFld")).andReturn(new ColumnCapabilitiesImpl().setType(ColumnType.FLOAT).setDictionaryEncoded(true)).anyTimes();
EasyMock.expect(vectorColumnSelectorFactory.makeValueSelector("fltFld")).andReturn(vectorValueSelector).anyTimes();
EasyMock.replay(vectorColumnSelectorFactory);
}
use of org.apache.druid.segment.vector.VectorColumnSelectorFactory in project druid by druid-io.
the class BaseFilterTest method selectColumnValuesMatchingFilterUsingVectorizedPostFiltering.
private List<String> selectColumnValuesMatchingFilterUsingVectorizedPostFiltering(final DimFilter filter, final String selectColumn) {
final Filter theFilter = makeFilter(filter);
final Filter postFilteringFilter = new Filter() {
@Override
public <T> T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory) {
throw new UnsupportedOperationException();
}
@Override
public ValueMatcher makeMatcher(ColumnSelectorFactory factory) {
return theFilter.makeMatcher(factory);
}
@Override
public boolean supportsBitmapIndex(BitmapIndexSelector selector) {
return false;
}
@Override
public boolean shouldUseBitmapIndex(BitmapIndexSelector selector) {
return false;
}
@Override
public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) {
return theFilter.makeVectorMatcher(factory);
}
@Override
public boolean canVectorizeMatcher(ColumnInspector inspector) {
return theFilter.canVectorizeMatcher(inspector);
}
@Override
public Set<String> getRequiredColumns() {
return null;
}
@Override
public boolean supportsSelectivityEstimation(ColumnSelector columnSelector, BitmapIndexSelector indexSelector) {
return false;
}
@Override
public double estimateSelectivity(BitmapIndexSelector indexSelector) {
return 1.0;
}
};
try (final VectorCursor cursor = makeVectorCursor(postFilteringFilter)) {
final SingleValueDimensionVectorSelector selector = cursor.getColumnSelectorFactory().makeSingleValueDimensionSelector(new DefaultDimensionSpec(selectColumn, selectColumn));
final List<String> values = new ArrayList<>();
while (!cursor.isDone()) {
final int[] rowVector = selector.getRowVector();
for (int i = 0; i < cursor.getCurrentVectorSize(); i++) {
values.add(selector.lookupName(rowVector[i]));
}
cursor.advance();
}
return values;
}
}
Aggregations