Skip to content

Commit 4480bcf

Browse files
committed
apply workaround for #1077
1 parent 63af45a commit 4480bcf

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

tests/queries/0_stateless/03642_tiered_distributed.reference

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,25 +175,25 @@ Read predicate-filtered data with analyzer enabled and prefer localhost replica
175175
Check if the subqueries were recorded in query_log
176176
Row 1:
177177
──────
178-
type: QueryFinish
179-
is_initial_query: 1
180-
tbl: ['_table_function.remote','db.test_tiered_watermark']
181-
qry: SELECT * FROM test_tiered_watermark ORDER BY id DESC SETTINGS enable_analyzer = 1, prefer_localhost_replica = 0, log_queries=1, serialize_query_plan=0, log_comment = 'test_tiered_watermark', max_threads=1 FORMAT Null;
182-
log_comment: test_tiered_watermark
178+
type: QueryFinish
179+
is_initial_query2: 1
180+
tbl: ['_table_function.remote','db.test_tiered_watermark']
181+
qry: SELECT * FROM test_tiered_watermark ORDER BY id DESC SETTINGS enable_analyzer = 1, prefer_localhost_replica = 0, log_queries=1, serialize_query_plan=0, log_comment = 'test_tiered_watermark', max_threads=1 FORMAT Null;
182+
log_comment: test_tiered_watermark
183183

184184
Row 2:
185185
──────
186-
type: QueryFinish
187-
is_initial_query: 0
188-
tbl: ['db.test_tiered_watermark_after']
189-
qry: SELECT `__table1`.`id` AS `id`, `__table1`.`name` AS `name`, `__table1`.`date` AS `date`, `__table1`.`value` AS `value` FROM `db`.`test_tiered_watermark_after` AS `__table1` WHERE `__table1`.`date` >= '2025-09-01' ORDER BY `__table1`.`id` DESC
190-
log_comment: test_tiered_watermark
186+
type: QueryFinish
187+
is_initial_query2: 0
188+
tbl: ['db.test_tiered_watermark_after']
189+
qry: SELECT `__table1`.`id` AS `id`, `__table1`.`name` AS `name`, `__table1`.`date` AS `date`, `__table1`.`value` AS `value` FROM `db`.`test_tiered_watermark_after` AS `__table1` WHERE `__table1`.`date` >= '2025-09-01' ORDER BY `__table1`.`id` DESC
190+
log_comment: test_tiered_watermark
191191

192192
Row 3:
193193
──────
194-
type: QueryFinish
195-
is_initial_query: 0
196-
tbl: ['db.test_tiered_watermark_before']
197-
qry: SELECT `__table1`.`id` AS `id`, `__table1`.`name` AS `name`, `__table1`.`date` AS `date`, `__table1`.`value` AS `value` FROM `db`.`test_tiered_watermark_before` AS `__table1` WHERE `__table1`.`date` < '2025-09-01' ORDER BY `__table1`.`id` DESC
198-
log_comment: test_tiered_watermark
194+
type: QueryFinish
195+
is_initial_query2: 0
196+
tbl: ['db.test_tiered_watermark_before']
197+
qry: SELECT `__table1`.`id` AS `id`, `__table1`.`name` AS `name`, `__table1`.`date` AS `date`, `__table1`.`value` AS `value` FROM `db`.`test_tiered_watermark_before` AS `__table1` WHERE `__table1`.`date` < '2025-09-01' ORDER BY `__table1`.`id` DESC
198+
log_comment: test_tiered_watermark
199199
Clean up predicate filtering tables

tests/queries/0_stateless/03642_tiered_distributed.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,14 @@ SELECT 'Read predicate-filtered data with analyzer enabled and prefer localhost
274274
SELECT * FROM test_tiered_watermark ORDER BY id SETTINGS enable_analyzer = 1, prefer_localhost_replica = 1;
275275

276276
-- other combinations of settings work, but give a bit different content in the query_log
277+
-- See the problem around is_initial_query described in https://github.com/Altinity/ClickHouse/issues/1077
277278
SELECT 'Check if the subqueries were recorded in query_log';
278279

279280
SELECT * FROM test_tiered_watermark ORDER BY id DESC SETTINGS enable_analyzer = 1, prefer_localhost_replica = 0, log_queries=1, serialize_query_plan=0, log_comment = 'test_tiered_watermark', max_threads=1 FORMAT Null;
280281
SYSTEM FLUSH LOGS;
281282
SELECT
282283
type,
283-
is_initial_query,
284+
query_id = initial_query_id AS is_initial_query2,
284285
arraySort(arrayMap(x -> replaceAll(x, currentDatabase(), 'db'), tables)) as tbl,
285286
replaceAll(query, currentDatabase(), 'db') as qry,
286287
log_comment
@@ -294,7 +295,7 @@ WHERE
294295
event_time > now() - 300
295296
and log_comment = 'test_tiered_watermark'
296297
and current_database = currentDatabase()
297-
and is_initial_query )
298+
and query_id = initial_query_id )
298299
ORDER BY tbl, event_time_microseconds
299300
FORMAT Vertical;
300301

0 commit comments

Comments
 (0)