Hi,

This small UDF project contains a asTimestamp function that you may find
useful:
https://github.com/activitystream/asdrill

It accepts multiple value types and returns them as timestamp.

Feel free to do with it what you will :)

Regards,
 -Stefán

On Wed, Feb 3, 2016 at 6:22 PM, Jason Altekruse <[email protected]>
wrote:

> Oscar is trying accomplish the same date parsing in this JIRA [1]. As he is
> doing in his examples, you can escape a single quote with another single
> quote.
>
> I tried briefly to reproduce this issues reported here and I wasn't able to
> see the same failure on a similar query.
>
> Note: below these are two single quotes, not double quotes
> This is working for me: select to_timestamp('2016-01-08T15:00:15-05:00',
> 'yyyy-MM-dd''T''HH:mm:ssZ') from (values(1));
>
> [1] - https://issues.apache.org/jira/browse/DRILL-4341
>
> On Wed, Feb 3, 2016 at 9:40 AM, Christopher Matta <[email protected]> wrote:
>
> > What’s the best way to convert this ISO 8601 timestamp to a drill
> timestamp
> > type?
> >
> > Tried this:
> >
> > 0: jdbc:drill:> select to_timestamp('2016-01-08T15:00:15-05:00') from
> > sys.version;
> > Error: SYSTEM ERROR: DrillRuntimeException: Failure while
> > materializing expression in constant expression evaluator
> > [TO_TIMESTAMP('2016-01-08T15:00:15-05:00')].  Errors:
> > Error in expression at index -1.  Error: Missing function
> > implementation: [castTINYINT(VARCHAR-REQUIRED)].  Full expression:
> > --UNKNOWN EXPRESSION--.
> >
> > [Error Id: 85cfdbb6-3b60-44a6-922c-acec0b5e1c18 on
> > se-node11.se.lab:31010] (state=,code=0)
> >
> > and this:
> >
> > 0: jdbc:drill:> select to_timestamp('2016-01-08T15:00:15-05:00',
> > 'yyyy-MM-ddTHH:mm:ssZ') from sys.version;
> > Error: SYSTEM ERROR: IllegalArgumentException: Illegal pattern
> component: T
> >
> > [Error Id: b6b0cb7e-681c-4b34-a64f-788e16a7b157 on
> > se-node11.se.lab:31010] (state=,code=0)
> >
> > How can I escape that T character? In Java I would escape it with the
> > single quote, but Drill won’t take that because the time format needs to
> be
> > wrapped in single quotes.
> >
> > Chris [email protected]
> > 215-701-3146
> > ​
> >
>

Reply via email to