Search in sources :

Example 6 with SimpleAscendingOffset

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

the class BroadcastSegmentIndexedTable method columnReader.

@Override
public Reader columnReader(int column) {
    if (!rowSignature.contains(column)) {
        throw new IAE("Column[%d] is not a valid column for segment[%s]", column, segment.getId());
    }
    final SimpleAscendingOffset offset = new SimpleAscendingOffset(adapter.getNumRows());
    final BaseColumn baseColumn = queryableIndex.getColumnHolder(rowSignature.getColumnName(column)).getColumn();
    final BaseObjectColumnValueSelector<?> selector = baseColumn.makeColumnValueSelector(offset);
    return new Reader() {

        @Nullable
        @Override
        public Object read(int row) {
            offset.setCurrentOffset(row);
            return selector.getObject();
        }

        @Override
        public void close() throws IOException {
            baseColumn.close();
        }
    };
}
Also used : SimpleAscendingOffset(org.apache.druid.segment.SimpleAscendingOffset) BaseColumn(org.apache.druid.segment.column.BaseColumn) IAE(org.apache.druid.java.util.common.IAE)

Aggregations

SimpleAscendingOffset (org.apache.druid.segment.SimpleAscendingOffset)6 BaseColumn (org.apache.druid.segment.column.BaseColumn)3 IOException (java.io.IOException)2 IAE (org.apache.druid.java.util.common.IAE)2 Closer (org.apache.druid.java.util.common.io.Closer)2 ValueMatcher (org.apache.druid.query.filter.ValueMatcher)2 DictionaryEncodedColumnSupplier (org.apache.druid.segment.serde.DictionaryEncodedColumnSupplier)2 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)2 Test (org.junit.Test)2 ColumnSelectorFactory (org.apache.druid.segment.ColumnSelectorFactory)1 NoFilterVectorOffset (org.apache.druid.segment.vector.NoFilterVectorOffset)1