Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce suppress to streams. #23

Merged
merged 1 commit into from
Sep 25, 2019
Merged

Conversation

truemped
Copy link
Contributor

@truemped truemped commented Jan 2, 2019

Version 2.1 introduced a new operator: suppress. It allows to only
forward the final result of a windowed aggregation.

This PR adds the suppress function to the streams namespace and
allows for the new operator to be used in Kafka Streams apps. It works but may not be in a final stage. Asking for feedback at this point whether this is what you have in mind or I should change something.

Best
Daniel

@truemped truemped requested a review from a team as a code owner January 2, 2019 14:07
@99-not-out
Copy link
Contributor

Hey - thanks for this Daniel.
We will do a review soon and update here.

Regards
Matt

Copy link
Contributor

@cddr cddr left a comment

Choose a reason for hiding this comment

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

Looks good overall. A few minor things to consider before we merge.

src/jackdaw/streams/interop.clj Outdated Show resolved Hide resolved
src/jackdaw/test.clj Outdated Show resolved Hide resolved
test/jackdaw/streams_test.clj Outdated Show resolved Hide resolved
@truemped
Copy link
Contributor Author

truemped commented Sep 1, 2019

Hey, @cddr. It's been a while. I've updated the PR and added a lot more test cases. Let me know what you think. Would be great to get a new version with including this out, once it's in a state that works for you.

Best
Daniel

Copy link
Contributor

@cddr cddr left a comment

Choose a reason for hiding this comment

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

Hey Daniel,

Thanks for adding those tests. They look great. We're almost ready for a merge. Just an extraneous .lein-failures left in the commit and one instance of unnecessary destructuring to remove.

.lein-failures Outdated Show resolved Hide resolved
src/jackdaw/streams/interop.clj Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 3, 2019

Codecov Report

Merging #23 into master will increase coverage by 0.17%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #23      +/-   ##
=========================================
+ Coverage   81.43%   81.6%   +0.17%     
=========================================
  Files          40      39       -1     
  Lines        2391    2386       -5     
  Branches      149     151       +2     
=========================================
  Hits         1947    1947              
+ Misses        295     288       -7     
- Partials      149     151       +2
Impacted Files Coverage Δ
src/jackdaw/streams/configured.clj 69.23% <ø> (ø) ⬆️
src/jackdaw/streams/protocols.clj 100% <ø> (ø) ⬆️
src/jackdaw/streams.clj 82.25% <100%> (+0.29%) ⬆️
src/jackdaw/streams/specs.clj 96.88% <85.71%> (-0.36%) ⬇️
src/jackdaw/streams/interop.clj 79.71% <87.5%> (+1.02%) ⬆️
src/jackdaw/test/commands.clj 86.95% <0%> (-13.05%) ⬇️
src/jackdaw/serdes/edn.clj 88.46% <0%> (-11.54%) ⬇️
src/jackdaw/test.clj 77.77% <0%> (-1.02%) ⬇️
src/jackdaw/serdes/edn2.clj
src/jackdaw/serdes.clj 100% <0%> (+20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f404699...2907ca1. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 3, 2019

Codecov Report

Merging #23 into master will increase coverage by 0.01%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #23      +/-   ##
==========================================
+ Coverage   81.62%   81.64%   +0.01%     
==========================================
  Files          39       39              
  Lines        2373     2386      +13     
  Branches      149      151       +2     
==========================================
+ Hits         1937     1948      +11     
  Misses        287      287              
- Partials      149      151       +2
Impacted Files Coverage Δ
src/jackdaw/streams/configured.clj 69.23% <ø> (ø) ⬆️
src/jackdaw/streams/protocols.clj 100% <ø> (ø) ⬆️
src/jackdaw/streams.clj 82.25% <100%> (+0.29%) ⬆️
src/jackdaw/streams/specs.clj 96.88% <85.71%> (-0.36%) ⬇️
src/jackdaw/streams/interop.clj 79.71% <87.5%> (+1.02%) ⬆️
src/jackdaw/test/commands.clj 86.95% <0%> (-13.05%) ⬇️
src/jackdaw/test.clj 77.77% <0%> (-1.02%) ⬇️
src/jackdaw/serdes/edn.clj 92.3% <0%> (+11.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0c4cb9...1bebd02. Read the comment docs.

cddr
cddr previously approved these changes Sep 5, 2019
Copy link
Contributor

@cddr cddr left a comment

Choose a reason for hiding this comment

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

Thanks @truemped. LGTM

@truemped
Copy link
Contributor Author

truemped commented Sep 6, 2019

Cool, thanks @cddr. Anything I still should do/help do to get it merged? Some circleci job fails, but that does not seem to be test related.

vijumathew
vijumathew previously approved these changes Sep 11, 2019
Copy link

@vijumathew vijumathew left a comment

Choose a reason for hiding this comment

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

lgtm! just left some small things that aren't blockers

be unbounded. If `until-time-limit-ms` is set, this will override the
`TimeWindow` interval. Note that when relying on the configured `TimeWindow`
the default `grace` period is `24h - window-size`.")

Choose a reason for hiding this comment

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

could be helpful to format the docstring after the styleguide. just ending the first line after the first sentence and starting "You can either specify..." on a newline

https://github.com/bbatsov/clojure-style-guide#docstring-summary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

(suppress
[_ suppress]
(clj-ktable
(.suppress ktable (suppress-config suppress))))

Choose a reason for hiding this comment

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

it looks like the spec defined before was named suppress-config but the fn that uses it is called suppress-config and the config is named suppress. this seems a little confusing to me.

might be helpful to name the config arg suppress-config to match the spec and the fn create-suppress-config or something. the names i suggested could definitely be better though

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've tried to make more sense of the names. The argument is now suppress-config and the function is suppress-config->suppressed which is what it's doing actually: turning a suppress-config into a org.apache.kafka.streams.kstream.Suppressed.

test/jackdaw/streams_test.clj Outdated Show resolved Hide resolved
This adds the `suppress` operator for Kafka Streams apps. This allows to
only emit messages for a specific key once within a specific time
window, e.g.
@truemped
Copy link
Contributor Author

Hey @vijumathew, could you have another look at this?

@cddr cddr merged commit af1f8c2 into FundingCircle:master Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants