[
https://issues.apache.org/jira/browse/FLINK-23026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17365286#comment-17365286
]
Jark Wu commented on FLINK-23026:
---------------------------------
This is as expected, because your watermark value is {{"onSellTime - INTERVAL
'0' SECOND"}}. According to watermark definition:
> A watermark signifies that no events with a timestamp **smaller or equal** to
> the watermark's time will occur after the water.
That means, your second record {{ITEM002,Electronic,2017-11-11 10:02:00,50}} is
recognized as late event and will be dropped, results for timestamp
{{2017-11-11 10:02:00}} has been outputed.
> OVER WINDOWS function lost data
> -------------------------------
>
> Key: FLINK-23026
> URL: https://issues.apache.org/jira/browse/FLINK-23026
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API, Table SQL / Client
> Affects Versions: 1.12.1
> Reporter: MOBIN
> Priority: Critical
> Attachments: image-2021-06-18-10-54-18-125.png
>
>
> {code:java}
> Flink SQL> CREATE TABLE tmall_item(
> > itemID VARCHAR,
> > itemType VARCHAR,
> > eventtime varchar,
> > onSellTime AS TO_TIMESTAMP(eventtime),
> > price DOUBLE,
> > WATERMARK FOR onSellTime AS onSellTime - INTERVAL '0' SECOND
> > ) with (
> > 'connector.type' = 'kafka',
> > 'connector.version' = 'universal',
> > 'connector.topic' = 'items',
> > 'format.type' = 'csv',
> > 'connector.properties.bootstrap.servers' = 'localhost:9092'
> > );
> >
> [INFO] Table has been created.
> Flink SQL> SELECT
> > itemType,
> > COUNT(itemID) OVER (
> > PARTITION BY itemType
> > ORDER BY onSellTime
> > RANGE BETWEEN INTERVAL '1' DAY preceding AND CURRENT ROW) AS cot
> > FROM tmall_item;
> {code}
> When I enter the following data into the topic, its Electronic count value is
> 3, which should normally be 4. If the event time and the value of the
> partition field are the same, data will be lost
> ITEM001,Electronic,2017-11-11 10:01:00,20
> {color:#ff0000}ITEM002{color},Electronic,{color:#ff0000}2017-11-11
> 10:02:00{color},50
> {color:#ff0000}ITEM002{color},Electronic,{color:#ff0000}2017-11-11
> 10:02:00{color},50
> ITEM003,Electronic,2017-11-11 10:03:00,50
> !image-2021-06-18-10-54-18-125.png|width=1156,height=192!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)