Skip to content

Commit

Permalink
Plan hop(x, x) to tumble(x) (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwylde authored Dec 12, 2024
1 parent 0828ff7 commit a8b95f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/arroyo-planner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,12 @@ fn find_window(expression: &Expr) -> Result<Option<WindowType>> {
slide
);
}
Ok(Some(WindowType::Sliding { width, slide }))
if slide == width {
// a hop window with slide == width is a tumble window
Ok(Some(WindowType::Tumbling { width }))
} else {
Ok(Some(WindowType::Sliding { width, slide }))
}
}
"tumble" => {
if args.len() != 1 {
Expand Down
7 changes: 7 additions & 0 deletions crates/arroyo-planner/src/test/queries/hop_to_tumble.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
create table impulse with (
connector = 'impulse',
event_rate = '10'
);

select count(*) from impulse
group by hop(interval '10 seconds', interval '10 seconds');

0 comments on commit a8b95f1

Please sign in to comment.