From 1fbe6f14cfb9f396279e7b8341733c73914415c8 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Wed, 26 Feb 2025 10:36:35 +0000 Subject: [PATCH 1/2] Fix chrono build --- arrow-arith/src/temporal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arrow-arith/src/temporal.rs b/arrow-arith/src/temporal.rs index 7af743018c39..2094e8b41936 100644 --- a/arrow-arith/src/temporal.rs +++ b/arrow-arith/src/temporal.rs @@ -93,7 +93,7 @@ where T: ChronoDateExt + Datelike + Timelike, { match part { - DatePart::Quarter => |d| d.quarter() as i32, + DatePart::Quarter => |d| ChronoDateExt::quarter(&d) as i32, DatePart::Year => |d| d.year(), DatePart::YearISO => |d| d.iso_week().year(), DatePart::Month => |d| d.month() as i32, From 748b88c3e37dbcd81c545a1366d6d5d477ebd891 Mon Sep 17 00:00:00 2001 From: Raphael Taylor-Davies Date: Wed, 26 Feb 2025 10:40:30 +0000 Subject: [PATCH 2/2] Remove ChronoDateExt::quarter --- arrow-arith/src/temporal.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/arrow-arith/src/temporal.rs b/arrow-arith/src/temporal.rs index 2094e8b41936..a3fe7e8ad4a4 100644 --- a/arrow-arith/src/temporal.rs +++ b/arrow-arith/src/temporal.rs @@ -93,7 +93,7 @@ where T: ChronoDateExt + Datelike + Timelike, { match part { - DatePart::Quarter => |d| ChronoDateExt::quarter(&d) as i32, + DatePart::Quarter => |d| d.quarter() as i32, DatePart::Year => |d| d.year(), DatePart::YearISO => |d| d.iso_week().year(), DatePart::Month => |d| d.month() as i32, @@ -658,12 +658,6 @@ pub(crate) use return_compute_error_with; // Internal trait, which is used for mapping values from DateLike structures trait ChronoDateExt { - /// Returns a value in range `1..=4` indicating the quarter this date falls into - fn quarter(&self) -> u32; - - /// Returns a value in range `0..=3` indicating the quarter (zero-based) this date falls into - fn quarter0(&self) -> u32; - /// Returns the day of week; Monday is encoded as `0`, Tuesday as `1`, etc. fn num_days_from_monday(&self) -> i32; @@ -672,14 +666,6 @@ trait ChronoDateExt { } impl ChronoDateExt for T { - fn quarter(&self) -> u32 { - self.quarter0() + 1 - } - - fn quarter0(&self) -> u32 { - self.month0() / 3 - } - fn num_days_from_monday(&self) -> i32 { self.weekday().num_days_from_monday() as i32 }