sdf-jkl commented on code in PR #9345:
URL: https://github.com/apache/arrow-rs/pull/9345#discussion_r2765835389
##########
arrow-array/src/types.rs:
##########
@@ -325,6 +325,30 @@ pub trait ArrowTimestampType: ArrowTemporalType<Native =
i64> {
///
/// See [`DataType::Timestamp`] for more information on timezone handling
fn make_value(naive: NaiveDateTime) -> Option<i64>;
+
+ /// Creates a timestamp value from a [`DateTime`] in any timezone.
+ ///
+ /// # Arguments
+ ///
+ /// * `datetime` - The datetime to convert
+ fn from_datetime<Tz: TimeZone>(datetime: DateTime<Tz>) -> i64;
+
+ /// Creates a timestamp value from a [`NaiveDateTime`] interpreted in the
given timezone.
+ ///
+ /// # Arguments
+ ///
+ /// * `naive` - The local datetime to convert
+ /// * `tz` - Optional timezone. If `None`, interprets as UTC.
+ fn from_naive_datetime(naive: NaiveDateTime, tz: Option<&Tz>) ->
Option<i64> {
+ match tz {
+ Some(tz) => match tz.from_local_datetime(&naive) {
Review Comment:
Maybe add tests for different `LocalResult` - `Ambiguous` or `None`
timezones?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]