Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samster25 committed Sep 26, 2024
1 parent ca5e1c7 commit 35a62b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
15 changes: 6 additions & 9 deletions src/daft-core/src/series/ops/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
ops::{Add, Div, Mul, Rem, Sub},
time::Duration,
};
use std::ops::{Add, Div, Mul, Rem, Sub};

use common_error::DaftResult;
use daft_schema::dtype::DataType;
Expand Down Expand Up @@ -86,26 +83,26 @@ impl Sub for &Series {
(DataType::Date, DataType::Duration(tu2)) => {
let days = rhs.duration()?.cast_to_days()?;
let physical_result = self.date()?.physical.sub(&days)?;
physical_result.cast(&output_type)
physical_result.cast(output_type)
}
(DataType::Date, DataType::Date) => {
let physical_result = self.date()?.physical.sub(&rhs.date()?.physical)?;
physical_result.cast(&output_type)
physical_result.cast(output_type)
}
(DataType::Duration(tu1), DataType::Duration(tu2)) => {
let physical_result =
lhs.duration()?.physical.sub(&rhs.duration()?.physical)?;
physical_result.cast(&output_type)
physical_result.cast(output_type)
}
(DataType::Timestamp(..), DataType::Duration(..)) => {
let physical_result =
self.timestamp()?.physical.sub(&rhs.duration()?.physical)?;
physical_result.cast(&output_type)
physical_result.cast(output_type)
}
(DataType::Timestamp(..), DataType::Timestamp(..)) => {
let physical_result =
self.timestamp()?.physical.sub(&rhs.timestamp()?.physical)?;
physical_result.cast(&output_type)
physical_result.cast(output_type)
}
_ => binary_op_unimplemented!(self, "-", rhs, output_type),
}
Expand Down
10 changes: 5 additions & 5 deletions src/daft-core/src/series/ops/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ macro_rules! binary_op_not_implemented {
}};
}

impl DaftLogical<&Series> for Series {
type Output = DaftResult<Series>;
impl DaftLogical<&Self> for Series {
type Output = DaftResult<Self>;

fn and(&self, rhs: &Series) -> Self::Output {
fn and(&self, rhs: &Self) -> Self::Output {
let lhs = self;
let output_type = InferDataType::from(lhs.data_type())
.logical_op(&InferDataType::from(rhs.data_type()))?;
Expand Down Expand Up @@ -55,7 +55,7 @@ impl DaftLogical<&Series> for Series {
}
}

fn or(&self, rhs: &Series) -> Self::Output {
fn or(&self, rhs: &Self) -> Self::Output {
let lhs = self;
let output_type = InferDataType::from(self.data_type())
.logical_op(&InferDataType::from(rhs.data_type()))?;
Expand Down Expand Up @@ -85,7 +85,7 @@ impl DaftLogical<&Series> for Series {
}
}

fn xor(&self, rhs: &Series) -> Self::Output {
fn xor(&self, rhs: &Self) -> Self::Output {
let lhs = self;
let output_type = InferDataType::from(self.data_type())
.logical_op(&InferDataType::from(rhs.data_type()))?;
Expand Down

0 comments on commit 35a62b0

Please sign in to comment.