Skip to content

Commit aa2e214

Browse files
authored
Merge pull request #83 from pola-rs/fix-lazy-dtype-arg-previous-greater
fix lazy dtype in arg_previous_greater
2 parents df2d46e + 3ea7312 commit aa2e214

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/arg_previous_greater.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use polars::prelude::*;
22

3+
34
pub(crate) fn impl_arg_previous_greater<T>(ca: &ChunkedArray<T>) -> IdxCa
45
where
56
T: PolarsNumericType,

src/expressions.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ fn to_julian_date(inputs: &[Series]) -> PolarsResult<Series> {
8383
impl_to_julian_date(s)
8484
}
8585

86-
// todo: can we make this bigidx-dependent?
87-
#[polars_expr(output_type=UInt32)]
86+
87+
fn list_idx_dtype(input_fields: &[Field]) -> PolarsResult<Field> {
88+
let field = Field::new(
89+
input_fields[0].name.clone(),
90+
DataType::List(Box::new(IDX_DTYPE))
91+
);
92+
Ok(field.clone())
93+
}
94+
95+
#[polars_expr(output_type_func=list_idx_dtype)]
8896
fn arg_previous_greater(inputs: &[Series]) -> PolarsResult<Series> {
8997
let ser = &inputs[0];
9098
match ser.dtype() {

0 commit comments

Comments
 (0)