Failed to handle datetime type
raptium opened this issue · 1 comments
raptium commented
When my query contains where conditions on datetime columns, clickhouse complains with something like
Caused by: com.clickhouse.client.ClickHouseException: Code: 53. DB::Exception: Cannot convert string 2023-01-13 12:00:00.0 to type DateTime: while executing 'FUNCTION greaterOrEquals(event_time : 4, '2023-01-13 12:00:00.0' : 10) -> greaterOrEquals(event_time, '2023-01-13 12:00:00.0') UInt8 : 13'. (TYPE_MISMATCH) (version 22.1.3.7 (official build))
, server ClickHouseNode [uri=http://127.0.0.1:8123/default]@1555077171
Steps to reproduce:
- Create a table in clickhouse with a column in datetime
create table if not exists default.user_event
(
event_time DateTime,
event_id String,
event_name String,
event_properties String
)
engine = MergeTree PARTITION BY toYYYYMM(event_time) ORDER BY event_time;
- Issue query with spark-clickhouse-connector
spark.sql(
"""
SELECT *
FROM clickhouse.default.user_event
WHERE event_name = 'test'
AND event_time >= '2023-01-13 12:00:00'
LIMIT 10000
"""
)
- The query fails with error message attache above.