pub(crate) fn unpack_binary_exprs(expr: &Expr) -> Result<(&Expr, &Expr)> {
    match expr {
        Expr::Unique(expr) => unpack_binary_exprs(expr),
        Expr::Duplicated(expr) => unpack_binary_exprs(expr),
        Expr::Reverse(expr) => unpack_binary_exprs(expr),
        Expr::Alias(expr, _) => unpack_binary_exprs(expr),
        Expr::Not(expr) => unpack_binary_exprs(expr),
        Expr::IsNull(expr) => unpack_binary_exprs(expr),
        Expr::IsNotNull(expr) => unpack_binary_exprs(expr),
        Expr::AggFirst(expr) => unpack_binary_exprs(expr),
        Expr::AggLast(expr) => unpack_binary_exprs(expr),
        Expr::AggGroups(expr) => unpack_binary_exprs(expr),
        Expr::AggNUnique(expr) => unpack_binary_exprs(expr),
        Expr::AggQuantile { expr, .. } => unpack_binary_exprs(expr),
        Expr::AggSum(expr) => unpack_binary_exprs(expr),
        Expr::AggMin(expr) => unpack_binary_exprs(expr),
        Expr::AggMax(expr) => unpack_binary_exprs(expr),
        Expr::AggMedian(expr) => unpack_binary_exprs(expr),
        Expr::AggMean(expr) => unpack_binary_exprs(expr),
        Expr::AggCount(expr) => unpack_binary_exprs(expr),
        Expr::BinaryExpr { left, right, .. } => Ok((&**left, &**right)),
        Expr::Sort { expr, .. } => unpack_binary_exprs(expr),
        Expr::Shift { input, .. } => unpack_binary_exprs(input),
        Expr::Apply { input, .. } => unpack_binary_exprs(input),
        Expr::Cast { expr, .. } => unpack_binary_exprs(expr),
        a => Err(PolarsError::Other(
            format!("No binary expression could be found for {:?}", a).into(),
        )),
    }
}
// Find the first binary expressions somewhere in the tree.
Find the first binary expressions somewhere in the tree.
Find the first binary expressions somewhere in the tree .
pub(crate) fn unpack_binary_exprs(expr: &Expr) -> Result<(&Expr, &Expr)> {
    match expr {
        Expr::Unique(expr) => unpack_binary_exprs(expr),
        Expr::Duplicated(expr) => unpack_binary_exprs(expr),
        Expr::Reverse(expr) => unpack_binary_exprs(expr),
        Expr::Alias(expr, _) => unpack_binary_exprs(expr),
        Expr::Not(expr) => unpack_binary_exprs(expr),
        Expr::IsNull(expr) => unpack_binary_exprs(expr),
        Expr::IsNotNull(expr) => unpack_binary_exprs(expr),
        Expr::AggFirst(expr) => unpack_binary_exprs(expr),
        Expr::AggLast(expr) => unpack_binary_exprs(expr),
        Expr::AggGroups(expr) => unpack_binary_exprs(expr),
        Expr::AggNUnique(expr) => unpack_binary_exprs(expr),
        Expr::AggQuantile { expr, .. } => unpack_binary_exprs(expr),
        Expr::AggSum(expr) => unpack_binary_exprs(expr),
        Expr::AggMin(expr) => unpack_binary_exprs(expr),
        Expr::AggMax(expr) => unpack_binary_exprs(expr),
        Expr::AggMedian(expr) => unpack_binary_exprs(expr),
        Expr::AggMean(expr) => unpack_binary_exprs(expr),
        Expr::AggCount(expr) => unpack_binary_exprs(expr),
        Expr::BinaryExpr { left, right, .. } => Ok((&**left, &**right)),
        Expr::Sort { expr, .. } => unpack_binary_exprs(expr),
        Expr::Shift { input, .. } => unpack_binary_exprs(input),
        Expr::Apply { input, .. } => unpack_binary_exprs(input),
        Expr::Cast { expr, .. } => unpack_binary_exprs(expr),
        a => Err(PolarsError::Other(
            format!("No binary expression could be found for {:?}", a).into(),
        )),
    }
}
pub ( crate ) fn unpack_binary_exprs ( expr : & Expr ) -> Result < ( & Expr , & Expr ) > { match expr { Expr :: Unique ( expr ) => unpack_binary_exprs ( expr ) , Expr :: Duplicated ( expr ) => unpack_binary_exprs ( expr ) , Expr :: Reverse ( expr ) => unpack_binary_exprs ( expr ) , Expr :: Alias ( expr , _ ) => unpack_binary_exprs ( expr ) , Expr :: Not ( expr ) => unpack_binary_exprs ( expr ) , Expr :: IsNull ( expr ) => unpack_binary_exprs ( expr ) , Expr :: IsNotNull ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggFirst ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggLast ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggGroups ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggNUnique ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggQuantile { expr , .. } => unpack_binary_exprs ( expr ) , Expr :: AggSum ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggMin ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggMax ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggMedian ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggMean ( expr ) => unpack_binary_exprs ( expr ) , Expr :: AggCount ( expr ) => unpack_binary_exprs ( expr ) , Expr :: BinaryExpr { left , right , .. } => Ok ( ( & * * left , & * * right ) ) , Expr :: Sort { expr , .. } => unpack_binary_exprs ( expr ) , Expr :: Shift { input , .. } => unpack_binary_exprs ( input ) , Expr :: Apply { input , .. } => unpack_binary_exprs ( input ) , Expr :: Cast { expr , .. } => unpack_binary_exprs ( expr ) , a => Err ( PolarsError :: Other ( format ! ( " " a ) . into ( ) , ) ) , } }
Find the first binary expressions somewhere in the tree.
Find the first binary expressions somewhere in the tree .
expr
&Expr
expr
&Expr