Skip to content

Commit f796fe7

Browse files
Backport ClickHouse#88290 to 25.8: Fix object storages with correlated subqueries
1 parent 72e4f78 commit f796fe7

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

src/Processors/QueryPlan/ReadFromObjectStorageStep.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ ReadFromObjectStorageStep::ReadFromObjectStorageStep(
5353
{
5454
}
5555

56+
QueryPlanStepPtr ReadFromObjectStorageStep::clone() const
57+
{
58+
return std::make_unique<ReadFromObjectStorageStep>(*this);
59+
}
60+
5661
void ReadFromObjectStorageStep::applyFilters(ActionDAGNodes added_filter_nodes)
5762
{
5863
SourceStepWithFilter::applyFilters(std::move(added_filter_nodes));

src/Processors/QueryPlan/ReadFromObjectStorageStep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ReadFromObjectStorageStep : public SourceStepWithFilter
3333
void updatePrewhereInfo(const PrewhereInfoPtr & prewhere_info_value) override;
3434

3535
void initializePipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &) override;
36+
QueryPlanStepPtr clone() const override;
3637

3738
private:
3839
ObjectStoragePtr object_storage;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
1
2+
2
3+
3
4+
4
5+
5
6+
6
7+
7
8+
8
9+
9
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- Tags: no-fasttest
2+
-- Tag no-fasttest: needs s3
3+
4+
-- Use correlated subqueries which are supported only by the new analyzer.
5+
set enable_analyzer = 1;
6+
7+
INSERT INTO TABLE FUNCTION s3('http://localhost:11111/test/test-data-03644_object_storage.csv', 'test', 'testtest', 'CSV', 'number UInt64') SELECT number FROM numbers(10) SETTINGS s3_truncate_on_insert = 1;
8+
9+
SELECT n1.c1
10+
FROM s3('http://localhost:11111/test/test-data-03644_object_storage.csv', 'test', 'testtest') AS n1
11+
WHERE n1.c1 > (
12+
SELECT AVG(n2.c1)
13+
FROM s3('http://localhost:11111/test/test-data-03644_object_storage.csv', 'test', 'testtest') AS n2
14+
WHERE n2.c1 < n1.c1
15+
)
16+
SETTINGS allow_experimental_correlated_subqueries = 1;

0 commit comments

Comments
 (0)