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();
}
};
}
Aggregations