reifydb_engine/flow/compiler/operator/
append.rs1use reifydb_core::interface::catalog::flow::FlowNodeId;
5use reifydb_rql::{flow::node::FlowNodeType, nodes::AppendQueryNode, query::QueryPlan};
6use reifydb_transaction::transaction::admin::AdminTransaction;
7use reifydb_type::Result;
8
9use crate::flow::compiler::{CompileOperator, FlowCompiler};
10
11pub(crate) struct AppendCompiler {
12 pub left: Box<QueryPlan>,
13 pub right: Box<QueryPlan>,
14}
15
16impl From<AppendQueryNode> for AppendCompiler {
17 fn from(node: AppendQueryNode) -> Self {
18 Self {
19 left: node.left,
20 right: node.right,
21 }
22 }
23}
24
25impl CompileOperator for AppendCompiler {
26 fn compile(self, compiler: &mut FlowCompiler, txn: &mut AdminTransaction) -> Result<FlowNodeId> {
27 let left_node = compiler.compile_plan(txn, *self.left)?;
28 let right_node = compiler.compile_plan(txn, *self.right)?;
29
30 let node_id = compiler.add_node(txn, FlowNodeType::Append)?;
31
32 compiler.add_edge(txn, &left_node, &node_id)?;
33 compiler.add_edge(txn, &right_node, &node_id)?;
34
35 Ok(node_id)
36 }
37}