You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "codephage2020 (via GitHub)" <gi...@apache.org> on 2026/02/28 02:38:19 UTC

[PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

codephage2020 opened a new pull request, #9491:
URL: https://github.com/apache/arrow-rs/pull/9491

   Mark ArrowTimestampType::make_value as deprecated and migrate internal callers to the newer from_naive_datetime API.
   
   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
   -->
   
   - Closes #9490 .
   
   # Rationale for this change
   
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   Follow-up from PR #9345.
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   Mark ArrowTimestampType::make_value as deprecated and migrate internal callers to the newer from_naive_datetime API.
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   YES.
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   
   If there are any breaking changes to public APIs, please call them out.
   -->
   
   Migration Path: Users should replace:
   
   ```rust
   // Old
   TimestampSecondType::make_value(naive)
   ```
   With:
   
   ```rust
   // New
   TimestampSecondType::from_naive_datetime(naive, None)
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-4040836395

   Thanks for driving this along @scovich  🙏 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "scovich (via GitHub)" <gi...@apache.org>.
scovich commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3986723358

   Looks great. Taking @alamb approval without adding `next-major-release` label as sufficient to merge this now.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3981536383

   > This piece of doc needs an update as well: https://arrow.apache.org/rust/arrow/datatypes/trait.ArrowTimestampType.html#method.from_naive_datetime
   
   The docs will auto-generate on release. Any thoughts on the current code comments?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "scovich (via GitHub)" <gi...@apache.org>.
scovich commented on code in PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#discussion_r2867946603


##########
arrow-array/src/types.rs:
##########
@@ -350,14 +351,15 @@ pub trait ArrowTimestampType: ArrowTemporalType<Native = i64> {
                 chrono::offset::LocalResult::Ambiguous(dt1, _) => Self::from_datetime(dt1),
                 chrono::offset::LocalResult::None => None,
             },
-            None => Self::make_value(naive),
+            None => Self::from_datetime(naive.and_utc()),
         }
     }
 }
 
 impl ArrowTimestampType for TimestampSecondType {
     const UNIT: TimeUnit = TimeUnit::Second;
 
+    #[allow(deprecated)]

Review Comment:
   aside: a bit weird that you have to allow implementing a required trait method?



##########
arrow-array/src/types.rs:
##########
@@ -324,6 +324,7 @@ pub trait ArrowTimestampType: ArrowTemporalType<Native = i64> {
     /// Creates a ArrowTimestampType::Native from the provided [`NaiveDateTime`]
     ///
     /// See [`DataType::Timestamp`] for more information on timezone handling
+    #[deprecated(since = "59.0.0", note = "Use from_naive_datetime instead")]

Review Comment:
   Will there not be any 58.x minor releases? Or is does PR need `next-major-release` label?



##########
arrow-array/src/types.rs:
##########
@@ -417,7 +422,7 @@ fn add_year_months<T: ArrowTimestampType>(
     let res = as_datetime_with_timezone::<T>(timestamp, tz)?;
     let res = add_months_datetime(res, months)?;
     let res = res.naive_utc();
-    T::make_value(res)
+    T::from_naive_datetime(res, None)

Review Comment:
   nit: single-use val considered annoying when it doesn't help save space...
   ```rust
   T::from_naive_datetime(res.naive_utc(), None)
   ```
   (several more below, if you choose to change this)



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "sdf-jkl (via GitHub)" <gi...@apache.org>.
sdf-jkl commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3977297029

   Thanks for looping me in, LGTM!


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3976450093

   CC @alamb @sdf-jkl 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "brunal (via GitHub)" <gi...@apache.org>.
brunal commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3976608602

   This piece of doc needs an update as well: https://arrow.apache.org/rust/arrow/datatypes/trait.ArrowTimestampType.html#method.from_naive_datetime


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "scovich (via GitHub)" <gi...@apache.org>.
scovich merged PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on code in PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#discussion_r2870096207


##########
arrow-array/src/types.rs:
##########
@@ -417,7 +422,7 @@ fn add_year_months<T: ArrowTimestampType>(
     let res = as_datetime_with_timezone::<T>(timestamp, tz)?;
     let res = add_months_datetime(res, months)?;
     let res = res.naive_utc();
-    T::make_value(res)
+    T::from_naive_datetime(res, None)

Review Comment:
   Done.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on code in PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#discussion_r2870129691


##########
arrow-array/src/types.rs:
##########
@@ -350,14 +351,15 @@ pub trait ArrowTimestampType: ArrowTemporalType<Native = i64> {
                 chrono::offset::LocalResult::Ambiguous(dt1, _) => Self::from_datetime(dt1),
                 chrono::offset::LocalResult::None => None,
             },
-            None => Self::make_value(naive),
+            None => Self::from_datetime(naive.and_utc()),
         }
     }
 }
 
 impl ArrowTimestampType for TimestampSecondType {
     const UNIT: TimeUnit = TimeUnit::Second;
 
+    #[allow(deprecated)]

Review Comment:
   Upon closer inspection, the attribute is redundant. I've removed all `#[allow(deprecated)]` annotations.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#issuecomment-3981593411

   All feedback has been addressed.thanks @scovich.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on code in PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#discussion_r2870097235


##########
arrow-array/src/types.rs:
##########
@@ -324,6 +324,7 @@ pub trait ArrowTimestampType: ArrowTemporalType<Native = i64> {
     /// Creates a ArrowTimestampType::Native from the provided [`NaiveDateTime`]
     ///
     /// See [`DataType::Timestamp`] for more information on timezone handling
+    #[deprecated(since = "59.0.0", note = "Use from_naive_datetime instead")]

Review Comment:
    Good catch! the next release will be 58.1.0.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Deprecate ArrowTimestampType::make_value in favor of from_naive_datetime [arrow-rs]

Posted by "codephage2020 (via GitHub)" <gi...@apache.org>.
codephage2020 commented on code in PR #9491:
URL: https://github.com/apache/arrow-rs/pull/9491#discussion_r2870096207


##########
arrow-array/src/types.rs:
##########
@@ -417,7 +422,7 @@ fn add_year_months<T: ArrowTimestampType>(
     let res = as_datetime_with_timezone::<T>(timestamp, tz)?;
     let res = add_months_datetime(res, months)?;
     let res = res.naive_utc();
-    T::make_value(res)
+    T::from_naive_datetime(res, None)

Review Comment:
   Agreed. This can be addressed in a follow-up PR.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org