From a8ab26d18d07219c26c69d5fdb646496bafa059c Mon Sep 17 00:00:00 2001 From: VasanthakumarV Date: Sat, 25 Sep 2021 21:48:48 +0530 Subject: [PATCH] Specify range of output values possible for each extractor --- src/compute/temporal.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compute/temporal.rs b/src/compute/temporal.rs index c0d749a3401..6ed750b65fc 100644 --- a/src/compute/temporal.rs +++ b/src/compute/temporal.rs @@ -83,26 +83,28 @@ pub fn year(array: &dyn Array) -> Result> { } /// Extracts the months of a temporal array as [`PrimitiveArray`]. +/// Value ranges from 1 to 12. /// Use [`can_month`] to check if this operation is supported for the target [`DataType`]. pub fn month(array: &dyn Array) -> Result> { date_like!(month, array, DataType::UInt32) } /// Extracts the days of a temporal array as [`PrimitiveArray`]. +/// Value ranges from 1 to 32 (Last day depends on month). /// Use [`can_day`] to check if this operation is supported for the target [`DataType`]. pub fn day(array: &dyn Array) -> Result> { date_like!(day, array, DataType::UInt32) } /// Extracts weekday of a temporal array as [`PrimitiveArray`]. -/// Monday is 1, Tuesday is 2, ... Sunday is 7 +/// Monday is 1, Tuesday is 2, ..., Sunday is 7. /// Use [`can_weekday`] to check if this operation is supported for the target [`DataType`] pub fn weekday(array: &dyn Array) -> Result> { date_like!(u32_weekday, array, DataType::UInt32) } /// Extracts ISO week of a temporal array as [`PrimitiveArray`] -/// Value ranges from 1 to 53. +/// Value ranges from 1 to 53 (Last week depends on the year). /// Use [`can_iso_week`] to check if this operation is supported for the target [`DataType`] pub fn iso_week(array: &dyn Array) -> Result> { date_like!(u32_iso_week, array, DataType::UInt32) @@ -138,18 +140,21 @@ macro_rules! time_like { } /// Extracts the hours of a temporal array as [`PrimitiveArray`]. +/// Value ranges from 0 to 23. /// Use [`can_hour`] to check if this operation is supported for the target [`DataType`]. pub fn hour(array: &dyn Array) -> Result> { time_like!(hour, array, DataType::UInt32) } /// Extracts the minutes of a temporal array as [`PrimitiveArray`]. +/// Value ranges from 0 to 59. /// Use [`can_minute`] to check if this operation is supported for the target [`DataType`]. pub fn minute(array: &dyn Array) -> Result> { time_like!(minute, array, DataType::UInt32) } /// Extracts the seconds of a temporal array as [`PrimitiveArray`]. +/// Value ranges from 0 to 59. /// Use [`can_second`] to check if this operation is supported for the target [`DataType`]. pub fn second(array: &dyn Array) -> Result> { time_like!(second, array, DataType::UInt32)