Test the 'partitions' field of system.query_log

This commit is contained in:
helifu 2023-05-16 20:09:49 +08:00 committed by 何李夫
parent 2255b0287a
commit e138289fbf
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,2 @@
3 3
02751_query_log_test_partitions.3

View File

@ -0,0 +1,20 @@
set log_queries=1;
set log_queries_min_type='QUERY_FINISH';
DROP TABLE IF EXISTS 02751_query_log_test_partitions;
CREATE TABLE 02751_query_log_test_partitions (a Int64, b Int64) ENGINE = MergeTree PARTITION BY a ORDER BY b;
SYSTEM STOP MERGES 02751_query_log_test_partitions;
INSERT INTO 02751_query_log_test_partitions SELECT number, number FROM numbers(5);
SELECT * FROM 02751_query_log_test_partitions WHERE a = 3;
SYSTEM FLUSH LOGS;
SELECT
--Remove the prefix string which is a mutable database name.
arrayStringConcat(arrayPopFront(splitByString('.', partitions[1])), '.')
FROM
system.query_log
WHERE
current_database=currentDatabase() and
query = 'SELECT * FROM 02751_query_log_test_partitions WHERE a = 3;'