2020-09-26 01:20:36 +00:00
#!/usr/bin/env bash
2021-09-12 12:35:27 +00:00
# Tags: long, no-polymorphic-parts
# Tag no-polymorphic-parts: bug, shoud be fixed
2020-09-26 01:20:36 +00:00
# Description of test result:
2021-07-18 15:07:32 +00:00
# Test the correctness of the partition pruning
2021-02-13 17:31:37 +00:00
#
2021-07-18 15:07:32 +00:00
# Script executes queries from a file 01508_partition_pruning_long.queries (1 line = 1 query)
# Queries are started with 'select' (but NOT with 'SELECT') are executed with log_level=debug
2020-09-26 01:20:36 +00:00
CURDIR = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
2020-12-28 11:46:53 +00:00
# shellcheck source=../shell_config.sh
2020-09-26 01:20:36 +00:00
. " $CURDIR " /../shell_config.sh
2021-02-13 17:31:37 +00:00
queries = " ${ CURDIR } /01508_partition_pruning_long.queries "
2020-09-26 01:20:36 +00:00
while IFS = read -r sql
do
[ -z " $sql " ] && continue
if [ [ " $sql " = = select * ] ] ;
then
echo " $sql "
2020-09-26 22:07:13 +00:00
${ CLICKHOUSE_CLIENT } --query " $sql "
CLICKHOUSE_CLIENT = $( echo ${ CLICKHOUSE_CLIENT } | sed 's/' " --send_logs_level= ${ CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL } " '/--send_logs_level=debug/g' )
2020-09-26 01:20:36 +00:00
${ CLICKHOUSE_CLIENT } --query " $sql " 2>& 1 | grep -oh " Selected .* parts by partition key, *. parts by primary key, .* marks by primary key, .* marks to read from .* ranges.* $"
CLICKHOUSE_CLIENT = $( echo ${ CLICKHOUSE_CLIENT } | sed 's/--send_logs_level=debug/' " --send_logs_level= ${ CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL } " '/g' )
echo ""
2021-02-13 17:31:37 +00:00
else
2020-09-26 01:20:36 +00:00
${ CLICKHOUSE_CLIENT } --query " $sql "
2021-02-13 17:31:37 +00:00
fi
2020-09-26 01:20:36 +00:00
done < " $queries "