mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add a test for #10893
This commit is contained in:
parent
71acb2ffda
commit
4c7923e6df
3
tests/queries/0_stateless/01719_join_timezone.reference
Normal file
3
tests/queries/0_stateless/01719_join_timezone.reference
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
2020-05-13 13:38:45 2020-05-13 16:38:45
|
||||||
|
2020-05-13 13:38:45 2020-05-13 16:38:45
|
||||||
|
2020-05-13 13:38:45 2020-05-13 16:38:45
|
45
tests/queries/0_stateless/01719_join_timezone.sql
Normal file
45
tests/queries/0_stateless/01719_join_timezone.sql
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
DROP TABLE IF EXISTS test;
|
||||||
|
|
||||||
|
CREATE TABLE test (timestamp DateTime('UTC'), i UInt8) Engine=MergeTree() PARTITION BY toYYYYMM(timestamp) ORDER BY (i);
|
||||||
|
INSERT INTO test values ('2020-05-13 16:38:45', 1);
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
toTimeZone(timestamp, 'America/Sao_Paulo') AS converted,
|
||||||
|
timestamp AS original
|
||||||
|
FROM test
|
||||||
|
LEFT JOIN (SELECT 2 AS x) AS anything ON x = i
|
||||||
|
WHERE timestamp >= toDateTime('2020-05-13T00:00:00', 'America/Sao_Paulo');
|
||||||
|
|
||||||
|
/* This was incorrect result in previous ClickHouse versions:
|
||||||
|
┌─converted───────────┬─original────────────┐
|
||||||
|
│ 2020-05-13 16:38:45 │ 2020-05-13 16:38:45 │ <-- toTimeZone is ignored.
|
||||||
|
└─────────────────────┴─────────────────────┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
toTimeZone(timestamp, 'America/Sao_Paulo') AS converted,
|
||||||
|
timestamp AS original
|
||||||
|
FROM test
|
||||||
|
-- LEFT JOIN (SELECT 2 AS x) AS anything ON x = i -- Removing the join fixes the issue.
|
||||||
|
WHERE timestamp >= toDateTime('2020-05-13T00:00:00', 'America/Sao_Paulo');
|
||||||
|
|
||||||
|
/*
|
||||||
|
┌─converted───────────┬─original────────────┐
|
||||||
|
│ 2020-05-13 13:38:45 │ 2020-05-13 16:38:45 │ <-- toTimeZone works.
|
||||||
|
└─────────────────────┴─────────────────────┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
toTimeZone(timestamp, 'America/Sao_Paulo') AS converted,
|
||||||
|
timestamp AS original
|
||||||
|
FROM test
|
||||||
|
LEFT JOIN (SELECT 2 AS x) AS anything ON x = i
|
||||||
|
WHERE timestamp >= '2020-05-13T00:00:00'; -- Not using toDateTime in the WHERE also fixes the issue.
|
||||||
|
|
||||||
|
/*
|
||||||
|
┌─converted───────────┬─original────────────┐
|
||||||
|
│ 2020-05-13 13:38:45 │ 2020-05-13 16:38:45 │ <-- toTimeZone works.
|
||||||
|
└─────────────────────┴─────────────────────┘
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TABLE test;
|
Loading…
Reference in New Issue
Block a user