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

wxmimperio edited comment on FLINK-20378 at 11/27/20, 4:10 AM:
---------------------------------------------------------------

[~jark]
 Thank you for your answer.
 However, I always feel that flink's time system is very strange and very 
unfriendly to users in non-UTC time zones.
  
 For example, my machine is in GMT+8 and GMT+8 is my default time zone.
 However, the way to calculate time in flink starts from UTC.

For example,the following code:
{code:java}
long days = mss / (1000 * 60 * 60 * 24);
long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
long seconds = (mss % (1000 * 60)) / 1000;{code}
*The TIMESTAMP_WITHOUT_TIME_ZONE will cause me to always delay 8 hours when 
using functions such as HOUR(), CAST(TIMESTAMP AS DATE), etc.*
 But when I want to use time zone to participate in calculation, wartermark 
does not support it.
  


was (Author: wxmimperio):
[~jark]
Thank you for your answer.
However, I always feel that flink's time system is very strange and very 
unfriendly to users in non-UTC time zones.
 
For example, my machine is in GTM+8 and GTM+8 is my default time zone.
However, the way to calculate time in flink starts from UTC.

For example,the following code:
{code:java}
long days = mss / (1000 * 60 * 60 * 24);
long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
long seconds = (mss % (1000 * 60)) / 1000;{code}
*The TIMESTAMP_WITHOUT_TIME_ZONE will cause me to always delay 8 hours when 
using functions such as HOUR(), CAST(TIMESTAMP AS DATE), etc.*
But when I want to use time zone to participate in calculation, wartermark does 
not support it.
 

> Watermark generation check TIMESTAMP_WITHOUT_TIME_ZONE
> ------------------------------------------------------
>
>                 Key: FLINK-20378
>                 URL: https://issues.apache.org/jira/browse/FLINK-20378
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.1
>            Reporter: wxmimperio
>            Priority: Major
>
>  
>  
> {code:java}
>  def generateWatermarkGenerator(
>       config: TableConfig,
>       inputType: RowType,
>       watermarkExpr: RexNode): GeneratedWatermarkGenerator = {
>     // validation
>     val watermarkOutputType = 
> FlinkTypeFactory.toLogicalType(watermarkExpr.getType)
>     if (watermarkOutputType.getTypeRoot != 
> LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE) {
>       throw new CodeGenException(
>         "WatermarkGenerator only accepts output data type of TIMESTAMP," +
>           " but is " + watermarkOutputType)
>     }
> {code}
>  
> Why does watermark generation need to be detected as 
> TIMESTAMP_WITHOUT_TIME_ZONE?
> If I remove this check, what effect will it have on the watermark?
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to