You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Ali Akhtar <al...@gmail.com> on 2016/10/11 20:08:13 UTC

KTable and KStream should share an interface

They both have a lot of the same methods, and yet they can't be used
polymorphically because they don't share the same parent interface.

I think KIterable or something like that should be used as their base
interface w/ shared methods.

Re: KTable and KStream should share an interface

Posted by Guozhang Wang <wa...@gmail.com>.
Hello Ali,

Thanks for bringing this up.

We design KStream and KTable to not extending the same base class
intentionally to now allow these classes to be used exchangably or
polymorphically
by design, since their semantics are different for those same-named
methods, for example joins and aggregations, so it is better to enforce
users to think carefully what kind of stream it is applying to.

If you want to "convert" a KStream into a KTable, it should be through
aggregations, and from "KTable" to "KStream" call "toStream" explicitly to
change its semantics.



Guozhang


On Tue, Oct 11, 2016 at 1:08 PM, Ali Akhtar <al...@gmail.com> wrote:

> They both have a lot of the same methods, and yet they can't be used
> polymorphically because they don't share the same parent interface.
>
> I think KIterable or something like that should be used as their base
> interface w/ shared methods.
>



-- 
-- Guozhang