You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Ayoub <ay...@gmail.com> on 2024/04/12 09:50:39 UTC

Streams group final result: EmitStrategy vs Suppressed

Hello,

I found that there are two ways to send only the final result of a windowed
groupBy, either using Suppressed
<https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/KTable.html#suppress(org.apache.kafka.streams.kstream.Suppressed)>.untilWindowCloses
on the final KTable or EmitStrategy
<https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/TimeWindowedKStream.html#emitStrategy(org.apache.kafka.streams.kstream.EmitStrategy)>
on
the windowed stream.

I tried to compare both but didn't find differences in the result they give.

Are there any differences apart from the moment they are defined within the
pipeline. And Is there any preference on using one or the other ?

Thanks,
Ayoub

Re: Streams group final result: EmitStrategy vs Suppressed

Posted by "Matthias J. Sax" <mj...@apache.org>.
The main difference is the internal implementation. Semantically, both 
are equivalent.

suppress() uses an in-memory buffer, while `emitStrategy()` does not, 
but modifies the upstream aggregation operator impl, and waits to send 
results downstream, and thus, it's RocksDB based.


-Matthias


On 4/12/24 10:37 AM, Ayoub wrote:
> Hello,
> 
> *[Not sure if my email went through as I was not subscribed to this mailing
> list. Here is my original email]*
> 
> I found that there are two ways to send only the final result of a windowed
> groupBy, either using Suppressed
> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/KTable.html#suppress(org.apache.kafka.streams.kstream.Suppressed)>.untilWindowCloses
> on the final KTable or EmitStrategy
> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/TimeWindowedKStream.html#emitStrategy(org.apache.kafka.streams.kstream.EmitStrategy)>
> on
> the windowed stream.
> 
> I tried to compare both but didn't find differences in the result they give.
> 
> Are there any differences apart from the moment they are defined within the
> pipeline. And is there any preference on using one or the other ?
> 
> Thanks,
> Ayoub
> 
> 
> Le ven. 12 avr. 2024 à 11:50, Ayoub <ay...@gmail.com> a écrit :
> 
>> Hello,
>>
>> I found that there are two ways to send only the final result of a
>> windowed groupBy, either using Suppressed
>> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/KTable.html#suppress(org.apache.kafka.streams.kstream.Suppressed)>.untilWindowCloses
>> on the final KTable or EmitStrategy
>> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/TimeWindowedKStream.html#emitStrategy(org.apache.kafka.streams.kstream.EmitStrategy)> on
>> the windowed stream.
>>
>> I tried to compare both but didn't find differences in the result they
>> give.
>>
>> Are there any differences apart from the moment they are defined within
>> the pipeline. And Is there any preference on using one or the other ?
>>
>> Thanks,
>> Ayoub
>>
> 

Re: Streams group final result: EmitStrategy vs Suppressed

Posted by Ayoub <ay...@gmail.com>.
Hello,

*[Not sure if my email went through as I was not subscribed to this mailing
list. Here is my original email]*

I found that there are two ways to send only the final result of a windowed
groupBy, either using Suppressed
<https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/KTable.html#suppress(org.apache.kafka.streams.kstream.Suppressed)>.untilWindowCloses
on the final KTable or EmitStrategy
<https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/TimeWindowedKStream.html#emitStrategy(org.apache.kafka.streams.kstream.EmitStrategy)>
on
the windowed stream.

I tried to compare both but didn't find differences in the result they give.

Are there any differences apart from the moment they are defined within the
pipeline. And is there any preference on using one or the other ?

Thanks,
Ayoub


Le ven. 12 avr. 2024 à 11:50, Ayoub <ay...@gmail.com> a écrit :

> Hello,
>
> I found that there are two ways to send only the final result of a
> windowed groupBy, either using Suppressed
> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/KTable.html#suppress(org.apache.kafka.streams.kstream.Suppressed)>.untilWindowCloses
> on the final KTable or EmitStrategy
> <https://kafka.apache.org/37/javadoc/org/apache/kafka/streams/kstream/TimeWindowedKStream.html#emitStrategy(org.apache.kafka.streams.kstream.EmitStrategy)> on
> the windowed stream.
>
> I tried to compare both but didn't find differences in the result they
> give.
>
> Are there any differences apart from the moment they are defined within
> the pipeline. And Is there any preference on using one or the other ?
>
> Thanks,
> Ayoub
>