presto-main/src/main/java/io/prestosql/operator/project/PageFilter.java/PageFilter/positionsArrayToSelectedPositions
class PageFilter:    static SelectedPositions positionsArrayToSelectedPositions(boolean[] selectedPositions, int size)
    {
        int selectedCount = 0;
        for (int i = 0; i < size; i++) {
            boolean selectedPosition = selectedPositions[i];
            if (selectedPosition) {
                selectedCount++;
            }
        }

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

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