apache / rocketmq-streams

Apache rocketmq
https://rocketmq.apache.org/
Apache License 2.0
171 stars 82 forks source link

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

Closed Jargon9 closed 1 year ago

Jargon9 commented 1 year ago

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

ni-ze commented 1 year ago

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 commented 1 year ago

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

Jargon9 commented 1 year ago

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

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

Jargon9 commented 1 year ago

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 commented 1 year ago

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%> (ø)

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