Skip to content

Commit 54fc3ab

Browse files
authored
feat: basic implementation of TransformWindow. (#10772)
1 parent 24424b3 commit 54fc3ab

File tree

9 files changed

+1267
-0
lines changed

9 files changed

+1267
-0
lines changed

src/query/service/src/pipelines/processors/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ pub use transforms::TransformLimit;
3939
pub use transforms::TransformResortAddOn;
4040
pub use transforms::TransformRuntimeFilter;
4141
pub use transforms::TransformSortPartial;
42+
pub use transforms::TransformWindow;
43+
pub use transforms::WindowFrame;
44+
pub use transforms::WindowFrameBound;

src/query/service/src/pipelines/processors/transforms/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mod transform_hash_join;
2121
mod transform_left_join;
2222
mod transform_limit;
2323
mod transform_mark_join;
24+
mod window;
2425

2526
mod profile_wrapper;
2627
mod runtime_filter;
@@ -90,3 +91,6 @@ pub use transform_runtime_filter::SinkRuntimeFilterSource;
9091
pub use transform_runtime_filter::TransformRuntimeFilter;
9192
pub use transform_sort_merge::SortMergeCompactor;
9293
pub use transform_sort_partial::TransformSortPartial;
94+
pub use window::TransformWindow;
95+
pub use window::WindowFrame;
96+
pub use window::WindowFrameBound;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2023 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#[derive(Clone)]
16+
pub enum WindowFrameBound {
17+
/// `CURRENT ROW`
18+
CurrentRow,
19+
/// `<N> PRECEDING` or `UNBOUNDED PRECEDING`.
20+
Preceding(Option<usize>),
21+
/// `<N> FOLLOWING` or `UNBOUNDED FOLLOWING`.
22+
Following(Option<usize>),
23+
}
24+
25+
#[derive(Clone)]
26+
pub struct WindowFrame {
27+
// TODO: support RANGE frame, only support Rows frame now.
28+
pub start_bound: WindowFrameBound,
29+
pub end_bound: WindowFrameBound,
30+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2023 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
mod frame;
16+
mod transform_window;
17+
18+
pub use frame::WindowFrame;
19+
pub use frame::WindowFrameBound;
20+
pub use transform_window::TransformWindow;

0 commit comments

Comments
 (0)