This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 6ec7226cd Minor: Add some examples to Date*Array and Time*Array (#3678)
6ec7226cd is described below
commit 6ec7226cdcafa9326d7f11a3e421e1e1038ca677
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Feb 9 14:24:32 2023 +0100
Minor: Add some examples to Date*Array and Time*Array (#3678)
* Minor: Add some examples to Date*Array and Time*Array
* Apply suggestions from code review
Co-authored-by: Liang-Chi Hsieh <[email protected]>
* Update for NaiveDate
---------
Co-authored-by: Liang-Chi Hsieh <[email protected]>
---
arrow-array/src/array/primitive_array.rs | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/arrow-array/src/array/primitive_array.rs
b/arrow-array/src/array/primitive_array.rs
index 6902f1364..aeece612d 100644
--- a/arrow-array/src/array/primitive_array.rs
+++ b/arrow-array/src/array/primitive_array.rs
@@ -168,22 +168,42 @@ pub type TimestampNanosecondArray =
PrimitiveArray<TimestampNanosecondType>;
// TODO: give examples for the below types
-/// A primitive array where each element is of 32-bit date type.
+/// A primitive array where each element is of 32-bit value
+/// representing the elapsed time since UNIX epoch in days."
+///
+/// This type is similar to the [`chrono::NaiveDate`] type and can hold
+/// values such as `2018-11-13`
pub type Date32Array = PrimitiveArray<Date32Type>;
-/// A primitive array where each element is of 64-bit date type.
+/// A primitive array where each element is a 64-bit value
+/// representing the elapsed time since the UNIX epoch in milliseconds.
+///
+/// This type is similar to the [`chrono::NaiveDateTime`] type and can hold
+/// values such as `2018-11-13T17:11:10.011`
pub type Date64Array = PrimitiveArray<Date64Type>;
/// An array where each element is of 32-bit type representing time elapsed in
seconds
/// since midnight.
+///
+/// This type is similar to the [`chrono::NaiveTime`] type and can
+/// hold values such as `00:02:00`
pub type Time32SecondArray = PrimitiveArray<Time32SecondType>;
/// An array where each element is of 32-bit type representing time elapsed in
milliseconds
/// since midnight.
+///
+/// This type is similar to the [`chrono::NaiveTime`] type and can
+/// hold values such as `00:02:00.123`
pub type Time32MillisecondArray = PrimitiveArray<Time32MillisecondType>;
/// An array where each element is of 64-bit type representing time elapsed in
microseconds
/// since midnight.
+///
+/// This type is similar to the [`chrono::NaiveTime`] type and can
+/// hold values such as `00:02:00.123456`
pub type Time64MicrosecondArray = PrimitiveArray<Time64MicrosecondType>;
/// An array where each element is of 64-bit type representing time elapsed in
nanoseconds
/// since midnight.
+///
+/// This type is similar to the [`chrono::NaiveTime`] type and can
+/// hold values such as `00:02:00.123456789`
pub type Time64NanosecondArray = PrimitiveArray<Time64NanosecondType>;
/// An array where each element is a “calendar” interval in months.