Skip to content

[ISSUE #251]Support avg function in WindowStream #259

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

Merged
merged 4 commits into from
Feb 9, 2023

Conversation

Jargon9
Copy link
Contributor

@Jargon9 Jargon9 commented Jan 27, 2023

Hi teams, I have completed the main part of avg calculation. Could you please review the code?

  • Besides, I'm a little confused. For the average calculation in the Accumulator, is the merge only allowed for the same type accumulator?
  • I wrote an example to test. Here is the test result.
time:23:00:58.644, input:6
time:23:00:59.883, input:7
time:23:01:01.492, input:8
[2023-01-27 23:00:55 - 2023-01-27 23:01:00](key=key, value=6.0)
time:23:01:13.550, input:9
[2023-01-27 23:01:00 - 2023-01-27 23:01:05](key=key, value=8.0) ```

@ni-ze
Copy link
Contributor

ni-ze commented Jan 31, 2023

Good catch, Thanks very much your pr.

  1. merge is a reserved method, It use to merge two AvgAccumulator during calculation process;
  2. the result of example seems not very accurate,pr 263 maybe solve this problem, please check this example again after that pr merged;
  3. It is best to stop the RocketMQStream when program exit,like other examples.

@ni-ze
Copy link
Contributor

ni-ze commented Feb 3, 2023

@Jargon9 你好,能否看看这个pr,最近可能发版本,能带上最好。

@Jargon9
Copy link
Contributor Author

Jargon9 commented Feb 3, 2023

@Jargon9 你好,能否看看这个pr,最近可能发版本,能带上最好。

@ni-ze 好的!十分感谢帮忙cr代码。不好意思我前几天有点忙,周末会继续完成它的。

@Jargon9
Copy link
Contributor Author

Jargon9 commented Feb 5, 2023

Hi teams, I found that the log truncation of the previous results is incomplete. I retested the function. It should be OK.
Besides, thank you for your help, I add a WindowAvg-shutdown-hood when program exit , like other examples.

time:21:54:12.507, input:1
time:21:54:17.498, input:2
[2023-02-05 21:54:00 - 2023-02-05 21:54:15](key=key, value=1.0)
time:21:54:22.507, input:3
time:21:54:27.516, input:4
time:21:54:32.531, input:5
[2023-02-05 21:54:15 - 2023-02-05 21:54:30](key=key, value=3.0)
time:21:54:37.538, input:6
time:21:54:42.545, input:7
time:21:54:47.560, input:8
[2023-02-05 21:54:30 - 2023-02-05 21:54:45](key=key, value=6.0)
time:21:54:52.571, input:9
time:21:55:44.630, input:1
[2023-02-05 21:54:45 - 2023-02-05 21:55:00](key=key, value=8.5)
time:21:55:48.642, input:2
[2023-02-05 21:55:30 - 2023-02-05 21:55:45](key=key, value=1.0)
time:21:55:52.651, input:3
time:21:55:56.657, input:4
time:21:56:00.669, input:5
[2023-02-05 21:55:45 - 2023-02-05 21:56:00](key=key, value=3.0)
time:21:56:04.677, input:6
time:21:56:08.681, input:7
time:21:56:12.691, input:8
time:21:56:16.701, input:9
[2023-02-05 21:56:00 - 2023-02-05 21:56:15](key=key, value=6.5)

@codecov-commenter
Copy link

Codecov Report

Merging #259 (e6eec5d) into develop (608ccae) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           develop    #259   +/-   ##
=======================================
  Coverage     0.00%   0.00%           
=======================================
  Files           85      87    +2     
  Lines         3027    3084   +57     
  Branches       296     301    +5     
=======================================
- Misses        3027    3084   +57     
Impacted Files Coverage Δ
...eams/core/function/accumulator/AvgAccumulator.java 0.00% <0.00%> (ø)
...ocketmq/streams/core/rstream/WindowStreamImpl.java 0.00% <0.00%> (ø)
.../rocketmq/streams/core/util/OperatorNameMaker.java 0.00% <ø> (ø)
...he/rocketmq/streams/examples/window/WindowAvg.java 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ni-ze ni-ze merged commit b5355de into apache:develop Feb 9, 2023
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.

3 participants