use std::io::Error;
use arrow::datatypes::*;
use super::exec::*;
use super::rel::*;
#[derive(Debug)]
pub enum DataFrameError {
IoError(Error),
ExecError(ExecutionError),
InvalidColumn(String),
NotImplemented,
}
impl From<ExecutionError> for DataFrameError {
fn from(e: ExecutionError) -> Self {
DataFrameError::ExecError(e)
}
}
impl From<Error> for DataFrameError {
fn from(e: Error) -> Self {
DataFrameError::IoError(e)
}
}
pub trait DataFrame {
fn repartition(&self, n: u32) -> Result<Box<DataFrame>, DataFrameError>;
fn select(&self, expr: Vec<Expr>) -> Result<Box<DataFrame>, DataFrameError>;
fn filter(&self, expr: Expr) -> Result<Box<DataFrame>, DataFrameError>;
fn sort(&self, expr: Vec<Expr>) -> Result<Box<DataFrame>, DataFrameError>;
fn col(&self, column_name: &str) -> Result<Expr, DataFrameError>;
fn schema(&self) -> Schema;
fn plan(&self) -> Box<LogicalPlan>;
}