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