Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Properly fetch type of full None List Series #18916

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/polars-core/src/datatypes/any_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub enum AnyValue<'a> {
Enum(u32, &'a RevMapping, SyncPtr<Utf8ViewArray>),
#[cfg(feature = "dtype-categorical")]
EnumOwned(u32, Arc<RevMapping>, SyncPtr<Utf8ViewArray>),
// @TODO: This should be a ListArray<i64>, DataType instead of a Series
coastalwhite marked this conversation as resolved.
Show resolved Hide resolved
/// Nested type, contains arrays that are filled with one of the datatypes.
List(Series),
#[cfg(feature = "dtype-array")]
Expand Down
14 changes: 7 additions & 7 deletions crates/polars-core/src/frame/column/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn unit_series_op<F: Fn(&Series, &Series) -> PolarsResult<Series>>(
debug_assert!(r.len() <= 1);

op(l, r)
.and_then(|s| ScalarColumn::from_single_value_series(s, length))
.map(|s| ScalarColumn::from_single_value_series(s, length))
.map(Column::from)
}

Expand Down Expand Up @@ -70,12 +70,12 @@ fn num_op_with_broadcast<T: Num + NumCast, F: Fn(&Series, T) -> Series>(
c: &'_ Column,
n: T,
op: F,
) -> PolarsResult<Column> {
) -> Column {
match c {
Column::Series(s) => Ok(op(s, n).into()),
Column::Series(s) => op(s, n).into(),
Column::Scalar(s) => {
ScalarColumn::from_single_value_series(op(&s.as_single_value_series(), n), s.length)
.map(Column::from)
ScalarColumn::from_single_value_series(op(&s.as_single_value_series(), n), s.len())
.into()
},
}
}
Expand Down Expand Up @@ -111,7 +111,7 @@ macro_rules! broadcastable_num_ops {
where
T: Num + NumCast,
{
type Output = PolarsResult<Self>;
type Output = Self;

#[inline]
fn $op(self, rhs: T) -> Self::Output {
Expand All @@ -123,7 +123,7 @@ macro_rules! broadcastable_num_ops {
where
T: Num + NumCast,
{
type Output = PolarsResult<Column>;
type Output = Column;

#[inline]
fn $op(self, rhs: T) -> Self::Output {
Expand Down
Loading
Loading