Source:
<code>private void getIndexRowHelper(ExecRow baseRow, RowLocation rowLocation, ExecIndexRow indexRow, FormatableBitSet bitSet, boolean alwaysIncludeLocation) throws StandardException { int colCount; if (isOnExpression()) { colCount = isAscending().length; ExecRow expandedRow; if (bitSet == null) { expandedRow = baseRow; <START> } else { <END> int maxNumCols = getMaxBaseColumnPosition(); expandedRow = new ValueRow(maxNumCols); for (int expandedRowIndex = 1, baseRowIndex = 1; expandedRowIndex <= maxNumCols; expandedRowIndex++) { if (bitSet.get(expandedRowIndex)) { expandedRow.setColumn(expandedRowIndex, baseRow.getColumn(baseRowIndex)); baseRowIndex++; } } } for (int i = 0; i < colCount; i++) { BaseExecutableIndexExpression execExpr = getExecutableIndexExpression(i); if (execExpr == null) { throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "cannot find compiled expression"); } execExpr.runExpression(expandedRow, indexRow); } } else { int[] baseColumnPositions = id.baseColumnPositions(); colCount = baseColumnPositions.length; if (bitSet == null) { for (int i = 0; i < colCount; i++) { indexRow.setColumn(i + 1, baseRow.getColumn(baseColumnPositions[i])); } } else { if (SanityManager.DEBUG) { SanityManager.ASSERT(!bitSet.get(0), "element zero of the bitSet passed into getIndexRow() is not false, bitSet should be 1 based"); } for (int i = 0; i < colCount; i++) { int fullColumnNumber = baseColumnPositions[i]; int partialColumnNumber = 0; for (int index = 1; index <= fullColumnNumber; index++) { if (bitSet.get(index)) { partialColumnNumber++; } } indexRow.setColumn(i + 1, baseRow.getColumn(partialColumnNumber)); } } } if (alwaysIncludeLocation || !id.isUnique()) { indexRow.setColumn(colCount + 1, rowLocation); } }</code><technical_language>extract function getExpandedRow()</technical_language>

Target:
private void getIndexRowHelper(ExecRow baseRow, RowLocation rowLocation, ExecIndexRow indexRow, FormatableBitSet bitSet, boolean alwaysIncludeLocation) throws StandardException { int colCount; if (isOnExpression()) { colCount = isAscending().length; ExecRow expandedRow; if (bitSet == null) { expandedRow = baseRow; } else { int maxNumCols = getMaxBaseColumnPosition(); expandedRow = new ValueRow(maxNumCols); for (int expandedRowIndex = 1, baseRowIndex = 1; expandedRowIndex <= maxNumCols; expandedRowIndex++) { if (bitSet.get(expandedRowIndex)) { expandedRow.setColumn(expandedRowIndex, baseRow.getColumn(baseRowIndex)); baseRowIndex++; } } } for (int i = 0; i < colCount; i++) { BaseExecutableIndexExpression execExpr = getExecutableIndexExpression(i); if (execExpr == null) { throw StandardException.newException(SQLState.LANG_UNABLE_TO_LOAD_GENERATE_CODE, getExprTexts()[i]); } execExpr.runExpression(expandedRow, indexRow); } } else { int[] baseColumnPositions = id.baseColumnPositions(); colCount = baseColumnPositions.length; if (bitSet == null) { for (int i = 0; i < colCount; i++) { indexRow.setColumn(i + 1, baseRow.getColumn(baseColumnPositions[i])); } } else { if (SanityManager.DEBUG) { SanityManager.ASSERT(!bitSet.get(0), "element zero of the bitSet passed into getIndexRow() is not false, bitSet should be 1 based"); } for (int i = 0; i < colCount; i++) { int fullColumnNumber = baseColumnPositions[i]; int partialColumnNumber = 0; for (int index = 1; index <= fullColumnNumber; index++) { if (bitSet.get(index)) { partialColumnNumber++; } } indexRow.setColumn(i + 1, baseRow.getColumn(partialColumnNumber)); } } } if (alwaysIncludeLocation || !id.isUnique()) { indexRow.setColumn(colCount + 1, rowLocation); } }