IMSMWU/RClickhouse

Support for Date32 data type

Opened this issue · 2 comments

R-Version: 4.2.2
RClickhouse Version: 0.6.7
Clickhouse Version: 23.3.2.37

Currently seems there is no support for the Date32 or Nullable(Date32) data types in the driver.

Reproducing:

  1. Create a table in clickhouse
create table default.test_table(
id int, date_32 Date32, date_32_null Nullable(Date32)
)
engine=MergeTree()
order by id
;

insert into default.test_table (id, date_32, date_32_null)
values (1, '1966-01-01'::Date32, Null);
  1. Run a select query in R on integer column, succeeds
DBI::dbGetQuery(pool::localCheckout(DW_POOL), "select id from default.test_table")
  id
1  1
  1. Run a select on either other column fails
> DBI::dbGetQuery(pool::localCheckout(DW_POOL), "select id, date_32 from default.test_table")
Error in select(conn@ptr, statement) : some data was not readed

DBI::dbGetQuery(pool::localCheckout(DW_POOL), "select id, date_32_null from default.test_table")
Error in select(conn@ptr, statement) : some data was not readed

dplyr::tbl(pool::localCheckout(DW_POOL), DBI::Id(schema="default", table="test_table"))
Error in fetch(res@ptr, n) : cannot read unsupported type: Void

Yes, there is no support for these data types (Date32 and Datetime64). The reason is that they were added relatively recently, and we did not have time yet to add them. Meanwhile, you can convert them to timestamps (Seconds/Milliseconds since 1970) and transfer them as unsigned integers.

Thanks for the workaround!