Currently cast('input_string' as timestamp) will work only if your input
is in the following format: "yyyy-mm-dd hh:mm:ss.sss".
If you have a custom Timestamp input string you should be able to use
to_timestamp().
Here is an example for the string you mentioned:
0: jdbc:drill:zk=local> select to_timestamp('Mon Nov 24 18:18:22
2014', 'EEE MMM dd HH:mm:ss YYYY') from dfs.`/tmp/a.json`;
+------------+
| EXPR$0 |
+------------+
| 2014-11-24 18:18:22.0 |
+------------+
For the format specifiers to use look at:
http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
One thing to note is that I don't have timezone information in my input
string, this is because Drill does not support Timestamp with time zone
data type, currently we seem to be doing something with the timezone
which is a bug and I will file a JIRA so that we completely ignore any
timezone information
Thanks
Mehant
On 11/26/14, 9:17 AM, Christopher Matta wrote:
If I have a string like this (from Twitter): “Mon Nov 24 18:18:22 +0000
2014” is there a way to cast that as a timestamp, or date type?
Twitter also provides: "timestamp_ms": "1416853102087"
Any way to cast that as a timestamp with Drill?
Chris Matta
[email protected]
215-701-3146