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

Add time window and window assigner #950

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Oct 21, 2022

Signed-off-by: Chen Dai daichen@amazon.com

Description

Add window and window assigner interface along with tumbling and sliding window assigner implementation. This PR is only focus on core WindowAssigner interface. The future tasks in #954 will integrate it and other new windowing components with query plan operator.

Window

A Window is a time interval which has start timestamp and end timestamp. For convenience, the end timestamp is exclusive and thus the window boundary is actually [startTime, endTime-1].

Window Assigner

A WindowAssigner identifies which window(s) the event belong. This is the first step and foundation of handling unbounded streaming data. As follows, an event may be assigned to a single window or multiple windows according to the windowing function. Here are a few example for common windowing approach.

Tumble window is fixed size without any overlap and start timestamp is aligned by mod window size.

stream-processing-Tumbling-window

Sliding window is fixed size but overlapped by slide size. The algorithm is referencing https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingEventTimeWindows.java#L70

stream-processing-Sliding-window

Session windowing dynamic sized and defined by a given gap duration. It is useful for event representing user activity by analyzing user behavior within a session. Note that session window may cause window merging which will be supported in future as needed.

stream-processing-Session-window

Issues Resolved

#951

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen added the enhancement New feature or request label Oct 21, 2022
@dai-chen dai-chen self-assigned this Oct 21, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2022

Codecov Report

Merging #950 (81ba090) into feature/maximus-m1 (3a9d217) will decrease coverage by 2.73%.
The diff coverage is 100.00%.

@@                   Coverage Diff                    @@
##             feature/maximus-m1     #950      +/-   ##
========================================================
- Coverage                 97.95%   95.22%   -2.74%     
- Complexity                 3143     3153      +10     
========================================================
  Files                       300      313      +13     
  Lines                      7784     8463     +679     
  Branches                    500      623     +123     
========================================================
+ Hits                       7625     8059     +434     
- Misses                      158      350     +192     
- Partials                      1       54      +53     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine 97.96% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...search/sql/planner/streaming/windowing/Window.java 100.00% <100.00%> (ø)
...ming/windowing/assigner/SlidingWindowAssigner.java 100.00% <100.00%> (ø)
...ing/windowing/assigner/TumblingWindowAssigner.java 100.00% <100.00%> (ø)
workbench/public/components/Header/Header.tsx 100.00% <0.00%> (ø)
...ch/public/components/QueryResults/QueryResults.tsx 61.60% <0.00%> (ø)
workbench/public/components/PPLPage/PPLPage.tsx 56.52% <0.00%> (ø)
workbench/public/components/app.tsx 0.00% <0.00%> (ø)
workbench/public/components/Main/main.tsx 53.00% <0.00%> (ø)
workbench/public/utils/PanelWrapper.tsx 100.00% <0.00%> (ø)
workbench/public/components/SQLPage/SQLPage.tsx 100.00% <0.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen changed the title Add window and window assigner Add time window and window assigner Oct 21, 2022
@dai-chen dai-chen marked this pull request as ready for review October 24, 2022 19:04
@dai-chen dai-chen requested a review from a team as a code owner October 24, 2022 19:04
@penghuo penghuo added this to the Maximus M1 - Phase 1 milestone Oct 26, 2022
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen merged commit 91baab1 into opensearch-project:feature/maximus-m1 Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants