use reifydb_core::interface::catalog::flow::FlowNodeId;
use reifydb_rql::{flow::node::FlowNodeType::SourceTable, nodes::TableScanNode};
use reifydb_transaction::transaction::Transaction;
use reifydb_type::Result;
use crate::flow::compiler::{CompileOperator, FlowCompiler};
pub(crate) struct TableScanCompiler {
pub table_scan: TableScanNode,
}
impl From<TableScanNode> for TableScanCompiler {
fn from(table_scan: TableScanNode) -> Self {
Self {
table_scan,
}
}
}
impl CompileOperator for TableScanCompiler {
fn compile(self, compiler: &mut FlowCompiler, txn: &mut Transaction<'_>) -> Result<FlowNodeId> {
let table_id = self.table_scan.source.def().id;
compiler.add_node(
txn,
SourceTable {
table: table_id,
},
)
}
}