Given that vcounter is a View, the settings limit/offset dose not work as expected.

```sql
CREATE TABLE counter (id UInt64, createdAt DateTime) ENGINE = MergeTree() ORDER BY id;
INSERT INTO counter SELECT number, now() FROM numbers(500);

CREATE VIEW vcounter AS
SELECT
    intDiv(id, 10) AS tens,
    max(createdAt) AS maxid
FROM counter
GROUP BY tens;

SELECT *
FROM vcounter
ORDER BY tens ASC
LIMIT 100
SETTINGS limit = 6, offset = 5


┌─tens─┬───────────────maxid─┐
│   47 │ 2021-12-29 13:05:23 │
└──────┴─────────────────────┘

1 rows in set. Elapsed: 0.006 sec.

```

The query should return 6 rows, instead of one. 

**Does it reproduce on recent release?**

Yes, we can reproduce it on `21.10`.

**Expected behavior**

The query should return 6 rows, instead of one.

**Additional context**

Replace view with subquery works though,

```sql
SELECT *
FROM
(
    SELECT
        intDiv(id, 10) AS tens,
        max(createdAt) AS maxid
    FROM test.counter
    GROUP BY tens
)
LIMIT 100
SETTINGS limit = 6, offset = 5;

┌─tens─┬───────────────maxid─┐
│    3 │ 2021-12-29 13:05:23 │
│   31 │ 2021-12-29 13:05:23 │
│   47 │ 2021-12-29 13:05:23 │
│   40 │ 2021-12-29 13:05:23 │
│   30 │ 2021-12-29 13:05:23 │
│    2 │ 2021-12-29 13:05:23 │
└──────┴─────────────────────┘

6 rows in set. Elapsed: 0.011 sec. 
```

positions_of_required_result_columns[required_result_num] = full_result_header.getPositionByName(required_result_column_names[required_result_num]);
        for (size_t query_num = 1; query_num < num_children; ++query_num)
        {
            Block full_result_header_for_current_select
                = getCurrentChildResultHeader(ast->list_of_selects->children.at(query_num), required_result_column_names);
            if (full_result_header_for_current_select.columns() != full_result_header.columns())
                throw Exception("Different number of columns in UNION ALL elements:\n"
                    + full_result_header.dumpNames()
                    + "\nand\n"
                    + full_result_header_for_current_select.dumpNames() + "\n",
                    ErrorCodes::UNION_ALL_RESULT_STRUCTURES_MISMATCH);
            required_result_column_names_for_other_selects[query_num].reserve(required_result_column_names.size());
            for (const auto & pos : positions_of_required_result_columns)
                required_result_column_names_for_other_selects[query_num].push_back(full_result_header_for_current_select.getByPosition(pos).name);
        }
    }
    if (num_children == 1 && settings_limit_offset_needed)
    {
        const ASTPtr first_select_ast = ast->list_of_selects->children.at(0);
        ASTSelectQuery * select_query = dynamic_cast<ASTSelectQuery *>(first_select_ast.get());
        if (!select_query)
            throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid type in list_of_selects: {}", first_select_ast->getID());
        if (!select_query->withFill() && !select_query->limit_with_ties)
        {
            UInt64 limit_length = 0;
            UInt64 limit_offset = 0;
            const ASTPtr limit_offset_ast = select_query->limitOffset();
            if (limit_offset_ast)
            {
                limit_offset = limit_offset_ast->as<ASTLiteral &>().value.safeGet<UInt64>();