-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rust): Raise if *_horizontal without inputs (#12106)
- Loading branch information
Showing
7 changed files
with
81 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
use polars::lazy::dsl; | ||
use pyo3::prelude::*; | ||
|
||
use crate::error::PyPolarsErr; | ||
use crate::expr::ToExprs; | ||
use crate::PyExpr; | ||
|
||
#[pyfunction] | ||
pub fn all_horizontal(exprs: Vec<PyExpr>) -> PyExpr { | ||
pub fn all_horizontal(exprs: Vec<PyExpr>) -> PyResult<PyExpr> { | ||
let exprs = exprs.to_exprs(); | ||
dsl::all_horizontal(exprs).into() | ||
let e = dsl::all_horizontal(exprs).map_err(PyPolarsErr::from)?; | ||
Ok(e.into()) | ||
} | ||
|
||
#[pyfunction] | ||
pub fn any_horizontal(exprs: Vec<PyExpr>) -> PyExpr { | ||
pub fn any_horizontal(exprs: Vec<PyExpr>) -> PyResult<PyExpr> { | ||
let exprs = exprs.to_exprs(); | ||
dsl::any_horizontal(exprs).into() | ||
let e = dsl::any_horizontal(exprs).map_err(PyPolarsErr::from)?; | ||
Ok(e.into()) | ||
} | ||
|
||
#[pyfunction] | ||
pub fn max_horizontal(exprs: Vec<PyExpr>) -> PyExpr { | ||
pub fn max_horizontal(exprs: Vec<PyExpr>) -> PyResult<PyExpr> { | ||
let exprs = exprs.to_exprs(); | ||
dsl::max_horizontal(exprs).into() | ||
let e = dsl::max_horizontal(exprs).map_err(PyPolarsErr::from)?; | ||
Ok(e.into()) | ||
} | ||
|
||
#[pyfunction] | ||
pub fn min_horizontal(exprs: Vec<PyExpr>) -> PyExpr { | ||
pub fn min_horizontal(exprs: Vec<PyExpr>) -> PyResult<PyExpr> { | ||
let exprs = exprs.to_exprs(); | ||
dsl::min_horizontal(exprs).into() | ||
let e = dsl::min_horizontal(exprs).map_err(PyPolarsErr::from)?; | ||
Ok(e.into()) | ||
} | ||
|
||
#[pyfunction] | ||
pub fn sum_horizontal(exprs: Vec<PyExpr>) -> PyExpr { | ||
pub fn sum_horizontal(exprs: Vec<PyExpr>) -> PyResult<PyExpr> { | ||
let exprs = exprs.to_exprs(); | ||
dsl::sum_horizontal(exprs).into() | ||
let e = dsl::sum_horizontal(exprs).map_err(PyPolarsErr::from)?; | ||
Ok(e.into()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters