use super::{Batch, ExecResult, PhysicalOperator, SetOpKind};
pub struct SetOperation<'a> {
inner: crate::set_operation::ExternalSetOperation<'a>,
}
impl<'a> SetOperation<'a> {
pub fn new(
left: Box<dyn PhysicalOperator + 'a>,
right: Box<dyn PhysicalOperator + 'a>,
kind: SetOpKind,
all: bool,
) -> ExecResult<Self> {
Self::new_with_work_mem(left, right, kind, all, 64 * 1024 * 1024)
}
pub fn new_with_work_mem(
left: Box<dyn PhysicalOperator + 'a>,
right: Box<dyn PhysicalOperator + 'a>,
kind: SetOpKind,
all: bool,
work_mem_bytes: usize,
) -> ExecResult<Self> {
Ok(Self {
inner: crate::set_operation::ExternalSetOperation::new(
left,
right,
kind,
all,
work_mem_bytes,
)?,
})
}
}
impl PhysicalOperator for SetOperation<'_> {
fn row_schema(&self) -> &super::RowSchema {
self.inner.row_schema()
}
fn open(&mut self) -> ExecResult<()> {
self.inner.open()
}
fn next(&mut self) -> ExecResult<Option<Batch>> {
self.inner.next()
}
fn close(&mut self) -> ExecResult<()> {
self.inner.close()
}
}