Date values outside of ClickHouse accepted date range overflow/underflow
JSchoenbachler opened this issue · 0 comments
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):
- 1974-10-01
- 1970-01-01
- 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.