dbDataType: Return the corresponding presto data type for the given R...

Description Usage Arguments Details Value Examples

Description

Return the corresponding presto data type for the given R object

Usage

1
2
## S4 method for signature 'PrestoDriver'
dbDataType(dbObj, obj, ...)

Arguments

dbObj

A PrestoDriver object

obj

Any R object

...

Extra optional parameters, not currently used

Details

The default value for unknown classes is ‘VARCHAR’.

‘ARRAY’s and ‘MAP’s are supported with some caveats. Unnamed lists will be treated as ‘ARRAY’s and named lists will be a ‘MAP’. All items are expected to be of the same corresponding Presto type, otherwise the default ‘VARCHAR’ value is returned. The key type for ‘MAP’s is always ‘VARCHAR’. The ‘value’ type for empty lists is always a ‘VARCHAR’.

Value

A character value corresponding to the Presto type for obj

Examples

1
2
3
4
5
6
7
8
9
drv <- RPresto::Presto()
dbDataType(drv, list())
dbDataType(drv, 1)
dbDataType(drv, NULL)
dbDataType(drv, list(list(list(a=Sys.Date()))))
dbDataType(drv, as.POSIXct('2015-03-01 00:00:00', tz='UTC'))
dbDataType(drv, Sys.time())
# Data types for ARRAY or MAP values can be tricky
all.equal('VARCHAR', dbDataType(drv, list(1, 2, 3L)))

RPresto documentation built on Sept. 5, 2021, 5:34 p.m.