Source:
<code>public VectorCursor buildVectorized(final int vectorSize) { Preconditions.checkState(virtualColumns.size() == 0, "virtualColumns.size == 0"); Preconditions.checkState(!descending, "!descending"); final Map<String, BaseColumn> columnCache = new HashMap<>(); final Closer closer = Closer.create(); NumericColumn timestamps = null; final int startOffset; final int endOffset; if (interval.getStartMillis() > minDataTimestamp) { timestamps = (NumericColumn) index.getColumnHolder(ColumnHolder.TIME_COLUMN_NAME).getColumn(); closer.register(timestamps); final int result = timeSearch(timestamps, interval.getStartMillis(), 0, index.getNumRows()); if (result >= 0) { startOffset = result; } else { startOffset = -(result + 1); } } else { startOffset = 0; } if (interval.getEndMillis() <= maxDataTimestamp) { if (timestamps == null) { timestamps = (NumericColumn) index.getColumnHolder(ColumnHolder.TIME_COLUMN_NAME).getColumn(); closer.register(timestamps); } final int result = timeSearch(timestamps, interval.getEndMillis(), startOffset, index.getNumRows()); <START> if (result >= 0) { <END> endOffset = result; } else { endOffset = -(result + 1); } } else { endOffset = index.getNumRows(); } final VectorOffset baseOffset = filterBitmap == null ? new NoFilterVectorOffset(vectorSize, startOffset, endOffset) : new BitmapVectorOffset(vectorSize, filterBitmap, startOffset, endOffset); if (postFilter == null) { return new QueryableIndexVectorCursor(index, baseOffset, closer, columnCache, vectorSize); } else { final VectorColumnSelectorFactory baseColumnSelectorFactory = new QueryableIndexVectorColumnSelectorFactory( index, baseOffset, closer, columnCache ); final VectorOffset filteredOffset = FilteredVectorOffset.create( baseOffset, baseColumnSelectorFactory, postFilter ); return new QueryableIndexVectorCursor(index, filteredOffset, closer, columnCache, vectorSize); } }</code><technical_language>I if need duplicate this code block instead of moving timeSearch, do work result differently elsewhere? if (result >= 0) { endOffset = result; } else { endOffset = -(result + 1); }</technical_language>

Target:
public VectorCursor buildVectorized(final int vectorSize) { Preconditions.checkState(virtualColumns.size() == 0, "virtualColumns.size == 0"); Preconditions.checkState(!descending, "!descending"); final Map<String, BaseColumn> columnCache = new HashMap<>(); final Closer closer = Closer.create(); NumericColumn timestamps = null; final int startOffset; final int endOffset; if (interval.getStartMillis() > minDataTimestamp) { timestamps = (NumericColumn) index.getColumnHolder(ColumnHolder.TIME_COLUMN_NAME).getColumn(); closer.register(timestamps); startOffset = timeSearch(timestamps, interval.getStartMillis(), 0, index.getNumRows()); } else { startOffset = 0; } if (interval.getEndMillis() <= maxDataTimestamp) { if (timestamps == null) { timestamps = (NumericColumn) index.getColumnHolder(ColumnHolder.TIME_COLUMN_NAME).getColumn(); closer.register(timestamps); } endOffset = timeSearch(timestamps, interval.getEndMillis(), startOffset, index.getNumRows()); } else { endOffset = index.getNumRows(); } final VectorOffset baseOffset = filterBitmap == null ? new NoFilterVectorOffset(vectorSize, startOffset, endOffset) : new BitmapVectorOffset(vectorSize, filterBitmap, startOffset, endOffset); if (postFilter == null) { return new QueryableIndexVectorCursor(index, baseOffset, closer, columnCache, vectorSize); } else { final VectorColumnSelectorFactory baseColumnSelectorFactory = new QueryableIndexVectorColumnSelectorFactory( index, baseOffset, closer, columnCache ); final VectorOffset filteredOffset = FilteredVectorOffset.create( baseOffset, baseColumnSelectorFactory, postFilter ); return new QueryableIndexVectorCursor(index, filteredOffset, closer, columnCache, vectorSize); } }