**Describe what's wrong**

Correct query doesn't work.

**Does it reproduce on recent release?**

Yes,

ClickHouse version 21.11

```
CREATE TABLE tbl_repr(
ts DateTime,
x  String)
ENGINE=MergeTree ORDER BY ts;

SELECT *
FROM
(
    SELECT
        x,
        length(x)
    FROM tbl_repr
    WHERE ts > now()
    LIMIT 1
)
WHERE x != ''

Query id: 083cdb34-500b-4b43-b096-9c8140165a65


0 rows in set. Elapsed: 0.004 sec.

Received exception from server (version 21.11.1):
Code: 8. DB::Exception: Received from localhost:9000. DB::Exception: Cannot find column `length(x)` in source stream, there are only columns: [x]. (THERE_IS_NO_COLUMN)
```

**Expected behavior**

Query works


**Error message and/or stacktrace**

Code: 8. DB::Exception: Received from localhost:9000. DB::Exception: Cannot find column `length(x)` in source stream, there are only columns: [x]. (THERE_IS_NO_COLUMN)

const DataStream & input_stream_,
    size_t limit_, size_t offset_,
    bool always_read_till_end_,
    bool with_ties_,
    SortDescription description_)
    : ITransformingStep(input_stream_, input_stream_.header, getTraits())
    , limit(limit_), offset(offset_)
    , always_read_till_end(always_read_till_end_)
    , with_ties(with_ties_), description(std::move(description_))
{
}
void LimitStep::updateInputStream(DataStream input_stream)
{
    input_streams.clear();
    input_streams.emplace_back(std::move(input_stream));
    output_stream = createOutputStream(input_streams.front(), output_stream->header, getDataStreamTraits());
}
void LimitStep::transformPipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &)
{
    auto transform = std::make_shared<LimitTransform>(
        pipeline.getHeader(), limit, offset, pipeline.getNumStreams(), always_read_till_end, with_ties, description);
    pipeline.addTransform(std::move(transform));
}
void LimitStep::describeActions(FormatSettings & settings) const