drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Matta <cma...@mapr.com>
Subject convert unix timestamp
Date Fri, 29 May 2015 18:40:25 GMT
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 Mattacmatta@mapr.com
215-701-3146
​

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message