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

Date values outside of ClickHouse accepted date range overflow/underflow #74

Open
JSchoenbachler opened this issue Sep 28, 2020 · 0 comments

Comments

@JSchoenbachler
Copy link
Contributor

When supplying date values outside of the accepted date range of ClickHouse date columns (1970-01-01 to 2105: https://clickhouse.tech/docs/en/sql-reference/data-types/date/) RClickhouse overflows/underflows the date instead of setting to the minimum or maximum date value.

I created and inserted the following 3 data.table variables using RClickhouse:

data.table(pmid = 654321, pub_status = 'test1', pub_date = as.Date('0001-01-01'))
data.table(pmid = 654321, pub_status = 'test2', pub_date = as.Date('1970-01-01'))
data.table(pmid = 654321, pub_status = 'test3', pub_date = as.Date('0001-01-05'))

Which yielded the following results (respectively):

  1. 1974-10-01
  2. 1970-01-01
  3. 1974-10-05

As you can see, the overflow/underflow transforms 0001-01-01 to 1974-10-01. It also transforms the date 0001-01-05 to it's respective 4 days later value 1974-10-05.

This is different from the behavior expected when you manually execute insert statements on a ClickHouse database, as it simply just sets anything lower than the accepted range as the minimum value and higher as the max value.

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

No branches or pull requests

1 participant