Skip to content

Commit 3aac663

Browse files
committed
fix
1 parent ef989fd commit 3aac663

7 files changed

Lines changed: 32 additions & 41 deletions

File tree

src/Interpreters/getHeaderForProcessingStage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Block getHeaderForProcessingStage(
129129
if (!query_info.syntax_analyzer_result)
130130
{
131131
if (!query_info.planner_context)
132-
throw Exception(ErrorCodes::LOGICAL_ERROR, "Query is not analyzed");
132+
throw Exception(ErrorCodes::LOGICAL_ERROR, "Query is not analyzed: no planner context");
133133

134134
const auto & query_node = query_info.query_tree->as<QueryNode &>();
135135
const auto & join_tree = query_node.getJoinTree();

src/Planner/PlannerJoinTree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@ JoinTreeQueryPlan buildQueryPlanForJoinNode(const QueryTreeNodePtr & join_table_
12601260
return false;
12611261
};
12621262

1263-
/// This optimization relies on the sorting that should buffer the whole stream before emitting any rows.
1264-
/// It doesn't hold such a guarantee for streams with const keys.
1263+
/// This optimization relies on the sorting that should buffer data from both streams before emitting any rows.
1264+
/// Sorting on a stream with const keys can start returning rows immediately and pipeline may stuck.
12651265
/// Note: it's also doesn't work with the read-in-order optimization.
12661266
/// No checks here because read in order is not applied if we have `CreateSetAndFilterOnTheFlyStep` in the pipeline between the reading and sorting steps.
12671267
bool has_non_const_keys = has_non_const(left_plan.getCurrentDataStream().header, join_clause.key_names_left)

src/Storages/HDFS/StorageHDFSCluster.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#include <Core/QueryProcessingStage.h>
99
#include <DataTypes/DataTypeString.h>
1010
#include <Interpreters/getHeaderForProcessingStage.h>
11-
#include <IO/ConnectionTimeouts.h>
12-
#include <Interpreters/Context.h>
13-
#include <Interpreters/SelectQueryOptions.h>
1411
#include <Interpreters/InterpreterSelectQuery.h>
1512
#include <QueryPipeline/RemoteQueryExecutor.h>
1613

src/Storages/StorageS3Cluster.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
#include <DataTypes/DataTypeString.h>
88
#include <IO/ConnectionTimeouts.h>
9-
#include <IO/WriteBufferFromS3.h>
10-
#include <IO/WriteHelpers.h>
11-
#include <Interpreters/Context.h>
12-
#include <Interpreters/SelectQueryOptions.h>
139
#include <Interpreters/AddDefaultDatabaseVisitor.h>
1410
#include <Interpreters/InterpreterSelectQuery.h>
1511
#include <Processors/Sources/RemoteSource.h>

tests/queries/0_stateless/01721_join_implicit_cast_long.reference.j2

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{% for allow_experimental_analyzer in [0, 1] -%}
21
{% for join_algorithm in ['hash', 'partial_merge', 'auto', 'full_sorting_merge', 'grace_hash'] -%}
32
=== {{ join_algorithm }} ===
43
= full =
@@ -73,17 +72,20 @@
7372
9 9 0
7473
10 10 0
7574
= right =
76-
{% if allow_experimental_analyzer -%}
77-
-4 0 -4
78-
-3 0 -3
79-
-2 0 -2
80-
-1 0 -1
81-
{% else -%}
8275
0 0 -4
8376
0 0 -3
8477
0 0 -2
8578
0 0 -1
86-
{% endif -%}
79+
0 0 0
80+
1 1 1
81+
2 2 2
82+
3 3 3
83+
4 4 4
84+
5 5 5
85+
-4 0 -4
86+
-3 0 -3
87+
-2 0 -2
88+
-1 0 -1
8789
0 0 0
8890
1 1 1
8991
2 2 2
@@ -287,19 +289,21 @@
287289
3 3 3
288290
4 4 4
289291
5 5 5
290-
{% if allow_experimental_analyzer -%}
291-
-4 \N -4
292-
-3 \N -3
293-
-2 \N -2
294-
-1 \N -1
295-
0 \N 0
296-
{% else -%}
297292
\N \N -4
298293
\N \N -3
299294
\N \N -2
300295
\N \N -1
301296
\N \N 0
302-
{% endif -%}
297+
1 1 1
298+
2 2 2
299+
3 3 3
300+
4 4 4
301+
5 5 5
302+
-4 \N -4
303+
-3 \N -3
304+
-2 \N -2
305+
-1 \N -1
306+
0 \N 0
303307
= inner =
304308
1 1 1
305309
2 2 2
@@ -418,6 +422,6 @@
418422
1
419423
1
420424
1
425+
1
421426
{% endif -%}
422427
{% endfor -%}
423-
{% endfor -%}

tests/queries/0_stateless/01721_join_implicit_cast_long.sql.j2

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ INSERT INTO t2 SELECT number - 5 as a, 200 + number - 5 as b FROM system.numbers
1212
{% macro is_implemented(join_algorithm) -%}
1313
{% endmacro -%}
1414

15-
{% for allow_experimental_analyzer in [0, 1] -%}
16-
17-
SET allow_experimental_analyzer = {{ allow_experimental_analyzer }};
18-
1915
{% for join_algorithm in ['hash', 'partial_merge', 'auto', 'full_sorting_merge', 'grace_hash'] -%}
2016

2117
SELECT '=== {{ join_algorithm }} ===';
@@ -41,7 +37,8 @@ SELECT a, t1.a, t2.a FROM t1 FULL JOIN t2 USING (a) ORDER BY (t1.a, t2.a); {{ is
4137
SELECT '= left =';
4238
SELECT a, t1.a, t2.a FROM t1 LEFT JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
4339
SELECT '= right =';
44-
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a); {{ is_implemented(join_algorithm) }}
40+
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a) SETTINGS allow_experimental_analyzer = 0; {{ is_implemented(join_algorithm) }}
41+
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a) SETTINGS allow_experimental_analyzer = 1; {{ is_implemented(join_algorithm) }}
4542
SELECT '= inner =';
4643
SELECT a, t1.a, t2.a FROM t1 INNER JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
4744

@@ -122,7 +119,8 @@ SELECT a, t1.a, t2.a FROM t1 FULL JOIN t2 USING (a) ORDER BY (t1.a, t2.a); {{ is
122119
SELECT '= left =';
123120
SELECT a, t1.a, t2.a FROM t1 LEFT JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
124121
SELECT '= right =';
125-
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a); {{ is_implemented(join_algorithm) }}
122+
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a) SETTINGS allow_experimental_analyzer = 0; {{ is_implemented(join_algorithm) }}
123+
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a) SETTINGS allow_experimental_analyzer = 1; {{ is_implemented(join_algorithm) }}
126124
SELECT '= inner =';
127125
SELECT a, t1.a, t2.a FROM t1 INNER JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
128126

@@ -168,11 +166,8 @@ SELECT '= types =';
168166
SELECT any(toTypeName(a)) == 'Nullable(Int32)' AND any(toTypeName(t2.a)) == 'Nullable(Int32)' FROM t1 FULL JOIN t2 USING (a); {{ is_implemented(join_algorithm) }}
169167
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Nullable(Int32)' FROM t1 LEFT JOIN t2 USING (a);
170168

171-
{% if allow_experimental_analyzer -%}
172-
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 RIGHT JOIN t2 USING (a); {{ is_implemented(join_algorithm) }}
173-
{% else -%}
174-
SELECT any(toTypeName(a)) == 'Nullable(Int32)' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 RIGHT JOIN t2 USING (a); {{ is_implemented(join_algorithm) }}
175-
{% endif -%}
169+
SELECT any(toTypeName(a)) == 'Nullable(Int32)' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 RIGHT JOIN t2 USING (a) SETTINGS allow_experimental_analyzer = 0; {{ is_implemented(join_algorithm) }}
170+
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 RIGHT JOIN t2 USING (a) SETTINGS allow_experimental_analyzer = 1; {{ is_implemented(join_algorithm) }}
176171

177172
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 INNER JOIN t2 USING (a);
178173

@@ -188,7 +183,6 @@ SELECT toTypeName(any(a)) == 'Nullable(UInt16)' AND toTypeName(any(t2.a)) == 'Nu
188183
SET join_use_nulls = 0;
189184
{% endif -%}
190185

191-
{% endfor -%}
192186
{% endfor -%}
193187

194188
DROP TABLE IF EXISTS t1;

tests/queries/0_stateless/02886_missed_json_subcolumns.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
DROP TABLE IF EXISTS t_mutations_subcolumns;
1+
DROP TABLE IF EXISTS t_missed_subcolumns;
22

33
SET allow_experimental_object_type = 1;
44

@@ -14,7 +14,7 @@ OPTIMIZE TABLE t_missed_subcolumns FINAL;
1414

1515
SELECT count(), min(id) FROM t_missed_subcolumns;
1616

17-
SELECT * FROM t_missed_subcolumns WHERE obj.k4 = 5 ORDER BY id FORMAT JSONEachRow;
17+
SELECT * FROM t_missed_subcolumns WHERE obj.k4 = 5 ORDER BY id FORMAT JSONEachRow;
1818

1919
SELECT * FROM t_missed_subcolumns WHERE obj.k1.k3 = 'fee' ORDER BY id FORMAT JSONEachRow;
2020

0 commit comments

Comments
 (0)