Source:
<code>private void assertBlockSize(Block block) { long expectedBlockSize = copyBlockViaBlockSerde(block).getSizeInBytes(); assertEquals(block.getSizeInBytes(), expectedBlockSize); assertEquals(block.getRegionSizeInBytes(0, block.getPositionCount()), expectedBlockSize); List<Block> splitBlock = splitBlock(block, 2); Block firstHalf = splitBlock.get(0); long expectedFirstHalfSize = copyBlockViaBlockSerde(firstHalf).getSizeInBytes(); assertEquals(firstHalf.getSizeInBytes(), expectedFirstHalfSize); assertEquals(block.getRegionSizeInBytes(0, firstHalf.getPositionCount()), expectedFirstHalfSize); Block secondHalf = splitBlock.get(1); long expectedSecondHalfSize = copyBlockViaBlockSerde(secondHalf).getSizeInBytes(); assertEquals(secondHalf.getSizeInBytes(), expectedSecondHalfSize); assertEquals(block.getRegionSizeInBytes(firstHalf.getPositionCount(), secondHalf.getPositionCount()), expectedSecondHalfSize); boolean[] positions = new boolean[block.getPositionCount()]; for (int i = 0; i < firstHalf.getPositionCount(); ++i) { positions[i] = true; } assertEquals(firstHalf.getSizeInBytes(), block.getPositionsSizeInBytes(positions)); fill(positions, true); assertEquals(block.getSizeInBytes(), block.getPositionsSizeInBytes(positions)); for (int i = 0; i < firstHalf.getPositionCount(); ++i) { positions[i] = false; } <START> assertEquals(secondHalf.getSizeInBytes(), block.getPositionsSizeInBytes(positions)); <END> }</code><technical_language>boolean[] positions = new boolean[block.getPositionCount()]; Arrays.fill(positions, true); assertEquals(block.getPositionsSizeInBytes(positions), expectedBlockSize); Arrays.fill(positions, false); Arrays.fill(positions, 0, firstHalf.getPositionCount(), true); assertEquals(block.getPositionsSizeInBytes(positions), expectedFirstHalfSize); Arrays.fill(positions, false); Arrays.fill(positions, firstHalf.getPositionCount(), block.getPositionCount(), true); assertEquals(block.getPositionsSizeInBytes(positions), expectedSecondHalfSize);</technical_language>

Target:
private void assertBlockSize(Block block) { long expectedBlockSize = copyBlockViaBlockSerde(block).getSizeInBytes(); assertEquals(block.getSizeInBytes(), expectedBlockSize); assertEquals(block.getRegionSizeInBytes(0, block.getPositionCount()), expectedBlockSize); List<Block> splitBlock = splitBlock(block, 2); Block firstHalf = splitBlock.get(0); long expectedFirstHalfSize = copyBlockViaBlockSerde(firstHalf).getSizeInBytes(); assertEquals(firstHalf.getSizeInBytes(), expectedFirstHalfSize); assertEquals(block.getRegionSizeInBytes(0, firstHalf.getPositionCount()), expectedFirstHalfSize); Block secondHalf = splitBlock.get(1); long expectedSecondHalfSize = copyBlockViaBlockSerde(secondHalf).getSizeInBytes(); assertEquals(secondHalf.getSizeInBytes(), expectedSecondHalfSize); assertEquals(block.getRegionSizeInBytes(firstHalf.getPositionCount(), secondHalf.getPositionCount()), expectedSecondHalfSize); boolean[] positions = new boolean[block.getPositionCount()]; fill(positions, 0, firstHalf.getPositionCount(), true); assertEquals(block.getPositionsSizeInBytes(positions), expectedFirstHalfSize); fill(positions, true); assertEquals(block.getPositionsSizeInBytes(positions), expectedBlockSize); fill(positions, 0, firstHalf.getPositionCount(), false); assertEquals(block.getPositionsSizeInBytes(positions), expectedSecondHalfSize); }