Skip to main content

reifydb_sub_flow/operator/
sort.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use reifydb_abi::operator::capabilities::OperatorCapability;
5use reifydb_core::{
6	interface::{catalog::flow::FlowNodeId, change::Change},
7	value::column::columns::Columns,
8};
9use reifydb_rql::expression::Expression;
10use reifydb_value::Result;
11
12use crate::{
13	operator::{Operator, OperatorCell},
14	transaction::FlowTransaction,
15};
16
17pub struct SortOperator {
18	parent: OperatorCell,
19	node: FlowNodeId,
20	_expressions: Vec<Expression>,
21}
22
23impl SortOperator {
24	pub fn new(parent: OperatorCell, node: FlowNodeId, _expressions: Vec<Expression>) -> Self {
25		Self {
26			parent,
27			node,
28			_expressions,
29		}
30	}
31}
32
33impl SortOperator {
34	pub(crate) fn output_schema(&self) -> Option<Columns> {
35		self.parent.output_schema()
36	}
37}
38
39impl Operator for SortOperator {
40	fn id(&self) -> FlowNodeId {
41		self.node
42	}
43
44	fn capabilities(&self) -> &[OperatorCapability] {
45		OperatorCapability::STANDARD
46	}
47
48	fn apply(&self, _txn: &mut FlowTransaction, change: Change) -> Result<Change> {
49		// TODO: Implement single-encoded sort processing
50
51		Ok(Change::from_flow(self.node, change.version, change.diffs, change.changed_at))
52	}
53}