mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
use force_index_by_date and force_primary_key for tests
This commit is contained in:
parent
f660224a5f
commit
f1e4af5a22
@ -1,4 +1,2 @@
|
||||
1 A 2021-01-01
|
||||
1 A 2021-01-01
|
||||
3
|
||||
3
|
||||
|
@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
uniq_num=$(date "+%Y%m%d%H%M%S%s")
|
||||
table=tuple_filter_test_${uniq_num}
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS ${table}";
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="CREATE TABLE ${table} (id UInt32, value String, log_date Date) Engine=MergeTree() ORDER BY id PARTITION BY log_date settings index_granularity=3;";
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="insert into ${table} values (1, 'A','2021-01-01'),(2,'B','2021-01-01'),(3,'C','2021-01-01'),(4,'D','2021-01-02'),(5,'E','2021-01-02');";
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="select * from ${table} where (id, value) = (1, 'A');";
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="select * from ${table} where (log_date, value) = ('2021-01-01', 'A');";
|
||||
|
||||
#Make sure the quer log has been insert into query_log table
|
||||
sleep 10
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="select read_rows from system.query_log where query in ('select * from ${table} where (id, value) = (1, \'A\');', 'select * from ${table} where (log_date, value) = (\'2021-01-01\', \'A\');') and type = 2;";
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS ${table}";
|
||||
|
14
tests/queries/0_stateless/02030_tuple_filter.sql
Normal file
14
tests/queries/0_stateless/02030_tuple_filter.sql
Normal file
@ -0,0 +1,14 @@
|
||||
DROP TABLE IF EXISTS test_tuple_filter;
|
||||
|
||||
CREATE TABLE test_tuple_filter (id UInt32, value String, log_date Date) Engine=MergeTree() ORDER BY id PARTITION BY log_date settings index_granularity=3;
|
||||
|
||||
insert into test_tuple_filter values (1, 'A','2021-01-01'),(2,'B','2021-01-01'),(3,'C','2021-01-01'),(4,'D','2021-01-02'),(5,'E','2021-01-02');
|
||||
|
||||
set force_primary_key=1;
|
||||
SELECT * FROM test_tuple_filter WHERE (id, value) = (1, 'A');
|
||||
|
||||
set force_index_by_date=1;
|
||||
set force_primary_key=0;
|
||||
SELECT * FROM test_tuple_filter WHERE (log_date, value) = ('2021-01-01', 'A');
|
||||
|
||||
DROP TABLE IF EXISTS test_tuple_filter;
|
Loading…
Reference in New Issue
Block a user