From dc18a2482985fd04d2775591fbbac1c2c4e77951 Mon Sep 17 00:00:00 2001 From: TennyZhuang Date: Mon, 18 Sep 2023 15:22:00 +0800 Subject: [PATCH] remove expr::function::window Signed-off-by: TennyZhuang --- src/batch/src/executor/sort_over_window.rs | 5 +++-- src/expr/src/function/mod.rs | 17 ----------------- src/expr/src/function/window/mod.rs | 15 --------------- src/expr/src/lib.rs | 1 - src/expr/src/window_function/state/aggregate.rs | 2 +- src/expr/src/window_function/state/buffer.rs | 4 ++-- src/expr/src/window_function/state/mod.rs | 3 +-- .../src/window_function/state/row_number.rs | 4 ++-- src/frontend/src/binder/expr/function.rs | 2 +- src/frontend/src/expr/window_function.rs | 2 +- .../optimizer/plan_node/generic/over_window.rs | 2 +- .../optimizer/plan_node/logical_over_window.rs | 2 +- .../rule/over_window_to_agg_and_join_rule.rs | 2 +- .../optimizer/rule/over_window_to_topn_rule.rs | 2 +- src/stream/src/from_proto/eowc_over_window.rs | 2 +- src/stream/src/from_proto/over_window.rs | 2 +- .../tests/integration_tests/eowc_over_window.rs | 2 +- .../tests/integration_tests/over_window.rs | 2 +- 18 files changed, 19 insertions(+), 52 deletions(-) delete mode 100644 src/expr/src/function/mod.rs delete mode 100644 src/expr/src/function/window/mod.rs diff --git a/src/batch/src/executor/sort_over_window.rs b/src/batch/src/executor/sort_over_window.rs index f12ebc2452384..c8b6c7ef9388c 100644 --- a/src/batch/src/executor/sort_over_window.rs +++ b/src/batch/src/executor/sort_over_window.rs @@ -19,8 +19,9 @@ use risingwave_common::error::{Result, RwError}; use risingwave_common::row::{OwnedRow, Row, RowExt}; use risingwave_common::util::chunk_coalesce::DataChunkBuilder; use risingwave_common::util::iter_util::ZipEqFast; -use risingwave_expr::function::window::WindowFuncCall; -use risingwave_expr::window_function::{create_window_state, StateKey, WindowStates}; +use risingwave_expr::window_function::{ + create_window_state, StateKey, WindowFuncCall, WindowStates, +}; use risingwave_pb::batch_plan::plan_node::NodeBody; use super::{BoxedDataChunkStream, BoxedExecutor, BoxedExecutorBuilder, Executor, ExecutorBuilder}; diff --git a/src/expr/src/function/mod.rs b/src/expr/src/function/mod.rs deleted file mode 100644 index ed628e99398ca..0000000000000 --- a/src/expr/src/function/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -pub mod window; - -// TODO(rc): this module is to be removed diff --git a/src/expr/src/function/window/mod.rs b/src/expr/src/function/window/mod.rs deleted file mode 100644 index add145718c948..0000000000000 --- a/src/expr/src/function/window/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -pub use crate::window_function::*; diff --git a/src/expr/src/lib.rs b/src/expr/src/lib.rs index 6c4694a81cbe9..639e66da19df2 100644 --- a/src/expr/src/lib.rs +++ b/src/expr/src/lib.rs @@ -29,7 +29,6 @@ extern crate self as risingwave_expr; pub mod agg; mod error; pub mod expr; -pub mod function; pub mod sig; pub mod table_function; pub mod vector_op; diff --git a/src/expr/src/window_function/state/aggregate.rs b/src/expr/src/window_function/state/aggregate.rs index b67d42042bc91..749baf7784343 100644 --- a/src/expr/src/window_function/state/aggregate.rs +++ b/src/expr/src/window_function/state/aggregate.rs @@ -25,7 +25,7 @@ use smallvec::SmallVec; use super::buffer::WindowBuffer; use super::{StateEvictHint, StateKey, StatePos, WindowState}; use crate::agg::{build_append_only, AggArgs, AggCall, BoxedAggregateFunction}; -use crate::function::window::{WindowFuncCall, WindowFuncKind}; +use crate::window_function::{WindowFuncCall, WindowFuncKind}; use crate::Result; pub struct AggregateState { diff --git a/src/expr/src/window_function/state/buffer.rs b/src/expr/src/window_function/state/buffer.rs index 97f68b18375b2..a375c7bfec225 100644 --- a/src/expr/src/window_function/state/buffer.rs +++ b/src/expr/src/window_function/state/buffer.rs @@ -17,7 +17,7 @@ use std::ops::Range; use either::Either; -use crate::function::window::{Frame, FrameBounds, FrameExclusion}; +use crate::window_function::{Frame, FrameBounds, FrameExclusion}; struct Entry { key: K, @@ -238,7 +238,7 @@ mod tests { use itertools::Itertools; use super::*; - use crate::function::window::{Frame, FrameBound}; + use crate::window_function::{Frame, FrameBound}; #[test] fn test_rows_frame_unbounded_preceding_to_current_row() { diff --git a/src/expr/src/window_function/state/mod.rs b/src/expr/src/window_function/state/mod.rs index fe6e47b016d40..977a04b2a7a70 100644 --- a/src/expr/src/window_function/state/mod.rs +++ b/src/expr/src/window_function/state/mod.rs @@ -20,8 +20,7 @@ use risingwave_common::types::{Datum, DefaultOrdered}; use risingwave_common::util::memcmp_encoding::MemcmpEncoded; use smallvec::SmallVec; -use super::WindowFuncCall; -use crate::function::window::WindowFuncKind; +use super::{WindowFuncCall, WindowFuncKind}; use crate::sig::FuncSigDebug; use crate::{ExprError, Result}; diff --git a/src/expr/src/window_function/state/row_number.rs b/src/expr/src/window_function/state/row_number.rs index 01b713cbc1196..7abf30fc5f5c7 100644 --- a/src/expr/src/window_function/state/row_number.rs +++ b/src/expr/src/window_function/state/row_number.rs @@ -18,7 +18,7 @@ use risingwave_common::types::Datum; use smallvec::SmallVec; use super::{StateEvictHint, StateKey, StatePos, WindowState}; -use crate::function::window::WindowFuncCall; +use crate::window_function::WindowFuncCall; use crate::Result; #[derive(EstimateSize)] @@ -83,7 +83,7 @@ mod tests { use super::*; use crate::agg::AggArgs; - use crate::function::window::{Frame, FrameBound, WindowFuncKind}; + use crate::window_function::{Frame, FrameBound, WindowFuncKind}; fn create_state_key(pk: i64) -> StateKey { StateKey { diff --git a/src/frontend/src/binder/expr/function.rs b/src/frontend/src/binder/expr/function.rs index 8e6deb14505f2..1146050e8dde4 100644 --- a/src/frontend/src/binder/expr/function.rs +++ b/src/frontend/src/binder/expr/function.rs @@ -26,7 +26,7 @@ use risingwave_common::session_config::USER_NAME_WILD_CARD; use risingwave_common::types::{DataType, ScalarImpl, Timestamptz}; use risingwave_common::{GIT_SHA, RW_VERSION}; use risingwave_expr::agg::{agg_kinds, AggKind}; -use risingwave_expr::function::window::{ +use risingwave_expr::window_function::{ Frame, FrameBound, FrameBounds, FrameExclusion, WindowFuncKind, }; use risingwave_sqlparser::ast::{ diff --git a/src/frontend/src/expr/window_function.rs b/src/frontend/src/expr/window_function.rs index 62f961515cdd0..371a00dc6b62a 100644 --- a/src/frontend/src/expr/window_function.rs +++ b/src/frontend/src/expr/window_function.rs @@ -15,7 +15,7 @@ use itertools::Itertools; use risingwave_common::error::{ErrorCode, RwError}; use risingwave_common::types::DataType; -use risingwave_expr::function::window::{Frame, WindowFuncKind}; +use risingwave_expr::window_function::{Frame, WindowFuncKind}; use super::{AggCall, Expr, ExprImpl, OrderBy, RwResult}; diff --git a/src/frontend/src/optimizer/plan_node/generic/over_window.rs b/src/frontend/src/optimizer/plan_node/generic/over_window.rs index 5f7b0705fba26..c148711698a24 100644 --- a/src/frontend/src/optimizer/plan_node/generic/over_window.rs +++ b/src/frontend/src/optimizer/plan_node/generic/over_window.rs @@ -18,7 +18,7 @@ use risingwave_common::catalog::{Field, Schema}; use risingwave_common::types::DataType; use risingwave_common::util::column_index_mapping::ColIndexMapping; use risingwave_common::util::sort_util::{ColumnOrder, ColumnOrderDisplay}; -use risingwave_expr::function::window::{Frame, WindowFuncKind}; +use risingwave_expr::window_function::{Frame, WindowFuncKind}; use risingwave_pb::expr::PbWindowFunction; use super::{DistillUnit, GenericPlanNode, GenericPlanRef}; diff --git a/src/frontend/src/optimizer/plan_node/logical_over_window.rs b/src/frontend/src/optimizer/plan_node/logical_over_window.rs index b2057f28e05fc..ed74f379cf4ba 100644 --- a/src/frontend/src/optimizer/plan_node/logical_over_window.rs +++ b/src/frontend/src/optimizer/plan_node/logical_over_window.rs @@ -18,7 +18,7 @@ use risingwave_common::error::{ErrorCode, Result, RwError}; use risingwave_common::types::{DataType, Datum, ScalarImpl}; use risingwave_common::util::sort_util::{ColumnOrder, OrderType}; use risingwave_expr::agg::AggKind; -use risingwave_expr::function::window::{Frame, FrameBound, WindowFuncKind}; +use risingwave_expr::window_function::{Frame, FrameBound, WindowFuncKind}; use super::generic::{GenericPlanRef, OverWindow, PlanWindowFunction, ProjectBuilder}; use super::utils::impl_distill_by_unit; diff --git a/src/frontend/src/optimizer/rule/over_window_to_agg_and_join_rule.rs b/src/frontend/src/optimizer/rule/over_window_to_agg_and_join_rule.rs index b9587650f8726..dbf3e9809675c 100644 --- a/src/frontend/src/optimizer/rule/over_window_to_agg_and_join_rule.rs +++ b/src/frontend/src/optimizer/rule/over_window_to_agg_and_join_rule.rs @@ -13,7 +13,7 @@ // limitations under the License. use itertools::Itertools; -use risingwave_expr::function::window::WindowFuncKind; +use risingwave_expr::window_function::WindowFuncKind; use risingwave_pb::expr::expr_node::Type; use risingwave_pb::plan_common::JoinType; diff --git a/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs b/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs index 297522a41c8c9..dfb6963c7fb4f 100644 --- a/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs +++ b/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs @@ -14,7 +14,7 @@ use fixedbitset::FixedBitSet; use risingwave_common::types::DataType; -use risingwave_expr::function::window::WindowFuncKind; +use risingwave_expr::window_function::WindowFuncKind; use super::Rule; use crate::expr::{collect_input_refs, ExprImpl, ExprType}; diff --git a/src/stream/src/from_proto/eowc_over_window.rs b/src/stream/src/from_proto/eowc_over_window.rs index 0cd0060a40b68..bcee0736ae30f 100644 --- a/src/stream/src/from_proto/eowc_over_window.rs +++ b/src/stream/src/from_proto/eowc_over_window.rs @@ -14,7 +14,7 @@ use std::sync::Arc; -use risingwave_expr::function::window::WindowFuncCall; +use risingwave_expr::window_function::WindowFuncCall; use risingwave_pb::stream_plan::PbEowcOverWindowNode; use risingwave_storage::StateStore; diff --git a/src/stream/src/from_proto/over_window.rs b/src/stream/src/from_proto/over_window.rs index 7d139ca3f74db..e18e753caf126 100644 --- a/src/stream/src/from_proto/over_window.rs +++ b/src/stream/src/from_proto/over_window.rs @@ -16,7 +16,7 @@ use std::sync::Arc; use risingwave_common::session_config::OverWindowCachePolicy; use risingwave_common::util::sort_util::ColumnOrder; -use risingwave_expr::function::window::WindowFuncCall; +use risingwave_expr::window_function::WindowFuncCall; use risingwave_pb::stream_plan::PbOverWindowNode; use risingwave_storage::StateStore; diff --git a/src/stream/tests/integration_tests/eowc_over_window.rs b/src/stream/tests/integration_tests/eowc_over_window.rs index d7d788680af55..35cc4954aff45 100644 --- a/src/stream/tests/integration_tests/eowc_over_window.rs +++ b/src/stream/tests/integration_tests/eowc_over_window.rs @@ -13,7 +13,7 @@ // limitations under the License. use risingwave_expr::agg::{AggArgs, AggKind}; -use risingwave_expr::function::window::{Frame, FrameBound, WindowFuncCall, WindowFuncKind}; +use risingwave_expr::window_function::{Frame, FrameBound, WindowFuncCall, WindowFuncKind}; use risingwave_stream::executor::{EowcOverWindowExecutor, EowcOverWindowExecutorArgs}; use crate::prelude::*; diff --git a/src/stream/tests/integration_tests/over_window.rs b/src/stream/tests/integration_tests/over_window.rs index 4b7b53aaae31b..2377ce12e9147 100644 --- a/src/stream/tests/integration_tests/over_window.rs +++ b/src/stream/tests/integration_tests/over_window.rs @@ -14,7 +14,7 @@ use risingwave_common::session_config::OverWindowCachePolicy; use risingwave_expr::agg::{AggArgs, AggKind}; -use risingwave_expr::function::window::{ +use risingwave_expr::window_function::{ Frame, FrameBound, FrameExclusion, WindowFuncCall, WindowFuncKind, }; use risingwave_stream::executor::monitor::StreamingMetrics;