Yep, that was it, thanks Christine: 0: jdbc:drill:zk=sen11:5181,sen12:5181> select date_part('hour', CAST(to_timestamp(1432912733) as timestamp)) from `sys`.`version`; +---------+ | EXPR$0 | +---------+ | 15 | +---------+
Chris Matta cma...@mapr.com <javascript:_e(%7B%7D,'cvml','cma...@mapr.com');> 215-701-3146 On Fri, May 29, 2015 at 4:22 PM, Kristine Hahn <kh...@maprtech.com <javascript:_e(%7B%7D,'cvml','kh...@maprtech.com');>> wrote: > I think TO_TIMESTAMP is what you're looking for. Please see > http://drill.apache.org/docs/data-type-conversion/#to_timestamp. > > Kristine Hahn > Sr. Technical Writer > 415-497-8107 @krishahn > > > On Fri, May 29, 2015 at 11:40 AM, Christopher Matta <cma...@mapr.com > <javascript:_e(%7B%7D,'cvml','cma...@mapr.com');>> wrote: > > > I need to be able to convert a unix timestamp to a drill timestamp. > > > > I can use the from_unixtime function return what seems like a timestamp, > or > > a string formatted correctly, however it seems like it doesn’t return it > as > > a string or as a timestamp type: > > > > 0: jdbc:drill:zk=sen11:5181,sen12:5181> select > > from_unixtime(1432912733) from `sys`.`version`; > > +----------------------+ > > | EXPR$0 | > > +----------------------+ > > | 2015-05-29 15:18:53 | > > +----------------------+ > > 1 row selected (0.134 seconds) > > > > Trying to run date-specific functions on the result: > > > > 0: jdbc:drill:zk=sen11:5181,sen12:5181> select datepart('hour', > > from_unixtime(1432912733)) from `sys`.`version`; > > Error: PARSE ERROR: From line 1, column 8 to line 1, column 50: No > > match found for function signature datepart(<CHARACTER>, <ANY>) > > > > [Error Id: aa906f4b-fa49-4a3d-9a7c-0063c7c6c97b on > > se-node10.se.lab:31010] (state=,code=0) > > > > Trying to cast it to a timestamp returns an error: > > > > 0: jdbc:drill:zk=sen11:5181,sen12:5181> select > > CAST(from_unixtime(1432912733) as TIMESTAMP) from `sys`.`version`; > > Error: SYSTEM ERROR: > > org.apache.drill.exec.exception.SchemaChangeException: Failure while > > trying to materialize incoming schema. Errors: > > > > Error in expression at index -1. Error: Missing function > > implementation: [castBIGINT(VAR16CHAR-OPTIONAL)]. Full expression: > > --UNKNOWN EXPRESSION--.. > > > > Fragment 0:0 > > > > [Error Id: 7e75d4b9-a478-40cd-80b4-fda27815b9ef on > > se-node10.se.lab:31010] (state=,code=0) > > > > Any ideas? > > > > Chris mattacma...@mapr.com > <javascript:_e(%7B%7D,'cvml','mattacma...@mapr.com');> > > 215-701-3146 > > > > > -- Chris Matta cma...@mapr.com 215-701-3146