Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 22ECC200C3A for ; Fri, 17 Mar 2017 02:06:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 218BA160B78; Fri, 17 Mar 2017 01:06:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6C0AA160B8B for ; Fri, 17 Mar 2017 02:06:49 +0100 (CET) Received: (qmail 61866 invoked by uid 500); 17 Mar 2017 01:06:48 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 61688 invoked by uid 99); 17 Mar 2017 01:06:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Mar 2017 01:06:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D4866C028B for ; Fri, 17 Mar 2017 01:06:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id P9ZocsI-cxaR for ; Fri, 17 Mar 2017 01:06:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 427945F645 for ; Fri, 17 Mar 2017 01:06:46 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 26C49E0AE8 for ; Fri, 17 Mar 2017 01:06:43 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id CF501254C0 for ; Fri, 17 Mar 2017 01:06:41 +0000 (UTC) Date: Fri, 17 Mar 2017 01:06:41 +0000 (UTC) From: "sunjincheng (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (FLINK-6074) Fix processFunction with watermark not work well in tableAPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 17 Mar 2017 01:06:50 -0000 [ https://issues.apache.org/jira/browse/FLINK-6074?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] sunjincheng updated FLINK-6074: ------------------------------- Component/s: Table API & SQL DataStream API > Fix processFunction with watermark not work well in tableAPI > ------------------------------------------------------------ > > Key: FLINK-6074 > URL: https://issues.apache.org/jira/browse/FLINK-6074 > Project: Flink > Issue Type: Bug > Components: DataStream API, Table API & SQL > Reporter: sunjincheng > Assignee: sunjincheng > > I did a simple test and found that the same `AssignerWithPunctuatedWatermarks` and` ProcessFunction`, using sqlAPI and using `DataStreamAPI` get a different watermark, as follows: > ProcessFunction: > {code} > class CheckWaterMark extends ProcessFunction[(Long, Int, String), (Long, Int, String)] { > override def processElement(value: (Long, Int, String), > ctx: ProcessFunction[(Long, Int, String), (Long, Int, String)]#Context, > out: Collector[(Long, Int, String)]): Unit = { > println("WaterMark=" + ctx.timerService.currentWatermark()) > } > override def onTimer( > timestamp: Long, > ctx: ProcessFunction[(Long, Int, String), (Long, Int, String)]#OnTimerContext, > out: Collector[(Long, Int, String)]): Unit = ??? > } > {code} > AssignerWithPunctuatedWatermarks: > {code} > class TimestampWithLatenessWatermark extends AssignerWithPunctuatedWatermarks[(Long, > Int, String)] { > override def checkAndGetNextWatermark( > lastElement: (Long, Int, String), > extractedTimestamp: Long) > : Watermark = { > new Watermark(extractedTimestamp) > } > override def extractTimestamp( > element: (Long, Int, String), > previousElementTimestamp: Long): Long = { > element._1 > } > } > {code} > TestDATA: > {code} > val data = List( > (1L, 1, "Hello"), > (2L, 2, "Hello"), > (3L, 3, "Hello"), > (4L, 4, "Hello"), > (5L, 5, "Hello"), > (6L, 6, "Hello"), > (7L, 7, "Hello World"), > (8L, 8, "Hello World"), > (20L, 20, "Hello World")) > {code} > DataStreamAPI: > {code} > env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime) > val src = env.fromCollection(data).assignTimestampsAndWatermarks(new TimestampWithLatenessWatermark()) > src.keyBy(1).process(new TriggeringFlatMapFunction()) > Print: > WaterMark=-9223372036854775808 > WaterMark=3 > WaterMark=5 > WaterMark=7 > WaterMark=1 > WaterMark=2 > WaterMark=4 > WaterMark=8 > WaterMark=6 > {code} > SqlAPI: > {code} > val src = env.fromCollection(data).assignTimestampsAndWatermarks(new TimestampWithLatenessWatermark()) > val tab = src.toTable(tEnv).as('a, 'b, 'c) > tEnv.registerTable("T1", tab) > val sqlQuery = "SELECT " + > "count(a) OVER (ORDER BY ProcTime() ROWS BETWEEN UNBOUNDED preceding AND CURRENT ROW)" + > "from T1" > val result = tEnv.sql(sqlQuery).toDataStream[Row] > Print: > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=-9223372036854775808 > WaterMark=2 > WaterMark=6 > {code} > I feel there is a problem with sql to DataStreamAPI.Welcome anyone to correct If there any incorrect usage? -- This message was sent by Atlassian JIRA (v6.3.15#6346)