[ 
https://issues.apache.org/jira/browse/FLINK-11220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16735450#comment-16735450
 ] 

sunjincheng commented on FLINK-11220:
-------------------------------------

Thanks Fabian,

I totally agree manually assigning timestamps and watermarks should be the last 
resort. +1

I think both `Add a query configuration` and using `CAST`  will confuse users. 
Users will ask why they need to add this configuration or  why are all row-time 
columns, one do not needs to be CAST, and others must need to be CAST?

I like the idea of add  a method (or method variant) to choose the timestamp 
that should be forwarded. In table API maybe easy, something like : 
`select('orderTime, 'payTime).withTimestamp('payTime)`. But in SQL is very 
difficult,I can see using hints to carry information, but the hints are usually 
used for optimization, and using it in set`timestamp` is a bit hard to 
understand.  Maybe I don't fully understand what you mean. 
can you explain more details?

BTW: From my points of view before toDataStream user do not need assigning 
timestamps and watermarks in SQL/TableAPI, and after toDataStream, user will 
using the DataStreamAPI and they should know well about 
`assignTimestampsAndWatermarks`.  

Best,
Jincheng

> Can not Select row time field in JOIN query
> -------------------------------------------
>
>                 Key: FLINK-11220
>                 URL: https://issues.apache.org/jira/browse/FLINK-11220
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.8.0
>            Reporter: sunjincheng
>            Priority: Major
>
> SQL:
> {code:java}
> Orders...toTable(tEnv, 'orderId, 'orderTime.rowtime)
> Payment...toTable(tEnv, 'orderId, 'payTime.rowtime)
> SELECT orderTime, o.orderId, payTime
>   FROM Orders AS o JOIN Payment AS p
>   ON o.orderId = p.orderId AND
>      p.payTime BETWEEN orderTime AND orderTime + INTERVAL '1' HOUR
> {code}
> Execption:
> {code:java}
> org.apache.flink.table.api.TableException: Found more than one rowtime field: 
> [orderTime, payTime] in the table that should be converted to a DataStream.
> Please select the rowtime field that should be used as event-time timestamp 
> for the DataStream by casting all other fields to TIMESTAMP.
> at 
> org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:906)
> {code}
> The reason for the error is that we have 2 time fields `orderTime` and  
> `payTime`.  I think we do not  need throw the exception, and we can remove 
> the logic of `plan.process(new OutputRowtimeProcessFunction[A](conversion, 
> rowtimeFields.head.getIndex))`, if we want using the timestamp after 
> toDataSteram, we should using `assignTimestampsAndWatermarks()`.
> What do you think ? [~twalthr] [~fhueske] 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to