Skip to content

Commit

Permalink
housekeeping (#4371)
Browse files Browse the repository at this point in the history
  • Loading branch information
universalmind303 committed Aug 13, 2022
1 parent e8cb134 commit 643189d
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 12 deletions.
1 change: 0 additions & 1 deletion polars/polars-arrow/src/kernels/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ mod test {
use arrow::array::{Array, Int32Array, PrimitiveArray};
use arrow::buffer::Buffer;
use arrow::datatypes::DataType;
use std::sync::Arc;

fn get_array() -> ListArray<i64> {
let values = Int32Array::from_slice(&[1, 2, 3, 4, 5, 6]);
Expand Down
1 change: 0 additions & 1 deletion polars/polars-core/src/chunked_array/ops/sort/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ pub(crate) fn prepare_argsort(
#[cfg(test)]
mod test {
use crate::prelude::*;
use crate::series::ops::NullBehavior;

#[test]
fn test_argsort() {
Expand Down
1 change: 1 addition & 0 deletions polars/polars-lazy/src/dsl/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::*;
use crate::physical_plan::state::ExecutionState;
use rayon::prelude::*;

#[cfg(feature = "list_eval")]
pub(super) fn prepare_eval_expr(mut expr: Expr) -> Expr {
expr.mutate().apply(|e| match e {
Expr::Column(name) => {
Expand Down
1 change: 0 additions & 1 deletion polars/polars-lazy/src/dsl/function_expr/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[cfg(feature = "is_in")]
pub(super) fn contains(args: &mut [Series]) -> Result<Series> {
let list = &args[0];
let is_in = &args[1];
Expand Down
4 changes: 3 additions & 1 deletion polars/polars-lazy/src/dsl/function_expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ mod arg_where;
mod fill_null;
#[cfg(feature = "is_in")]
mod is_in;
#[cfg(feature = "is_in")]
mod list;

mod pow;
#[cfg(all(feature = "rolling_window", feature = "moment"))]
mod rolling;
Expand Down Expand Up @@ -96,7 +98,7 @@ impl FunctionExpr {
let dtype = func(fields[0].data_type());
Ok(Field::new(fields[0].name(), dtype))
};

#[cfg(any(feature = "rolling_window", feature = "trigonometry"))]
let float_dtype = || {
map_dtype(&|dtype| match dtype {
DataType::Float32 => DataType::Float32,
Expand Down
1 change: 1 addition & 0 deletions polars/polars-lazy/src/dsl/function_expr/temporal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;

#[cfg(feature = "date_offset")]
pub(super) fn date_offset(s: Series, offset: Duration) -> Result<Series> {
match s.dtype().clone() {
DataType::Date => {
Expand Down
12 changes: 9 additions & 3 deletions polars/polars-lazy/src/dsl/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ use crate::dsl::function_expr::FunctionExpr;
use crate::prelude::*;
use crate::utils::has_wildcard;
use polars_core::export::arrow::temporal_conversions::NANOSECONDS;
use polars_core::functions::pearson_corr_i;
use polars_core::prelude::*;
use polars_core::utils::arrow::temporal_conversions::SECONDS_IN_DAY;
use polars_core::utils::{coalesce_nulls_series, get_supertype};
use polars_core::utils::get_supertype;

#[cfg(feature = "rank")]
use polars_core::utils::coalesce_nulls_series;

#[cfg(feature = "list")]
use polars_ops::prelude::ListNameSpaceImpl;
use rayon::prelude::*;
Expand Down Expand Up @@ -184,7 +187,10 @@ pub fn spearman_rank_corr(a: Expr, b: Expr, ddof: u8) -> Expr {
let b = b.idx().unwrap();

let name = "spearman_rank_correlation";
Ok(Series::new(name, &[pearson_corr_i(a, b, ddof)]))
Ok(Series::new(
name,
&[polars_core::functions::pearson_corr_i(a, b, ddof)],
))
};

apply_binary(a, b, function, GetOutput::from_type(DataType::Float64)).with_function_options(
Expand Down
2 changes: 2 additions & 0 deletions polars/polars-lazy/src/dsl/list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#[cfg(feature = "list_eval")]
use crate::dsl::eval::prepare_eval_expr;

use crate::dsl::function_expr::FunctionExpr;
use crate::physical_plan::state::ExecutionState;
use crate::prelude::*;
Expand Down
3 changes: 3 additions & 0 deletions polars/polars-lazy/src/dsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ mod options;
pub mod string;
#[cfg(feature = "dtype-struct")]
mod struct_;

#[cfg(feature = "rolling_window")]
use polars_time::series::SeriesOpsTime;

use crate::prelude::*;
Expand Down Expand Up @@ -1564,6 +1566,7 @@ impl Expr {
.with_fmt("interpolate")
}

#[cfg(feature = "rolling_window")]
#[allow(clippy::type_complexity)]
fn finish_rolling(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,14 @@ fn early_escape(type_self: &DataType, type_other: &DataType) -> Option<()> {
}

#[cfg(test)]
#[cfg(feature = "dtype-categorical")]
mod test {
use crate::logical_plan::optimizer::stack_opt::OptimizationRule;
use crate::prelude::*;
use crate::utils::test::optimize_expr;
use polars_core::prelude::*;

#[test]
#[cfg(feature = "dtype-categorical")]
fn test_categorical_utf8() {
let mut rules: Vec<Box<dyn OptimizationRule>> = vec![Box::new(TypeCoercionRule {})];
let schema = Schema::from(vec![Field::new("fruits", DataType::Categorical(None))]);
Expand Down
4 changes: 3 additions & 1 deletion polars/polars-lazy/src/physical_plan/expressions/window.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::logical_plan::Context;
use crate::physical_plan::state::ExecutionState;
use crate::prelude::*;
use polars_arrow::export::arrow::Either;

use polars_core::frame::groupby::{GroupBy, GroupsProxy};
use polars_core::frame::hash_join::{
default_join_ids, private_left_join_multiple_keys, JoinOptIds,
Expand Down Expand Up @@ -513,6 +513,8 @@ impl PhysicalExpr for WindowExpr {
fn materialize_column(join_opt_ids: &JoinOptIds, out_column: &Series) -> Series {
#[cfg(feature = "chunked_ids")]
{
use polars_arrow::export::arrow::Either;

match join_opt_ids {
Either::Left(ids) => unsafe {
out_column.take_opt_iter_unchecked(
Expand Down
4 changes: 2 additions & 2 deletions polars/polars-lazy/src/tests/tpch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ fn partsupp() -> LazyFrame {

#[test]
fn test_q2() -> Result<()> {
let q1 = (part()
let q1 = part()
.inner_join(partsupp(), "p_partkey", "ps_partkey")
.inner_join(supplier(), "ps_suppkey", "s_suppkey")
.inner_join(nation(), "s_nationkey", "n_nationkey")
.inner_join(region(), "n_regionkey", "r_regionkey")
.filter(col("p_size").eq(15))
.filter(col("p_type").str().ends_with("BRASS")));
.filter(col("p_type").str().ends_with("BRASS"));

let q = q1
.clone()
Expand Down
1 change: 1 addition & 0 deletions polars/polars-ops/src/series/implementations/time.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::*;
#[cfg(feature = "to_dummies")]
use std::ops::Deref;

impl SeriesOps for Wrap<TimeChunked> {
Expand Down
2 changes: 1 addition & 1 deletion polars/tests/it/lazy/expressions/expand.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use polars::export::chrono::{NaiveDate, NaiveDateTime};
use polars::export::chrono::NaiveDate;

#[test]
fn test_expand_datetimes_3042() -> Result<()> {
Expand Down

0 comments on commit 643189d

Please sign in to comment.