RClickhouse icon indicating copy to clipboard operation
RClickhouse copied to clipboard

Support new Datatypes

Open tridelt opened this issue 5 years ago • 7 comments

New Datatypes to be added

  • [ ] Decimals
  • [ ] IPv4

Enhancements

  • [ ] improve templating design
  • [ ] add option to create nullable columns by default

tridelt avatar Jan 29 '21 21:01 tridelt

There is also missing support for IPv4. Just stumbled upon this type in my CH database and RClickhouse refused to select it...

Lupus avatar Feb 02 '21 11:02 Lupus

There is also missing support for IPv4. Just stumbled upon this type in my CH database and RClickhouse refused to select it...

@Lupus thank you very much for your suggestion, it has been added to the todos

tridelt avatar Feb 02 '21 12:02 tridelt

Can you add support for u\int128, u\int256? And custom mapping Array to vector with padding (if the array is of variable length)?

eternityowo avatar Mar 17 '22 12:03 eternityowo

Since R does not directly support bigger integer values, u\int128 and u\int256 are not that easy to implement. We would have to rely on additional packages. We'll re-evaluate existing packages and check if it is feasible.

inkrement avatar Mar 17 '22 12:03 inkrement

There still seems to be some problems with decimals for me:

> t_sale_details <- tbl(con, "T_SALE_D")

Error in `dplyr::db_query_fields()`:
! Can't query fields.
Caused by error in `fetch()`:
! cannot read unsupported type: Decimal(18,6)

zhixue-luo avatar May 10 '23 10:05 zhixue-luo

Indeed, Decimals, especially those with custom precision, are not yet supported. There is no native R type that would fit reasonably well, but there are some third-party packages. Suppose your analyses heavily rely on these data types. In that case, I recommend doing most of these calculations directly in SQL and using other data types (e.g., floats) if possible. In the long run, we'll add support based on third-party packages.

inkrement avatar May 11 '23 11:05 inkrement

Indeed, Decimals, especially those with custom precision, are not yet supported. There is no native R type that would fit reasonably well, but there are some third-party packages. Suppose your analyses heavily rely on these data types. In that case, I recommend doing most of these calculations directly in SQL and using other data types (e.g., floats) if possible. In the long run, we'll add support based on third-party packages.

Thanks for your reply! Due to permission issues, I can't modify the data type directly. Doing calculations directly in SQL is a feasible approach. But luckily, I have tried another solution that might be better, ODBC, which means you may need to install the ODBC driver first. For more specific details, see the Posit Solutions. Hope this helps people who have the same difficulties as me. : )

zhixue-luo avatar May 13 '23 03:05 zhixue-luo