Skip to main content

risingwave_stream/from_proto/
row_merge.rs

1// Copyright 2024 RisingWave 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
15use risingwave_common::util::column_index_mapping::ColIndexMapping;
16use risingwave_pb::stream_plan::RowMergeNode;
17
18use crate::executor::RowMergeExecutor;
19use crate::from_proto::*;
20
21pub struct RowMergeExecutorBuilder;
22
23impl_stream_node_body!(RowMerge(RowMergeNode) => RowMergeExecutorBuilder);
24
25impl ExecutorBuilder for RowMergeExecutorBuilder {
26    type Node = RowMergeNode;
27
28    async fn new_boxed_executor(
29        params: ExecutorParams,
30        node: &Self::Node,
31        _store: impl StateStore,
32    ) -> StreamResult<Executor> {
33        let [lhs_input, rhs_input]: [_; 2] = params.input.try_into().unwrap();
34        let lhs_mapping = ColIndexMapping::from_protobuf(node.lhs_mapping.as_ref().unwrap());
35        let rhs_mapping = ColIndexMapping::from_protobuf(node.rhs_mapping.as_ref().unwrap());
36
37        let exec = RowMergeExecutor::new(
38            params.actor_context,
39            lhs_input,
40            rhs_input,
41            lhs_mapping,
42            rhs_mapping,
43            params.info.schema.clone(),
44        );
45        Ok(Executor::new(params.info, exec.boxed()))
46    }
47}