Re: Unittesting ProcessWindowFunction in Scala

2024-11-14 Thread Alexey Novakov via user
gt; ``` > package org.example > > import org.apache.flink.streaming.api.scala.function.ProcessWindowFunction > import org.apache.flink.streaming.api.windowing.windows.TimeWindow > import org.apache.flink.util.Collector > > class ScalaSessionProcessWindowFunction extends > ProcessWindowFunction[(String, Lo

Unittesting ProcessWindowFunction in Scala

2024-11-13 Thread Burak Dursunlar
org.apache.flink.util.Collector class ScalaSessionProcessWindowFunction extends ProcessWindowFunction[(String, Long), (String, Long, Long), String, TimeWindow]{ override def process(key: String, context: Context, elements: Iterable[(String, Long)], out: Collector[(String, Long, Long)]): Unit = { val maxId

回复: ProcessWindowFunction Parallelism

2023-09-26 Thread Chen Zhanghao
发件人: patricia lee 发送时间: 2023年9月26日 21:30 收件人: user@flink.apache.org 主题: ProcessWindowFunction Parallelism Hi, Are processwindowfunctions cannot have more than 1 parallelism? Whenever I set it to 2, I am receiving an error message, "The parallelism of non parallel operator must

ProcessWindowFunction Parallelism

2023-09-26 Thread patricia lee
Hi, Are processwindowfunctions cannot have more than 1 parallelism? Whenever I set it to 2, I am receiving an error message, "The parallelism of non parallel operator must be 1." dataKafka = Kafkasource (datasource) .parallelism(2) .rebalance(); dataKafka.windowAll(GlobalWindows.create()).trigge

Re: How to sort Iterable in ProcessWindowFunction?

2022-03-07 Thread HG
lds of the Tuple4 that is in the Iterator. >> >> Any advice as to what the best way is? >> >> static class MyProcessWindowFunction extends >> ProcessWindowFunction, String, String, >> TimeWindow> { >> @Override >>

Re: How to sort Iterable in ProcessWindowFunction?

2022-03-07 Thread HG
>> >> static class MyProcessWindowFunction extends >> ProcessWindowFunction, String, String, >> TimeWindow> { >> @Override >> public void process(String key, Context context, >> Iterable> input, Collector out) >> { >>

Re: How to sort Iterable in ProcessWindowFunction?

2022-03-06 Thread yidan zhao
t; > static class MyProcessWindowFunction extends > ProcessWindowFunction, String, String, > TimeWindow> { > @Override > public void process(String key, Context context, > Iterable> input, Collector out) > { > Long elapsed = 0L; >

Re: How to sort Iterable in ProcessWindowFunction?

2022-03-03 Thread HG
Hi, I have need to sort the input of the ProcesWindowFunction by one of the fields of the Tuple4 that is in the Iterator. Any advice as to what the best way is? static class MyProcessWindowFunction extends ProcessWindowFunction, String, String, TimeWindow> { @Override pub

How to sort Iterable in ProcessWindowFunction?

2022-03-03 Thread HG
Hi, I have need to sort the input of the ProcesWindowFunction by one of the fields of the Tuple4 that is in the Iterator. static class MyProcessWindowFunction extends ProcessWindowFunction, String, String, TimeWindow> { @Override public void process(String key, Context cont

Re: processwindowfunction output Iterator

2022-03-01 Thread HG
s 😊 > > > > Thias > > > > > > *From:* HG > *Sent:* Montag, 28. Februar 2022 16:25 > *To:* user > *Subject:* processwindowfunction output Iterator > > > > Hi, > > > > > > Can processwindowfunction output an Iterator? > > I need to sort

RE: processwindowfunction output Iterator

2022-03-01 Thread Schwalbe Matthias
Goedemorgen Hans, You can call the out.collect(…) multiple times, i.e. for each forwarded event … how about this 😊 Thias From: HG Sent: Montag, 28. Februar 2022 16:25 To: user Subject: processwindowfunction output Iterator Hi, Can processwindowfunction output an Iterator? I need to sort

processwindowfunction output Iterator

2022-02-28 Thread HG
Hi, Can processwindowfunction output an Iterator? I need to sort and subtract timestamps from keyed events and then output them all with added elapsed times. Regards Hans

Re: clear() in a ProcessWindowFunction

2021-04-10 Thread Vishal Santoshi
ate is not allowed).. > > > The state is scoped to the key (created per key in the > ProcessWindowFunction with a ttl ) > Yes. > > > The state will remain alive irrespective of whether the Window is closed > or not (a TTL timer does the collection ) > Right, but you n

Re: clear() in a ProcessWindowFunction

2021-04-09 Thread Roman Khachatryan
Hi Vishal, Sorry for the late reply, Please find my answers below. By state I assume the state obtained via getRuntimeContext (access to window state is not allowed).. > The state is scoped to the key (created per key in the ProcessWindowFunction > with a ttl ) Yes. > The state wi

Re: clear() in a ProcessWindowFunction

2021-03-31 Thread Vishal Santoshi
I had a query Say I have a single key with 2 live sessions ( A and B ) with a configured lateness . Do these invariants hold? * The state is scoped to the key (created per key in the ProcessWindowFunction with a ttl ) * The state will remain alive irrespective of whether the Window is closed or

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
to achieve and why do you need > to combine > >>> sliding windows with state scoped to window+key? > >>> > >>> Regards, > >>> Roman > >>> > >>> On Fri, Mar 12, 2021 at 5:13 AM Vishal Santoshi > >>> wrote: > >>&

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Roman Khachatryan
you are trying to achieve and why do you need to >>> combine >>> sliding windows with state scoped to window+key? >>> >>> Regards, >>> Roman >>> >>> On Fri, Mar 12, 2021 at 5:13 AM Vishal Santoshi >>> wrote: >>

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
l Santoshi >> wrote: >> > >> > Essentially, Does this code leak state >> > >> > private static class SessionIdProcessWindowFunction> java.io.Serializable, VALUE extends java.io.Serializable> >> > extends >> > ProcessWindowFunction, >

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
t; private static class SessionIdProcessWindowFunction java.io.Serializable, VALUE extends java.io.Serializable> > > extends > > ProcessWindowFunction, > KeyedSessionWithSessionID, KEY, TimeWindow> { > > private static final long serialVersionUID = 1L; > > priv

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Roman Khachatryan
? Regards, Roman On Fri, Mar 12, 2021 at 5:13 AM Vishal Santoshi wrote: > > Essentially, Does this code leak state > > private static class SessionIdProcessWindowFunction java.io.Serializable, VALUE extends java.io.Serializable> > extends > ProcessWindowFunction, > KeyedS

Re: clear() in a ProcessWindowFunction

2021-03-11 Thread Vishal Santoshi
Essentially, Does this code leak state private static class SessionIdProcessWindowFunction extends ProcessWindowFunction, KeyedSessionWithSessionID< KEY, VALUE>, KEY, TimeWindow> { private static final long serialVersionUID = 1L; private final static ValueStateDescriptor sessio

clear() in a ProcessWindowFunction

2021-03-11 Thread Vishal Santoshi
Hello folks, The suggestion is to use windowState() for a key key per window state and clear the state explicitly. Also it seems that getRuntime().getState() will return a globalWindow() where state is shared among windows with the same key. I desire of course to have state scope

Re: How to use ProcessWindowFunction in pyflink?

2021-02-24 Thread Arvid Heise
;d')) [1] https://issues.apache.org/jira/browse/FLINK-21202 [2] https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/python/table-api-users-guide/operations.html#aggregations On Fri, Feb 19, 2021 at 8:26 AM Hongyuan Ma wrote: > Greetings, > > I am a newbie to pyflink. I

How to use ProcessWindowFunction in pyflink?

2021-02-18 Thread Hongyuan Ma
Greetings, I am a newbie to pyflink. I want to be able to use processWindowFunction in a Tumble Window, and finally output 0 or more lines. I have checked the datastreamAPI and TableAPI of pyflink, but have not found a complete example. pyflink's datastream API does not seem to impl

Re: What is the difference between RuntimeContext state and ProcessWindowFunction.Context state when using a ProcessWindowFunction?

2021-02-11 Thread Arvid Heise
lobos wrote: > Hi, > > I am having a difficult time distinguishing the difference between > RuntimeContext state and global state when using a ProcessWindowFunction. > > A ProcessWindowFunction has three access different kinds of state. > 1. RuntimeContext state. > 2.

What is the difference between RuntimeContext state and ProcessWindowFunction.Context state when using a ProcessWindowFunction?

2021-02-09 Thread Marco Villalobos
Hi, I am having a difficult time distinguishing the difference between RuntimeContext state and global state when using a ProcessWindowFunction. A ProcessWindowFunction has three access different kinds of state. 1. RuntimeContext state. 2. ProcessWindowFunction.Context global state 3

Re: Firing timers on ProcessWindowFunction

2019-12-02 Thread Avi Levi
val interval . >>> >>> On Mon, Dec 2, 2019 at 10:59 AM vino yang wrote: >>> >>>> *This Message originated outside your organization.* >>>> -- >>>> Hi Avi, >>>> >>>> Firstly, let's c

Re: Firing timers on ProcessWindowFunction

2019-12-02 Thread Avi Levi
t;> Vino >> >> >> Avi Levi 于2019年12月2日周一 下午4:11写道: >> >>> Hi, >>> Is there a way to fire timer in a ProcessWindowFunction ? I would like >>> to mutate the global state on a timely basis. >>> >>>

Re: Firing timers on ProcessWindowFunction

2019-12-02 Thread Avi Levi
; Best, > Vino > > > Avi Levi 于2019年12月2日周一 下午4:11写道: > >> Hi, >> Is there a way to fire timer in a ProcessWindowFunction ? I would like to >> mutate the global state on a timely basis. >> >>

Re: Firing timers on ProcessWindowFunction

2019-12-02 Thread vino yang
Hi Avi, Firstly, let's clarify that the "timer" you said is the timer of the window? Or a timer you want to register to trigger some action? Best, Vino Avi Levi 于2019年12月2日周一 下午4:11写道: > Hi, > Is there a way to fire timer in a ProcessWindowFunction ? I would like to >

Firing timers on ProcessWindowFunction

2019-12-02 Thread Avi Levi
Hi, Is there a way to fire timer in a ProcessWindowFunction ? I would like to mutate the global state on a timely basis.

Re: Testing AggregateFunction() and ProcessWindowFunction() on KeyedDataStream

2019-10-28 Thread vino yang
erWithClientResource in order to use > StreamExecutionEnvironment? > > > > > > Best, > > Michael > > > > > > *From: *vino yang > *Date: *Monday, October 28, 2019 at 1:32 AM > *To: *Michael Nguyen > *Cc: *"user@flink.apache.org" > *Subjec

Re: Testing AggregateFunction() and ProcessWindowFunction() on KeyedDataStream

2019-10-28 Thread Nguyen, Michael
From: vino yang Date: Monday, October 28, 2019 at 1:32 AM To: Michael Nguyen Cc: "user@flink.apache.org" Subject: Re: Testing AggregateFunction() and ProcessWindowFunction() on KeyedDataStream [External] Hi Michael, You may need to know `KeyedOneInputStreamOperatorTestHarness`

Re: Testing AggregateFunction() and ProcessWindowFunction() on KeyedDataStream

2019-10-28 Thread vino yang
e tried testing AggregateFunction() and ProcessWindowFunction() > on a KeyedDataStream? I have reviewed the testing page on Flink’s official > website ( > https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/testing.html) > and I am not quite sure how I could utilize these two f

Testing AggregateFunction() and ProcessWindowFunction() on KeyedDataStream

2019-10-28 Thread Nguyen, Michael
Hello everbody, Has anyone tried testing AggregateFunction() and ProcessWindowFunction() on a KeyedDataStream? I have reviewed the testing page on Flink’s official website (https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/testing.html) and I am not quite sure how I could

Re: Increasing trend for state size of keyed stream using ProcessWindowFunction with ProcessingTimeSessionWindows

2019-10-04 Thread Oliwer Kostera
you mean by windowState.clear(). As far as I understand you correctly it's a windowState from ProcessWindowFunction Context which is KeyedStateStore. KeyedStateStore is managing registered keyed states that I don't have, so without a descriptor I can't access any clear() method. There is no stat

Re: Increasing trend for state size of keyed stream using ProcessWindowFunction with ProcessingTimeSessionWindows

2019-10-02 Thread Fabian Hueske
ly it's a windowState from ProcessWindowFunction Context which > is KeyedStateStore. KeyedStateStore is managing registered keyed states > that I don't have, so without a descriptor I can't access any clear() > method. There is no state that I manage explicitly as you can see he

Re: Increasing trend for state size of keyed stream using ProcessWindowFunction with ProcessingTimeSessionWindows

2019-10-01 Thread Oliwer Kostera
Hi, I'm no sure what you mean by windowState.clear(). As far as I understand you correctly it's a windowState from ProcessWindowFunction Context which is KeyedStateStore. KeyedStateStore is managing registered keyed states that I don't have, so without a descriptor I can

Re: Increasing trend for state size of keyed stream using ProcessWindowFunction with ProcessingTimeSessionWindows

2019-09-30 Thread Congxian Qiu
下午4:14写道: > Hi all, > > > I'm using *ProcessWindowFunction* in a keyed stream with the following > definition: > > final SingleOutputStreamOperator processWindowFunctionStream = > > keyedStream.window(ProcessingTimeSessionWindows.withGap(Time.millisecon

Increasing trend for state size of keyed stream using ProcessWindowFunction with ProcessingTimeSessionWindows

2019-09-27 Thread Oliwer Kostera
Hi all, I'm using ProcessWindowFunction in a keyed stream with the following definition: final SingleOutputStreamOperator processWindowFunctionStream = keyedStream.window(ProcessingTimeSessionWindows.withGap(Time.milliseconds(100))) .process(new CustomProcessWindowFun

Re: Table API and ProcessWindowFunction

2019-07-11 Thread Hequn Cheng
get the window start and end >>>>> with `TimeWindow.getWindowStartWithOffset()`. For even time, you can get >>>>> the timestamp from the rowtime field. >>>>> >>>>> With the start and end time, you can then perform LATERAL JOIN to >>

Re: Table API and ProcessWindowFunction

2019-07-11 Thread Flavio Pompermaier
IN to >>>> enrich the information. You can add a cache in your table function to avoid >>>> frequent contacting with the REST endpoint. >>>> >>>> Best, Hequn >>>> >>>> >>>> On Mon, Jul 8, 2019 at 10:46 PM Flavio Pompermai

Re: Table API and ProcessWindowFunction

2019-07-11 Thread Flavio Pompermaier
rich >>> the information. You can add a cache in your table function to avoid >>> frequent contacting with the REST endpoint. >>> >>> Best, Hequn >>> >>> >>> On Mon, Jul 8, 2019 at 10:46 PM Flavio Pompermaier >>> wrote: >

Re: Table API and ProcessWindowFunction

2019-07-10 Thread Hequn Cheng
;>> What I'm trying to do is to read a stream of events that basically >>> contains a UserId field and, every X minutes (i.e. using a Time Window) and >>> for each different UserId key, query 3 different REST services to enrich my >>> POJOs*. >>> For t

Re: Table API and ProcessWindowFunction

2019-07-10 Thread Flavio Pompermaier
stream of events that basically >> contains a UserId field and, every X minutes (i.e. using a Time Window) and >> for each different UserId key, query 3 different REST services to enrich my >> POJOs*. >> For the moment what I do is to use a ProcessWindowFunction aft

Re: Table API and ProcessWindowFunction

2019-07-08 Thread Hequn Cheng
ment what I do is to use a ProcessWindowFunction after the > .keyBy().window() as shown in the previous mail example to contact those 3 > services and enrich my object. > > However I don't like this solution because I'd like to use Flink to it's > full potential so I'd like to enr

Re: Table API and ProcessWindowFunction

2019-07-08 Thread Flavio Pompermaier
use a ProcessWindowFunction after the .keyBy().window() as shown in the previous mail example to contact those 3 services and enrich my object. However I don't like this solution because I'd like to use Flink to it's full potential so I'd like to enrich my object using LATERAL

Re: Table API and ProcessWindowFunction

2019-07-08 Thread Hequn Cheng
-master/dev/table/tableApi.html#row-based-operations [2] https://ci.apache.org/projects/flink/flink-docs-master/dev/table/udfs.html#table-aggregation-functions On Mon, Jul 8, 2019 at 6:27 PM Flavio Pompermaier wrote: > Hi to all, > from what I understood a ProcessWindowFunction can only be used

Table API and ProcessWindowFunction

2019-07-08 Thread Flavio Pompermaier
Hi to all, from what I understood a ProcessWindowFunction can only be used in the Streaming API. Is there any plan to port them also in the Table API (in the near future)? I'd like to do with Table API the equivalent of: final DataStream events = env.addSource(src); events.filter(e -> e

Re: processWindowFunction

2018-08-20 Thread antonio saldivar
gt;> antonio saldivar 于2018年8月19日周日 上午10:18写道: >>>>> >>>>>> hi Vino >>>>>> >>>>>> it is possible to use global window, then set the trigger onElement >>>>>> comparing the element that has arrived with for exam

Re: processWindowFunction

2018-08-20 Thread vino yang
gt; hi Vino >>>>> >>>>> it is possible to use global window, then set the trigger onElement >>>>> comparing the element that has arrived with for example 10 mins, 20 mins >>>>> and 60 mins of data? >>>>> >>>>>

Re: processWindowFunction

2018-08-20 Thread antonio saldivar
nt if the same id sum like $200 total within those thresholds >>>> and count more or equals to 3 I need to be able to set some values to the >>>> object if the object does not reach those thresholds i do not set the >>>> values and keep sending the output with o

Re: processWindowFunction

2018-08-19 Thread vino yang
and keep sending the output with or without those value. >>> >>> just processing the object on the fly and send output >>> >>> >>> >>> >>> >>> >>> >>> El vie., 17 ago. 2018 a las 22:14, vino yang () >>> escribió:

Re: processWindowFunction

2018-08-19 Thread antonio saldivar
o not set the >> values and keep sending the output with or without those value. >> >> just processing the object on the fly and send output >> >> >> >> >> >> >> >> El vie., 17 ago. 2018 a las 22:14, vino yang () >> escribió:

Re: processWindowFunction

2018-08-19 Thread vino yang
essing the object on the fly and send output > > > > > > > > El vie., 17 ago. 2018 a las 22:14, vino yang () > escribió: > >> Hi antonio, >> >> Yes, ProcessWindowFunction is a very low level window function. >> It allows you to access the data in the win

Re: processWindowFunction

2018-08-18 Thread antonio saldivar
ago. 2018 a las 22:14, vino yang () escribió: > Hi antonio, > > Yes, ProcessWindowFunction is a very low level window function. > It allows you to access the data in the window and allows you to customize > the output of the window. > So if you use it, while giving you flexib

Re: processWindowFunction

2018-08-17 Thread vino yang
Hi antonio, Yes, ProcessWindowFunction is a very low level window function. It allows you to access the data in the window and allows you to customize the output of the window. So if you use it, while giving you flexibility, you need to think about other things, which may require you to write

Re: processWindowFunction

2018-08-16 Thread antonio saldivar
Hi Vino thank you for the information, actually I am using a trigger alert and processWindowFunction to send my results, but when my window slides or ends it sends again the objects and I an getting duplicated data El jue., 16 ago. 2018 a las 22:05, vino yang () escribió: > Hi Antonio, >

Re: processWindowFunction

2018-08-16 Thread vino yang
Hi Antonio, What results do not you want to get when creating each window? Examples of the use of ProcessWindowFunction are included in many test files in Flink's project, such as SideOutputITCase.scala or WindowTranslationTest.scala. For more information on ProcessWindowFunction, you can

processWindowFunction

2018-08-16 Thread antonio saldivar
Hello I am implementing a data stream where I use sliding windows but I am stuck because I need to set values to my object based on some if statements in my process function and send the object to the next step but I don't want results every time a window is creating if anyone has a good example

Re: ProcessWindowFunction

2018-08-08 Thread vino yang
Hi yuanjun, There are very few examples of ProcessWindowFunction, but there are some implementations for testing in Flink's source code for your reference.[1] [1]: https://github.com/apache/flink/blob/master/flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/

ProcessWindowFunction

2018-08-08 Thread 苗元君
I read the doc about ProcessWindowFunction But I the code on the flink demo is incorrect public class MyProcessWindowFunction extends ProcessWindowFunction, String, String, TimeWindow> { Tuple cannot have to parameter. I try to find a demo which ProcessWindowFunction used in window word co

Continuous aggregation of results until end events matched CEP / ProcessWindowFunction ?

2018-03-15 Thread dim5b
. To other alternatives were offered which at the time of the implementation were not "available/looked at" 1) Cep Library 2) ProcessFunction/ ProcessWindowFunction I seem to have a similar test case. An I have looked at CEP library and using GlobalWindow withProcessWindowFunction . Consider th

Re: Access to time in aggregation, or aggregation in ProcessWindowFunction?

2017-06-20 Thread William Saar
c:"William Saar" Sent:Tue, 20 Jun 2017 18:20:01 +0200 Subject:Re: Access to time in aggregation, or aggregation in ProcessWindowFunction? Hi William, I'm not quite sure what you are trying to achieve... What constitutes a "new event"? is this based on some key? If so, yo

Re: Access to time in aggregation, or aggregation in ProcessWindowFunction?

2017-06-20 Thread Nico Kruber
Hi William, I'm not quite sure what you are trying to achieve... What constitutes a "new event"? is this based on some key? If so, you may group on that key, create a window and use a custom trigger [1] instead where you can react in onElement() and setup a event time timer for the first one an

Access to time in aggregation, or aggregation in ProcessWindowFunction?

2017-06-20 Thread William Saar
Hi, I am looking to implement a window that sends out updates for each new event it receives and also when an expiration timer fires and purges the window (the expiration time can be determined from a timestamp in the first event). I can't figure out a way to do this that does not require preserv