Skip to content

Conversation

@abbccdda
Copy link
Contributor

We are proposing adding a new API called windowedTable to StreamsBuilder.java to bring in the ability of materializing a windowed topic to local. Links to related sources:
KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-300%3A+Add+Windowed+KTable+API+in+StreamsBuilder
Jira: https://issues.apache.org/jira/browse/KAFKA-6840

@abbccdda
Copy link
Contributor Author

Hey @mjsax @guozhangwang, before we start the discussion thread, maybe you could give me some initial feedback on the code or KIP? Especially the logic has been a little deviated from our initial discussion on Jira, and I reflected those in the KIP. Let me know if you need more clarification, thank you!

@abbccdda abbccdda force-pushed the window_table branch 2 times, most recently from e6d61cb to e6bad8a Compare May 20, 2018 02:24
@mjsax
Copy link
Member

mjsax commented May 20, 2018

Thanks @abbccdda! AK release deadline is coming up and we need to focus on getting pending KIPs and PR ready for the release. We will cycle back when we find time. Thanks for your understanding. (Feel free to ping us after the 2.0 release is out in case this would slip.)

@mjsax mjsax added the streams label May 20, 2018
@mjsax mjsax requested review from guozhangwang and mjsax May 20, 2018 23:24
@mjsax
Copy link
Member

mjsax commented May 20, 2018

\cc @bbejeck @vvcephei

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Apache license header.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong class name

@abbccdda
Copy link
Contributor Author

Thanks for the clarification @mjsax so we are expecting 2.0 fully release in June?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be better to name it windowedKTable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent with createKTable()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to rename to windowedKTable

nit: fit formatting (either move consumed down one line, or indent other parameter to match indention of consumed)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can define a local variable for key.window().start()

@Ishiihara
Copy link
Contributor

test this please

@tedyu
Copy link
Contributor

tedyu commented May 21, 2018

Without adding license header, no tests would be run.

@Ishiihara
Copy link
Contributor

@mjsax @guozhangwang Thanks a lot for helping in review the PR. We totally understand the priority of the Kafka 2.0 release and I am wondering if we can do a review on the API and have an agreement? We can leave the detailed review and polish later when you have more time. Really appreciate your help!

@mjsax
Copy link
Member

mjsax commented May 22, 2018

@abbccdda Release plan can be found here: https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=80448820

After code freeze we should have time. Maybe even before. Just can't promise, but I'll try to squeeze it in if possible. :)

@abbccdda
Copy link
Contributor Author

@tedyu thanks for the comments. Addressing

@abbccdda abbccdda force-pushed the window_table branch 2 times, most recently from dbd7185 to 3ec5183 Compare May 25, 2018 03:40
@abbccdda
Copy link
Contributor Author

@Ishiihara seems passed.

@abbccdda
Copy link
Contributor Author

abbccdda commented Jun 4, 2018

@Ishiihara will resolve conflict tonight

Copy link
Contributor

@Ishiihara Ishiihara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general. Left some minor comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to support session window as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we would support it for now, maybe in next generation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be better to set end to another timestamp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Serde/serde

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some comments for the return type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, why this class needs to be public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use it for unit testing purpose

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to test both session window and time window?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For internal release, this could be postponed. Will add session window test later

@abbccdda abbccdda force-pushed the window_table branch 3 times, most recently from e5a2524 to 4068d43 Compare June 8, 2018 21:53
@abbccdda
Copy link
Contributor Author

abbccdda commented Jun 9, 2018

@mjsax @guozhangwang we are planning an internal release next week, could you take a quick look on the API to provide us some feedback? Thanks!

@abbccdda abbccdda closed this Jun 9, 2018
@abbccdda abbccdda reopened this Jun 9, 2018
@abbccdda abbccdda force-pushed the window_table branch 9 times, most recently from 49b7198 to 2c6911a Compare June 13, 2018 18:58
@Ishiihara
Copy link
Contributor

@abbccdda One high level comment: it seems that we have quite a few code duplications for the time window and session window. It would be nice if we can reduce the duplication.

Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a meta comment: we do not have unit tests for SessionWindowedKTableSource and SessionWindowedStoreMaterializer, is it intentional?

@guozhangwang
Copy link
Contributor

The other PR #5307 is close to be merged I think. We should proceed on voting and accepting the KIP in order to progress. Then we can come back to this PR after 5307 is merged.

@abbccdda abbccdda force-pushed the window_table branch 2 times, most recently from 09df702 to d02bca0 Compare December 31, 2018 17:52
Copy link
Contributor Author

@abbccdda abbccdda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey guys @guozhangwang @Ishiihara @shawnsnguyen This is a draft version for latest KIP-300. To make sure the review is efficient, be advised to focus on looking at changes in StreamsBuilder, InternalStreamsBuilder, KTableSource and TableSourceNode classes. As you could see this is a very large change, so I want to make sure major changes are getting common understanding before proceeding to further unit test changes.

Major changes include:

  1. generalize the #table() API in InternalStreamsBuilder where our return type is <?, V> instead of strict <K, V>. The reasoning is that we want to avoid too much code redundancy and the public API could cast the return type as needed. We couldn't make the type more explicit because underlying window store, session store and key value store are not sharing single common interface.

  2. Make KTableSource as abstract class and let different table source (kv, window, session) inherit. This could also save code redundancy.

  3. Public API changes to support 8:
    #windowTable(topic, conusmed, materialized)
    #windowTable(topic)
    #windowTable(topic, conusmed)
    #windowTable(topic, materialized)
    #sessionTable(topic, conusmed, materialized)
    #sessionTable(topic)
    #sessionTable(topic, conusmed)
    #sessionTable(topic, materialized)

  4. Overload StreamSourceNode to pass in two new parameters:

    private final boolean isWindowed;
    private final ConsumedInternal<Windowed<K>, V> windowedConsumedInteral;

which will replace the returned consumedInternal() to windowed consume. This could reduce the scattering of windowed serde logic and consolidate changes in one central place without changing many class types.

Let me know your thoughts!

@mjsax mjsax changed the title KAFKA-6840: windowed ktable API KAFKA-6840: Add windowed-KTable API Feb 21, 2019
@mjsax
Copy link
Member

mjsax commented Feb 21, 2019

@abbccdda Can you rebase and update this KIP so we can review? Thanks!

@abbccdda
Copy link
Contributor Author

@mjsax Thanks for taking time to review the change! In fact, I would like to get the vote completed for KIP-300 before proceeding to work on this since the rebasing effort of this change is really high now and we hope this is the last back-and-forth :). Hey @guozhangwang @vahidhashemian could you take a look at KIP-300 and give me two more binding votes when you got time? Thanks!

Copy link
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abbccdda I did an initial first pass. It seems this PR is a little outdated compared to the final KIP. Can you update the PR and rebase it to resolve merge conflicts?

\cc @cadonna for review after the PR is updated.

build.gradle Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is my local build failure, will revert lol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the method name changed to windowedTable and windowSize parameter is missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windowSize should be Duration

@abbccdda
Copy link
Contributor Author

abbccdda commented Mar 8, 2019

@mjsax Thanks so much for the review Matthias! So sorry I'm currently clearing some backlog tasks at my work and couldn't get chance to react this one. I should be able to start making progress late next week.

@mjsax
Copy link
Member

mjsax commented Mar 9, 2019

Cool. We are not in a hurry. Just wanted to make sure to unblock you.

@mjsax mjsax added the kip Requires or implements a KIP label Jun 12, 2020
@mjsax
Copy link
Member

mjsax commented Dec 29, 2022

Closing this stale PR -- the corresponding KIP was never approved and the KIP itself seems abandoned atm.

@mjsax mjsax closed this Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kip Requires or implements a KIP streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants