Re: timestamp parsing in create table statement

2020-11-10 Thread Fanbin Bu
Thanks Jark, I confused it with the normal sql syntax. now it works (after changing it to HH:mm:ss.SS...) Fanbin On Tue, Nov 10, 2020 at 7:24 PM Jark Wu wrote: > Oh, sorry, the example above is wrong. The column name should come first. > So the full example should be: > > create table t (

Re: timestamp parsing in create table statement

2020-11-10 Thread Jark Wu
Oh, sorry, the example above is wrong. The column name should come first. So the full example should be: create table t ( user_id string, action string, ts string, new_ts AS TO_TIMESTAMP(ts, '-MM-dd''T''HH:mm:ss.SSS''Z'''), watermark for new_ts as new_ts - interval '5' second ) with

Re: timestamp parsing in create table statement

2020-11-10 Thread Fanbin Bu
Jark, Thanks for the quick response. I tried to_timestamp(ts, ...), but got the following error: Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "(" at line looks like it complains about the second `(` in create table t (... to_timestamp(..

Re: timestamp parsing in create table statement

2020-11-10 Thread Jark Wu
Hi Fanbin, The example you gave is correct: create table t ( user_id string, action string, ts string, transform_ts_format(ts) as new_ts, watermark for new_ts as new_ts - interval '5' second ) with ( ... ) You can use "TO_TIMESTAMP" built-in function instead of the UDF, e.g. TO_TIMEST

Re: timestamp parsing in create table statement

2020-11-10 Thread Fanbin Bu
In the `computed column` section of [1], i saw some related doc: ``` On the other hand, computed column can be used to derive event time column because an event time column may need to be derived from existing fields, e.g. the original field is not TIMESTAMP(3) type or is nested in a JSON string.

Re: timestamp parsing in create table statement

2020-11-10 Thread Fanbin Bu
i also tried: ts TIMESTAMP WITH LOCAL TIME ZONE but it failed with Rowtime attribute 'ts' must be of type TIMESTAMP but is of type 'TIMESTAMP(6) WITH LOCAL TIME ZONE'. On Tue, Nov 10, 2020 at 5:42 PM Fanbin Bu wrote: > Hi, > > I have source json data like: > {"ts": "2020-11-09T20:26:10.368123Z"