Search in sources :

Example 1 with VectorSizeInspector

use of org.apache.druid.segment.vector.VectorSizeInspector in project druid by druid-io.

the class AlwaysTwoVectorizedVirtualColumn method makeMultiValueVectorDimensionSelector.

@Override
public MultiValueDimensionVectorSelector makeMultiValueVectorDimensionSelector(DimensionSpec dimensionSpec, VectorColumnSelectorFactory factory) {
    Assert.assertEquals(outputName, dimensionSpec.getOutputName());
    final IndexedInts[] rowVector = new IndexedInts[factory.getReadableVectorInspector().getMaxVectorSize()];
    Arrays.fill(rowVector, new ArrayBasedIndexedInts(new int[] { 0, 0 }));
    return new MultiValueDimensionVectorSelector() {

        private final VectorSizeInspector inspector = factory.getReadableVectorInspector();

        @Override
        public IndexedInts[] getRowVector() {
            return rowVector;
        }

        @Override
        public int getValueCardinality() {
            return dictionaryEncoded ? 1 : CARDINALITY_UNKNOWN;
        }

        @Nullable
        @Override
        public String lookupName(int id) {
            return "2";
        }

        @Override
        public boolean nameLookupPossibleInAdvance() {
            return dictionaryEncoded;
        }

        @Nullable
        @Override
        public IdLookup idLookup() {
            return null;
        }

        @Override
        public int getMaxVectorSize() {
            return inspector.getMaxVectorSize();
        }

        @Override
        public int getCurrentVectorSize() {
            return inspector.getCurrentVectorSize();
        }
    };
}
Also used : MultiValueDimensionVectorSelector(org.apache.druid.segment.vector.MultiValueDimensionVectorSelector) ArrayBasedIndexedInts(org.apache.druid.segment.data.ArrayBasedIndexedInts) IndexedInts(org.apache.druid.segment.data.IndexedInts) ArrayBasedIndexedInts(org.apache.druid.segment.data.ArrayBasedIndexedInts) VectorSizeInspector(org.apache.druid.segment.vector.VectorSizeInspector)

Aggregations

ArrayBasedIndexedInts (org.apache.druid.segment.data.ArrayBasedIndexedInts)1 IndexedInts (org.apache.druid.segment.data.IndexedInts)1 MultiValueDimensionVectorSelector (org.apache.druid.segment.vector.MultiValueDimensionVectorSelector)1 VectorSizeInspector (org.apache.druid.segment.vector.VectorSizeInspector)1