Source:
<code>default VectorValueSelector makeVectorValueSelector( final ReadableVectorOffset theOffset, final ImmutableBitmap nullValueBitmap ) { class ColumnarDoublesVectorValueSelector extends BaseDoubleVectorValueSelector { private final double[] doubleVector; private int id = ReadableVectorOffset.NULL_ID; private PeekableIntIterator nullIterator = nullValueBitmap.peekableIterator(); private int offsetMark = -1; @Nullable private boolean[] nullVector = null; private ColumnarDoublesVectorValueSelector() { super(theOffset); this.doubleVector = new double[offset.getMaxVectorSize()]; } @Nullable @Override public boolean[] getNullVector() { computeVectorsIfNeeded(); return nullVector; } @Override public double[] getDoubleVector() { computeVectorsIfNeeded(); return doubleVector; } private void computeVectorsIfNeeded() { if (id == offset.getId()) { return; } if (offset.isContiguous()) { if (offset.getStartOffset() < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offset.getStartOffset(); ColumnarDoubles.this.get(doubleVector, offset.getStartOffset(), offset.getCurrentVectorSize()); } else { final int[] offsets = offset.getOffsets(); if (offsets[0] < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } <START> offsetMark = offsets[0]; <END> ColumnarDoubles.this.get(doubleVector, offsets, offset.getCurrentVectorSize()); } nullVector = VectorSelectorUtils.populateNullVector(nullVector, offset, nullIterator); id = offset.getId(); } } return new ColumnarDoublesVectorValueSelector(); }</code><technical_language>I more sense set _last_ of offsets first. (With first-offset approach, I some issues if offset arrays subsequent calls overlapped other.)</technical_language>

Target:
default VectorValueSelector makeVectorValueSelector( final ReadableVectorOffset theOffset, final ImmutableBitmap nullValueBitmap ) { class ColumnarDoublesVectorValueSelector extends BaseDoubleVectorValueSelector { private final double[] doubleVector; private int id = ReadableVectorOffset.NULL_ID; private PeekableIntIterator nullIterator = nullValueBitmap.peekableIterator(); private int offsetMark = -1; @Nullable private boolean[] nullVector = null; private ColumnarDoublesVectorValueSelector() { super(theOffset); this.doubleVector = new double[offset.getMaxVectorSize()]; } @Nullable @Override public boolean[] getNullVector() { computeVectorsIfNeeded(); return nullVector; } @Override public double[] getDoubleVector() { computeVectorsIfNeeded(); return doubleVector; } private void computeVectorsIfNeeded() { if (id == offset.getId()) { return; } if (offset.isContiguous()) { if (offset.getStartOffset() < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offset.getStartOffset() + offset.getCurrentVectorSize(); ColumnarDoubles.this.get(doubleVector, offset.getStartOffset(), offset.getCurrentVectorSize()); } else { final int[] offsets = offset.getOffsets(); if (offsets[offsets.length - 1] < offsetMark) { nullIterator = nullValueBitmap.peekableIterator(); } offsetMark = offsets[offsets.length - 1]; ColumnarDoubles.this.get(doubleVector, offsets, offset.getCurrentVectorSize()); } nullVector = VectorSelectorUtils.populateNullVector(nullVector, offset, nullIterator); id = offset.getId(); } } return new ColumnarDoublesVectorValueSelector(); }