reifydb_engine/flow/compiler/primitive/
table_scan.rs1use reifydb_core::interface::catalog::flow::FlowNodeId;
7use reifydb_rql::{flow::node::FlowNodeType::SourceTable, nodes::TableScanNode};
8use reifydb_transaction::transaction::admin::AdminTransaction;
9use reifydb_type::Result;
10
11use crate::flow::compiler::{CompileOperator, FlowCompiler};
12
13pub(crate) struct TableScanCompiler {
14 pub table_scan: TableScanNode,
15}
16
17impl From<TableScanNode> for TableScanCompiler {
18 fn from(table_scan: TableScanNode) -> Self {
19 Self {
20 table_scan,
21 }
22 }
23}
24
25impl CompileOperator for TableScanCompiler {
26 fn compile(self, compiler: &mut FlowCompiler, txn: &mut AdminTransaction) -> Result<FlowNodeId> {
27 let table_id = self.table_scan.source.def().id;
28 compiler.add_node(
29 txn,
30 SourceTable {
31 table: table_id,
32 },
33 )
34 }
35}