-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Wrong index analysis when Date is compared with DateTime #10102
Copy link
Copy link
Closed
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasecomp-datetimeDate/DateTime/TimeZone datatypes and date-time semantics.Date/DateTime/TimeZone datatypes and date-time semantics.
Description
This issue has been suggested on 42th ClickHouse meetup that was held online.
The recording is available here: https://www.youtube.com/watch?v=QQSCn6nbyN8 (russian)
Describe the bug
milovidov-desktop :) CREATE TABLE test.index (d Date) ENGINE = MergeTree ORDER BY d
CREATE TABLE test.index
(
`d` Date
)
ENGINE = MergeTree
ORDER BY d
Ok.
0 rows in set. Elapsed: 0.009 sec.
milovidov-desktop :) INSERT INTO test.index VALUES ('2020-04-07')
INSERT INTO test.index VALUES
Ok.
1 rows in set. Elapsed: 0.007 sec.
milovidov-desktop :) SELECT * FROM test.index WHERE d > toDateTime('2020-04-06 23:59:59')
SELECT *
FROM test.index
WHERE d > toDateTime('2020-04-06 23:59:59')
Ok.
0 rows in set. Elapsed: 0.017 sec.
milovidov-desktop :) SELECT * FROM test.index WHERE identity(d > toDateTime('2020-04-06 23:59:59'))
SELECT *
FROM test.index
WHERE identity(d > toDateTime('2020-04-06 23:59:59'))
┌──────────d─┐
│ 2020-04-07 │
└────────────┘
1 rows in set. Elapsed: 0.023 sec.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasecomp-datetimeDate/DateTime/TimeZone datatypes and date-time semantics.Date/DateTime/TimeZone datatypes and date-time semantics.