Merge pull request #30562 from ClickHouse/fix-header-after-limit-push-down

Fix LimitStep header after limit push down optimization.
This commit is contained in:
alexey-milovidov 2021-10-24 00:19:02 +03:00 committed by GitHub
commit 8c2413f6fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -40,7 +40,7 @@ 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());
output_stream = createOutputStream(input_streams.front(), input_streams.front().header, getDataStreamTraits());
}
void LimitStep::transformPipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &)

View File

@ -0,0 +1,21 @@
drop table if exists tbl_repr;
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 != '';
drop table if exists tbl_repr;