Search in sources :

Example 1 with StringDictionaryEncodedColumn

use of org.apache.druid.segment.column.StringDictionaryEncodedColumn in project druid by druid-io.

the class DummyStringVirtualColumn method makeDimensionSelector.

@Override
public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelector columnSelector, ReadableOffset offset) {
    if (enableColumnBasedMethods) {
        ColumnHolder holder = columnSelector.getColumnHolder(baseColumnName);
        if (holder == null) {
            return DimensionSelector.constant(null);
        }
        StringDictionaryEncodedColumn stringCol = toStringDictionaryEncodedColumn(holder.getColumn());
        DimensionSelector baseDimensionSelector = stringCol.makeDimensionSelector(offset, dimensionSpec.getExtractionFn());
        if (disableValueMatchers) {
            baseDimensionSelector = disableValueMatchers(baseDimensionSelector);
        }
        return dimensionSpec.decorate(baseDimensionSelector);
    } else {
        return null;
    }
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) DimensionSelector(org.apache.druid.segment.DimensionSelector) StringDictionaryEncodedColumn(org.apache.druid.segment.column.StringDictionaryEncodedColumn)

Example 2 with StringDictionaryEncodedColumn

use of org.apache.druid.segment.column.StringDictionaryEncodedColumn in project druid by druid-io.

the class DummyStringVirtualColumn method makeColumnValueSelector.

@Override
public ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelector columnSelector, ReadableOffset offset) {
    if (enableColumnBasedMethods) {
        ColumnHolder holder = columnSelector.getColumnHolder(baseColumnName);
        if (holder == null) {
            return NilColumnValueSelector.instance();
        }
        StringDictionaryEncodedColumn stringCol = toStringDictionaryEncodedColumn(holder.getColumn());
        return stringCol.makeColumnValueSelector(offset);
    } else {
        return null;
    }
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) StringDictionaryEncodedColumn(org.apache.druid.segment.column.StringDictionaryEncodedColumn)

Example 3 with StringDictionaryEncodedColumn

use of org.apache.druid.segment.column.StringDictionaryEncodedColumn in project druid by druid-io.

the class ColumnSelectorBitmapIndexSelectorTest method setup.

@Before
public void setup() {
    bitmapFactory = EasyMock.createMock(BitmapFactory.class);
    virtualColumns = EasyMock.createMock(VirtualColumns.class);
    index = EasyMock.createMock(ColumnSelector.class);
    bitmapIndexSelector = new ColumnSelectorBitmapIndexSelector(bitmapFactory, virtualColumns, index);
    EasyMock.expect(virtualColumns.getVirtualColumn(STRING_DICTIONARY_COLUMN_NAME)).andReturn(null).anyTimes();
    EasyMock.expect(virtualColumns.getVirtualColumn(NON_STRING_DICTIONARY_COLUMN_NAME)).andReturn(null).anyTimes();
    ColumnHolder holder = EasyMock.createMock(ColumnHolder.class);
    EasyMock.expect(index.getColumnHolder(STRING_DICTIONARY_COLUMN_NAME)).andReturn(holder).anyTimes();
    StringDictionaryEncodedColumn stringColumn = EasyMock.createMock(StringDictionaryEncodedColumn.class);
    EasyMock.expect(holder.getCapabilities()).andReturn(ColumnCapabilitiesImpl.createDefault().setType(ColumnType.STRING).setDictionaryEncoded(true).setDictionaryValuesUnique(true).setDictionaryValuesSorted(true).setHasBitmapIndexes(true)).anyTimes();
    EasyMock.expect(holder.getColumn()).andReturn(stringColumn).anyTimes();
    BitmapIndex someIndex = EasyMock.createMock(BitmapIndex.class);
    EasyMock.expect(holder.getBitmapIndex()).andReturn(someIndex).anyTimes();
    ImmutableBitmap someBitmap = EasyMock.createMock(ImmutableBitmap.class);
    EasyMock.expect(someIndex.getIndex("foo")).andReturn(0).anyTimes();
    EasyMock.expect(someIndex.getBitmap(0)).andReturn(someBitmap).anyTimes();
    ColumnHolder nonStringHolder = EasyMock.createMock(ColumnHolder.class);
    EasyMock.expect(index.getColumnHolder(NON_STRING_DICTIONARY_COLUMN_NAME)).andReturn(nonStringHolder).anyTimes();
    EasyMock.expect(nonStringHolder.getCapabilities()).andReturn(ColumnCapabilitiesImpl.createDefault().setType(ColumnType.ofComplex("testBlob")).setDictionaryEncoded(true).setDictionaryValuesUnique(true).setDictionaryValuesSorted(true).setHasBitmapIndexes(true).setFilterable(true)).anyTimes();
    EasyMock.replay(bitmapFactory, virtualColumns, index, holder, stringColumn, nonStringHolder, someIndex, someBitmap);
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) ImmutableBitmap(org.apache.druid.collections.bitmap.ImmutableBitmap) BitmapIndex(org.apache.druid.segment.column.BitmapIndex) BitmapFactory(org.apache.druid.collections.bitmap.BitmapFactory) StringDictionaryEncodedColumn(org.apache.druid.segment.column.StringDictionaryEncodedColumn) Before(org.junit.Before)

Aggregations

ColumnHolder (org.apache.druid.segment.column.ColumnHolder)3 StringDictionaryEncodedColumn (org.apache.druid.segment.column.StringDictionaryEncodedColumn)3 BitmapFactory (org.apache.druid.collections.bitmap.BitmapFactory)1 ImmutableBitmap (org.apache.druid.collections.bitmap.ImmutableBitmap)1 DimensionSelector (org.apache.druid.segment.DimensionSelector)1 BitmapIndex (org.apache.druid.segment.column.BitmapIndex)1 Before (org.junit.Before)1