Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to handle datetime type #210

Closed
raptium opened this issue Jan 16, 2023 · 1 comment · Fixed by #216
Closed

Failed to handle datetime type #210

raptium opened this issue Jan 16, 2023 · 1 comment · Fixed by #216

Comments

@raptium
Copy link

raptium commented Jan 16, 2023

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:

  1. 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;
  1. 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
      """
  )
  1. The query fails with error message attache above.
@pan3793
Copy link
Collaborator

pan3793 commented Feb 3, 2023

It's supposed to be fixed by #216, please try master branch and reopen it if the issue still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants