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

chore: remove legacy arrow compute #15164

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions crates/polars-arrow/src/array/static_array.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bytemuck::Zeroable;

use crate::array::binview::BinaryViewValueIter;
use crate::array::growable::{Growable, GrowableFixedSizeList};
use crate::array::static_array_collect::ArrayFromIterDtype;
use crate::array::{
Array, ArrayValuesIter, BinaryArray, BinaryValueIter, BinaryViewArray, BooleanArray,
Expand Down Expand Up @@ -383,4 +384,11 @@ impl StaticArray for FixedSizeListArray {
fn full_null(length: usize, dtype: ArrowDataType) -> Self {
Self::new_null(dtype, length)
}

fn full(length: usize, value: Self::ValueT<'_>, dtype: ArrowDataType) -> Self {
let singular_arr = FixedSizeListArray::new(dtype, value, None);
let mut arr = GrowableFixedSizeList::new(vec![&singular_arr], false, length);
unsafe { arr.extend_copies(0, 0, 1, length) }
arr.into()
}
}
4 changes: 2 additions & 2 deletions crates/polars-arrow/src/compute/cast/binview_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use polars_error::PolarsResult;
use crate::array::*;
use crate::compute::cast::binary_to::Parse;
use crate::compute::cast::CastOptions;
use crate::datatypes::{ArrowDataType, TimeUnit};
#[cfg(feature = "dtype-decimal")]
use crate::legacy::compute::decimal::deserialize_decimal;
use crate::compute::decimal::deserialize_decimal;
use crate::datatypes::{ArrowDataType, TimeUnit};
use crate::offset::Offset;
use crate::temporal_conversions::EPOCH_DAYS_FROM_CE;
use crate::types::NativeType;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-arrow/src/compute/cast/decimal_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub(super) fn decimal_to_utf8view(from: &PrimitiveArray<i128>) -> Utf8ViewArray
let mut mutable = MutableBinaryViewArray::with_capacity(from.len());

for &x in from.values().iter() {
let buf = crate::legacy::compute::decimal::format_decimal(x, from_scale, false);
let buf = crate::compute::decimal::format_decimal(x, from_scale, false);
mutable.push_value_ignore_validity(buf.as_str())
}

Expand Down
2 changes: 2 additions & 0 deletions crates/polars-arrow/src/compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub mod boolean_kleene;
#[cfg_attr(docsrs, doc(cfg(feature = "compute_cast")))]
pub mod cast;
pub mod concatenate;
#[cfg(feature = "dtype-decimal")]
pub mod decimal;
#[cfg(feature = "compute_take")]
#[cfg_attr(docsrs, doc(cfg(feature = "compute_take")))]
pub mod take;
Expand Down
51 changes: 0 additions & 51 deletions crates/polars-arrow/src/legacy/compute/mod.rs

This file was deleted.

25 changes: 0 additions & 25 deletions crates/polars-arrow/src/legacy/compute/tile.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/polars-arrow/src/legacy/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod array;
pub mod bit_util;
pub mod bitmap;
pub mod compute;
pub mod conversion;
pub mod error;
pub mod index;
Expand Down
2 changes: 2 additions & 0 deletions crates/polars-compute/src/if_then_else/simd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#[cfg(target_arch = "x86_64")]
use std::mem::MaybeUninit;
#[cfg(target_arch = "x86_64")]
use std::simd::{Mask, Simd, SimdElement};

use arrow::array::PrimitiveArray;
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-core/src/chunked_array/ops/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl StringChunked {
let mut iter = self.into_iter();
let mut valid_count = 0;
while let Some(Some(v)) = iter.next() {
let scale_value = arrow::legacy::compute::decimal::infer_scale(v.as_bytes());
let scale_value = arrow::compute::decimal::infer_scale(v.as_bytes());
scale = std::cmp::max(scale, scale_value);
valid_count += 1;
if valid_count == infer_length {
Expand Down
9 changes: 2 additions & 7 deletions crates/polars-core/src/chunked_array/ops/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,8 @@ impl ChunkFull<&Series> for ArrayChunked {
Box::new(ArrowField::new("item", dtype.to_arrow(true), true)),
width,
);
let arr = if value.dtype().is_numeric() {
let values = value.tile(length);
FixedSizeListArray::new(arrow_dtype, values.chunks()[0].clone(), None)
} else {
let value = value.rechunk().chunks()[0].clone();
FixedSizeListArray::full(length, value, arrow_dtype)
};
let value = value.rechunk().chunks()[0].clone();
let arr = FixedSizeListArray::full(length, value, arrow_dtype);
ChunkedArray::with_chunk(name, arr)
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/polars-core/src/chunked_array/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub mod search_sorted;
mod set;
mod shift;
pub mod sort;
mod tile;
#[cfg(feature = "algorithm_group_by")]
pub(crate) mod unique;
#[cfg(feature = "zip_with")]
Expand Down
13 changes: 0 additions & 13 deletions crates/polars-core/src/chunked_array/ops/tile.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/polars-core/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ impl Series {
#[inline]
#[cfg(feature = "dtype-decimal")]
pub fn fmt_decimal(f: &mut Formatter<'_>, v: i128, scale: usize) -> fmt::Result {
use arrow::legacy::compute::decimal::format_decimal;
use arrow::compute::decimal::format_decimal;

let trim_zeros = get_trim_decimal_zeros();
let repr = format_decimal(v, scale, trim_zeros);
Expand Down
4 changes: 0 additions & 4 deletions crates/polars-core/src/series/implementations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,6 @@ macro_rules! impl_dyn_series {
fn as_any(&self) -> &dyn Any {
&self.0
}

fn tile(&self, n: usize) -> Series {
self.0.tile(n).into_series()
}
}
};
}
Expand Down
4 changes: 0 additions & 4 deletions crates/polars-core/src/series/series_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,6 @@ pub trait SeriesTrait:
) -> PolarsResult<Series> {
polars_bail!(opq = rolling_map, self._dtype());
}

fn tile(&self, _n: usize) -> Series {
invalid_operation_panic!(tile, self);
}
}

impl<'a> (dyn SeriesTrait + 'a) {
Expand Down
Loading