mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Fix tests after session_timezone randomization
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
bc167dfde8
commit
6ae4d29180
@ -5,4 +5,5 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
env TZ=UTC ${CLICKHOUSE_CLIENT} --use_client_time_zone=1 --query="SELECT toDateTime(1000000000)"
|
||||
# NOTE: session_timezone overrides use_client_time_zone, disable it randomization
|
||||
env TZ=UTC ${CLICKHOUSE_CLIENT} --session_timezone '' --use_client_time_zone=1 --query="SELECT toDateTime(1000000000)"
|
||||
|
@ -7,11 +7,12 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
function perform()
|
||||
{
|
||||
local query=$1
|
||||
TZ=UTC $CLICKHOUSE_CLIENT \
|
||||
--allow_deprecated_syntax_for_merge_tree=1 \
|
||||
--use_client_time_zone=1 \
|
||||
--input_format_values_interpret_expressions=0 \
|
||||
--query "$query" 2>/dev/null
|
||||
local settings=(
|
||||
--allow_deprecated_syntax_for_merge_tree 1
|
||||
--session_timezone UTC
|
||||
--input_format_values_interpret_expressions 0
|
||||
)
|
||||
TZ=UTC $CLICKHOUSE_CLIENT "${settings[@]}" --query "$query" 2>/dev/null
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "query failed"
|
||||
fi
|
||||
|
@ -1,3 +1,15 @@
|
||||
-- disable timezone randomization since otherwise TTL may fail at particular datetime, i.e.:
|
||||
--
|
||||
-- SELECT
|
||||
-- now(),
|
||||
-- toDate(toTimeZone(now(), 'America/Mazatlan')),
|
||||
-- today()
|
||||
--
|
||||
-- ┌───────────────now()─┬─toDate(toTimeZone(now(), 'America/Mazatlan'))─┬────today()─┐
|
||||
-- │ 2023-07-24 06:24:06 │ 2023-07-23 │ 2023-07-24 │
|
||||
-- └─────────────────────┴───────────────────────────────────────────────┴────────────┘
|
||||
set session_timezone = '';
|
||||
|
||||
drop table if exists ttl_00933_1;
|
||||
|
||||
-- Column TTL works only with wide parts, because it's very expensive to apply it for compact parts
|
||||
|
@ -7,8 +7,8 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
# Run the client.
|
||||
$CLICKHOUSE_CLIENT --multiquery <<'EOF'
|
||||
# NOTE: dictionaries TTLs works with server timezone, so session_timeout cannot be used
|
||||
$CLICKHOUSE_CLIENT --session_timezone '' --multiquery <<'EOF'
|
||||
DROP DATABASE IF EXISTS dictdb_01042;
|
||||
CREATE DATABASE dictdb_01042;
|
||||
CREATE TABLE dictdb_01042.table(x Int64, y Int64, insert_time DateTime) ENGINE = MergeTree ORDER BY tuple();
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
set mutations_sync = 2;
|
||||
|
||||
-- system.parts has server default, timezone cannot be randomized
|
||||
set session_timezone = '';
|
||||
|
||||
drop table if exists ttl;
|
||||
|
||||
create table ttl (d Date, a Int) engine = MergeTree order by a partition by toDayOfMonth(d)
|
||||
|
@ -5,7 +5,8 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "
|
||||
# NOTE: dictionaries will be updated according to server TZ, not session, so prohibit it's randomization
|
||||
$CLICKHOUSE_CLIENT --session_timezone '' -q "
|
||||
CREATE TABLE table_for_update_field_dictionary
|
||||
(
|
||||
key UInt64,
|
||||
|
Loading…
Reference in New Issue
Block a user