You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Boyang Chen <bc...@outlook.com> on 2018/12/23 04:23:24 UTC
SessionWindows type base class
Hey there,
I was working on some KTable API related stuff and noticed something a little bit confusing.
For class SessionWindows that defines the spec for a session window, it doesn't have a base class:
public final class SessionWindows
On the other hand, the `TimeWindows` class is subclass of Windows:
public final class TimeWindows extends Windows<TimeWindow> {
Could someone with background knowledge give me some light on the reasoning for not extending the Windows class for SessionWindows?
Thanks in advance!
Best,
Boyang
Re: SessionWindows type base class
Posted by Boyang Chen <bc...@outlook.com>.
yep this is great, thanks Mattihas!
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Matthias J. Sax <ma...@confluent.io>
Sent: Sunday, December 23, 2018 11:27 AM
To: dev@kafka.apache.org
Subject: Re: SessionWindows type base class
`Windows` is not a generic window type for all windows. It's only used
for windows that can be "pre computed", ie, the window boundaries are
know a-priory (like TimeWindow or UnlimitedWindow).
We need to distinguish between TimeWindow/UnlimitedWindow and
SessionWindows in the API. There are two overloads
`KGroupedStream#windowedBy()` each accepting a different type of window
and both use a different operator implementation internally.
Does this answer your question?
-Matthias
On 12/23/18 5:23 AM, Boyang Chen wrote:
> Hey there,
>
> I was working on some KTable API related stuff and noticed something a little bit confusing.
> For class SessionWindows that defines the spec for a session window, it doesn't have a base class:
>
> public final class SessionWindows
>
> On the other hand, the `TimeWindows` class is subclass of Windows:
>
> public final class TimeWindows extends Windows<TimeWindow> {
>
> Could someone with background knowledge give me some light on the reasoning for not extending the Windows class for SessionWindows?
>
> Thanks in advance!
>
> Best,
> Boyang
>
Re: SessionWindows type base class
Posted by "Matthias J. Sax" <ma...@confluent.io>.
`Windows` is not a generic window type for all windows. It's only used
for windows that can be "pre computed", ie, the window boundaries are
know a-priory (like TimeWindow or UnlimitedWindow).
We need to distinguish between TimeWindow/UnlimitedWindow and
SessionWindows in the API. There are two overloads
`KGroupedStream#windowedBy()` each accepting a different type of window
and both use a different operator implementation internally.
Does this answer your question?
-Matthias
On 12/23/18 5:23 AM, Boyang Chen wrote:
> Hey there,
>
> I was working on some KTable API related stuff and noticed something a little bit confusing.
> For class SessionWindows that defines the spec for a session window, it doesn't have a base class:
>
> public final class SessionWindows
>
> On the other hand, the `TimeWindows` class is subclass of Windows:
>
> public final class TimeWindows extends Windows<TimeWindow> {
>
> Could someone with background knowledge give me some light on the reasoning for not extending the Windows class for SessionWindows?
>
> Thanks in advance!
>
> Best,
> Boyang
>