presto-main/src/main/java/io/prestosql/operator/project/DictionaryAwarePageFilter.java/DictionaryAwarePageFilter/selectDictionaryPositions
class DictionaryAwarePageFilter:    private static SelectedPositions selectDictionaryPositions(DictionaryBlock dictionaryBlock, boolean[] selectedDictionaryPositions)
    {
        int selectedCount = 0;
        for (int position = 0; position < dictionaryBlock.getPositionCount(); position++) {
            if (selectedDictionaryPositions[dictionaryBlock.getId(position)]) {
                selectedCount++;
            }
        }

        if (selectedCount == 0 || selectedCount == dictionaryBlock.getPositionCount()) {
            return SelectedPositions.positionsRange(0, selectedCount);
        }

        int[] positions = new int[selectedCount];
        int index = 0;
        for (int position = 0; position < dictionaryBlock.getPositionCount(); position++) {
            if (selectedDictionaryPositions[dictionaryBlock.getId(position)]) {
                positions[index] = position;
                index++;
            }
        }
        return SelectedPositions.positionsList(positions, 0, selectedCount);
    }