Skip to content

Commit

Permalink
fix benches
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Nov 4, 2021
1 parent 6808c75 commit 7507bce
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
8 changes: 4 additions & 4 deletions polars/benches/groupby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ lazy_static! {
.with_stop_after_n_rows(Some(1000000))
.finish()
.unwrap();
df.may_apply("id1", |s| s.cast(DataType::Categorical)())
df.may_apply("id1", |s| s.cast(&DataType::Categorical))
.unwrap();
df.may_apply("id2", |s| s.cast(DataType::Categorical)())
df.may_apply("id2", |s| s.cast(&DataType::Categorical))
.unwrap();
df.may_apply("id3", |s| s.cast(DataType::Categorical)())
df.may_apply("id3", |s| s.cast(&DataType::Categorical))
.unwrap();
df
};
Expand Down Expand Up @@ -129,7 +129,7 @@ fn q8(c: &mut Criterion) {
.sort("v3", true)
.groupby([col("id6")])
.agg([col("v3").head(Some(2)).alias("v3_top_2")])
.explode(&[col("v3_top_2")])
.explode(vec![col("v3_top_2")])
.collect()
.unwrap();
})
Expand Down
8 changes: 3 additions & 5 deletions polars/polars-arrow/src/kernels/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ pub unsafe fn take_no_null_primitive<T: NativeType>(
arr: &PrimitiveArray<T>,
indices: &UInt32Array,
) -> Arc<PrimitiveArray<T>> {
debug_assert_eq!(arr.has_validity(), false);

debug_assert!(!arr.has_validity());
let array_values = arr.values().as_slice();
let index_values = indices.values().as_slice();

Expand All @@ -87,8 +86,7 @@ pub unsafe fn take_no_null_primitive_iter_unchecked<
arr: &PrimitiveArray<T>,
indices: I,
) -> Arc<PrimitiveArray<T>> {
debug_assert_eq!(arr.has_validity(), false);

debug_assert!(!arr.has_validity());
let array_values = arr.values().as_slice();

let iter = indices
Expand Down Expand Up @@ -189,7 +187,7 @@ pub unsafe fn take_no_null_bool_iter_unchecked<I: IntoIterator<Item = usize>>(
arr: &BooleanArray,
indices: I,
) -> Arc<BooleanArray> {
debug_assert_eq!(arr.has_validity(), false);
debug_assert!(!arr.has_validity());
let iter = indices
.into_iter()
.map(|idx| Some(arr.values().get_bit_unchecked(idx)));
Expand Down
5 changes: 2 additions & 3 deletions polars/polars-arrow/src/kernels/take_agg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! kernels that combine take and aggregations.
use crate::array::PolarsArray;
use arrow::array::{Array, PrimitiveArray};
use arrow::array::PrimitiveArray;
use arrow::types::NativeType;

/// Take kernel for single chunk without nulls and an iterator as index.
Expand All @@ -17,8 +17,7 @@ pub unsafe fn take_agg_no_null_primitive_iter_unchecked<
f: F,
init: T,
) -> T {
debug_assert_eq!(arr.has_validity(), false);

debug_assert!(!arr.has_validity());
let array_values = arr.values().as_slice();

indices
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/take/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#[cfg(feature = "dtype-categorical")]
use std::ops::Deref;

use arrow::array::{Array, ArrayRef};
use arrow::array::ArrayRef;
use arrow::compute::take::take;
use polars_arrow::kernels::take::*;

Expand Down
2 changes: 1 addition & 1 deletion polars/polars-core/src/chunked_array/ops/take/traits.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Traits that indicate the allowed arguments in a ChunkedArray::take operation.
use crate::prelude::*;
use arrow::array::{Array, UInt32Array};
use arrow::array::UInt32Array;
use polars_arrow::array::PolarsArray;

// Utility traits
Expand Down
1 change: 0 additions & 1 deletion polars/polars-core/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use crate::vector_hasher::boost_hash_combine;
use crate::vector_hasher::df_rows_to_hashes_threaded;
use crate::POOL;
use hashbrown::HashMap;
use polars_arrow::array::PolarsArray;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::hash::{BuildHasher, Hash, Hasher};
Expand Down
1 change: 0 additions & 1 deletion py-polars/polars/eager/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,6 @@ def null_count(self) -> int:
"""
return self._s.null_count()


def has_validity(self) -> bool:
"""
Returns True if the Series has a validity bitmask. If there is none, it means that there are no null values.
Expand Down

0 comments on commit 7507bce

Please sign in to comment.