Skip to content

Commit da12e29

Browse files
Merge pull request ClickHouse#12747 from ClickHouse/fix-extra-overflow-row
Fix extra overflow row
2 parents 9560c51 + 0fe7367 commit da12e29

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

src/Interpreters/ClusterProxy/SelectStreamFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Pipe createLocalStream(
8383
/// This flag means that pipeline must be tree-shaped,
8484
/// so we can't enable processors for InterpreterSelectQuery here.
8585
auto stream = interpreter.execute().in;
86-
auto source = std::make_shared<SourceFromInputStream>(std::move(stream));
86+
auto source = std::make_shared<SourceFromInputStream>(std::move(stream), processed_stage == QueryProcessingStage::WithMergeableState);
8787

8888
if (add_totals_port)
8989
source->addTotalsPort();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2020-07-10
2+
2020-07-11
3+
4+
0000-00-00
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
DROP TABLE IF EXISTS tracking_events_tmp;
2+
DROP TABLE IF EXISTS open_events_tmp;
3+
4+
CREATE TABLE tracking_events_tmp (`APIKey` UInt32, `EventDate` Date) ENGINE = MergeTree PARTITION BY toYYYYMM(EventDate) ORDER BY (APIKey, EventDate);
5+
CREATE TABLE open_events_tmp (`APIKey` UInt32, `EventDate` Date) ENGINE = MergeTree PARTITION BY toMonday(EventDate) ORDER BY (APIKey, EventDate);
6+
7+
insert into open_events_tmp select 2, '2020-07-10' from numbers(32);
8+
insert into open_events_tmp select 2, '2020-07-11' from numbers(31);
9+
10+
insert into tracking_events_tmp select 2, '2020-07-10' from numbers(1881);
11+
insert into tracking_events_tmp select 2, '2020-07-11' from numbers(1623);
12+
13+
SELECT EventDate
14+
FROM
15+
(
16+
SELECT EventDate
17+
FROM tracking_events_tmp AS t1
18+
WHERE (EventDate >= toDate('2020-07-10')) AND (EventDate <= toDate('2020-07-11')) AND (APIKey = 2)
19+
GROUP BY EventDate
20+
)
21+
FULL OUTER JOIN
22+
(
23+
SELECT EventDate
24+
FROM remote('127.0.0.{1,3}', currentDatabase(), open_events_tmp) AS t2
25+
WHERE (EventDate >= toDate('2020-07-10')) AND (EventDate <= toDate('2020-07-11')) AND (APIKey = 2)
26+
GROUP BY EventDate
27+
WITH TOTALS
28+
) USING EventDate
29+
ORDER BY EventDate
30+
settings totals_mode = 'after_having_auto', group_by_overflow_mode = 'any', max_rows_to_group_by = 10000000, joined_subquery_requires_alias=0;
31+
32+
33+
DROP TABLE IF EXISTS tracking_events_tmp;
34+
DROP TABLE IF EXISTS open_events_tmp;

0 commit comments

Comments
 (0)