use super::OperationKind;
use crate::catalog::operator::Operator;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OperatorIdentifier {
pub schema: String,
pub name: String,
pub arguments: String,
}
impl OperatorIdentifier {
pub fn from_operator(operator: &Operator) -> Self {
Self {
schema: operator.schema.clone(),
name: operator.name.clone(),
arguments: operator.arguments.clone(),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OperatorOperation {
Create {
operator: Box<Operator>,
},
Drop {
identifier: OperatorIdentifier,
},
Replace {
old_operator: Box<Operator>,
new_operator: Box<Operator>,
},
}
impl OperatorOperation {
pub fn operation_kind(&self) -> OperationKind {
match self {
Self::Create { .. } => OperationKind::Create,
Self::Drop { .. } => OperationKind::Drop,
Self::Replace { .. } => OperationKind::Alter,
}
}
}