Skip to content

KAFKA-9243 Update the javadocs to include TimestampKeyValueStore#7848

Closed
miroswan wants to merge 2 commits intoapache:trunkfrom
miroswan:KAFKA-9243
Closed

KAFKA-9243 Update the javadocs to include TimestampKeyValueStore#7848
miroswan wants to merge 2 commits intoapache:trunkfrom
miroswan:KAFKA-9243

Conversation

@miroswan
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Contributor

@vvcephei vvcephei left a comment

Choose a reason for hiding this comment

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

Hey @miroswan , thanks for the PR!

Can you update the PR description with the intended commit message for when we merge this?

Also, I left one comment that seems to apply to all the changes. It might be a good idea to create a quick demo class to try out the APIs and make sure that the code in the javadocs actually compiles and works.

* ...
* final String queryableStoreName = table.queryableStoreName(); // returns null if KTable is not queryable
* ReadOnlyKeyValueStore view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
* TimestampedKeyValueStore view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change doesn't look quite right. It should still be a ReadOnlyKeyValueStore, but the generics are different: ReadOnlyKeyValueStore<K, ValueAndTimestamp<V>>. Also, if the intent is to recommend using the Timestamped variant, then folks would actually have to specify QueryableStoreTypes.timestampedKeyValueStore().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This this top level class JavaDoc, should we also explain that it it still possible to query the store as plain key-value store only? I can imagine, that not all applications are interested in the timestamp and it would be quite convenient for them to stay with the old pattern (note, that the old pattern is not deprecated and still totally valid to use).

Thoughts?

Copy link
Copy Markdown
Author

@miroswan miroswan Dec 18, 2019

Choose a reason for hiding this comment

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

@vvcephei Thanks for the heads up. I've dug a little more and was able to confirm that streams.store returns a ReadOnlyKeyValueStore<K, ValueAndTimestamp<V>> when QueryableStoreTypes.timestampedKeyValueStore() is passed as the second argument. It looks like the type returned by streams.store is dependent upon the return type of the create method of that second argument, namely a TimestampedKeyValueStoreType. I'll make the necessary updates and verify that the code in the javadocs works.

@mjsax You raise a good point. We can provide documentation for the two approaches; however, if we add another QueryableStoreType similar to KeyValueStore and TimestampedKeyValueStore then we've got to make more updates in many places. To remedy this, perhaps we only provide a code example of how to query at the KTable interface documentation and remove the examples in the documentation for the methods. Otherwise, we can continue to update these code snippets in the documentation throughout. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well. I see your point. Maintaining the docs in many different places is quite a challenge. Curious to hear what @vvcephei thinks about this question.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

\cc @vvcephei Any comments?

Btw: There seems to be an overlap with https://issues.apache.org/jira/browse/KAFKA-9290 -- might be worth to resolve both issue with a single PR?

@miroswan miroswan changed the title KAFKA-9243 Update the javadocs for KTable.java KAFKA-9243 Update the javadocs to include TimestampKeyValueStore Dec 18, 2019
Copy link
Copy Markdown
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.

@miroswan -- sorry for the delay on this PR -- it somehow got dropped.

This PR only update KTable interface, but there are other interfaces that need the same update. Can you fix them, too. For example GlobalKTable, KGroupedStream, TimeWindowedKStream, CogroupedKStream, TimeWindowedCogroupedKStream, and KGroupedTable (maybe there are more...)

* final String queryableStoreName = table.queryableStoreName(); // returns null if KTable is not queryable
* ReadOnlyKeyValueStore view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
* ReadOnlyKeyValueStore<String, Long> view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
* view.get(key);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can you remove the blanks? Those would be rendered:

    // with blanks code would be intendet
    view.get(key)

// but we don't want indention
view.get(key);

This applies to all <pre>{@code... sections) -- it was not introduced by you but we should fix it.

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Apr 19, 2020

Closing this PR in favor of #8114

@mjsax mjsax closed this Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants