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

Implement mathematical operators #553

Merged
merged 1 commit into from
May 20, 2021
Merged

Implement mathematical operators #553

merged 1 commit into from
May 20, 2021

Conversation

cescoffier
Copy link
Contributor

@cescoffier cescoffier commented May 9, 2021

Provides:

  • count - emits the number of items emitted by the upstream
  • index - emits Tuple2<Long, T> for each item from the upstream. The first element of the tuple is the index (0-based), and the second if the item
  • min / max - emits the min/max item from the upstream, using Java comparator
  • top(x) - emits the top x items from the upstream, a new ranking is emitted every time it changes.
  • sum - emits the sum of all the items emitted by the upstream
  • average - emits the average of all the items emitted by the upstream

@cescoffier cescoffier requested a review from jponge May 9, 2021 17:44
@codecov
Copy link

codecov bot commented May 9, 2021

Codecov Report

Merging #553 (a94f1a8) into main (604c650) will increase coverage by 0.40%.
The diff coverage is 93.46%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #553      +/-   ##
============================================
+ Coverage     89.73%   90.14%   +0.40%     
- Complexity     2913     3001      +88     
============================================
  Files           380      392      +12     
  Lines         11513    11666     +153     
  Branches       1450     1461      +11     
============================================
+ Hits          10331    10516     +185     
+ Misses          605      587      -18     
+ Partials        577      563      -14     
Impacted Files Coverage Δ Complexity Δ
...c/main/java/io/smallrye/mutiny/math/Statistic.java 72.72% <72.72%> (ø) 12.00 <12.00> (?)
...th/src/main/java/io/smallrye/mutiny/math/Math.java 90.90% <90.90%> (ø) 10.00 <10.00> (?)
.../java/io/smallrye/mutiny/math/AverageOperator.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...in/java/io/smallrye/mutiny/math/CountOperator.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...in/java/io/smallrye/mutiny/math/IndexOperator.java 100.00% <100.00%> (ø) 3.00 <3.00> (?)
...main/java/io/smallrye/mutiny/math/MaxOperator.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
...n/java/io/smallrye/mutiny/math/MedianOperator.java 100.00% <100.00%> (ø) 7.00 <7.00> (?)
...main/java/io/smallrye/mutiny/math/MinOperator.java 100.00% <100.00%> (ø) 5.00 <5.00> (?)
...va/io/smallrye/mutiny/math/OccurrenceOperator.java 100.00% <100.00%> (ø) 4.00 <4.00> (?)
...va/io/smallrye/mutiny/math/StatisticsOperator.java 100.00% <100.00%> (ø) 9.00 <9.00> (?)
... and 29 more

bom/pom.xml Outdated Show resolved Hide resolved
maths/README.md Outdated Show resolved Hide resolved
bom/pom.xml Outdated Show resolved Hide resolved
maths/src/main/java/io/smallrye/mutiny/maths/Maths.java Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@cescoffier cescoffier force-pushed the add-maths branch 3 times, most recently from c14d8e4 to 953758b Compare May 11, 2021 07:37
@cescoffier
Copy link
Contributor Author

I have added:

  • median - be aware that you need to store the item, so don't use it on unbounded streams
  • statistics - computes the count, average, min, max, variance, standard deviation, skewness, and kurtosis (thanks to @Ladicek link)

* count - emits the number of items emitted by the upstream
* index - emits `Tuple2<Long, T>` for each item from the upstream. The first element of the tuple is the index (0-based), and the second if the item
* min / max - emits the min/max item from the upstream, using Java comparator
* top(x) - emits the top x items from the upstream, a new ranking is emitted every time it changes.
* sum - emits the sum of all the items emitted by the upstream
* average - emits the average of all the items emitted by the upstream
* median - emits the median of all the items emitted by the upstream
* statistic - emits statistics about the emitted items
@jponge jponge added this to the 0.18.0 milestone May 20, 2021
@jponge jponge added enhancement New feature or request noteworthy-feature Noteworthy feature labels May 20, 2021
@jponge jponge merged commit 5c2eb47 into main May 20, 2021
@jponge jponge deleted the add-maths branch May 20, 2021 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request noteworthy-feature Noteworthy feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants