You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/12 22:25:08 UTC

[GitHub] [arrow-rs] viirya opened a new pull request, #3096: Fix clippy by avoiding deprecated functions in chrono

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

   # 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. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #.
   
   # 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.
   -->
   
   # 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.
   -->
   
   # 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 add the `breaking change` label.
   -->
   


-- 
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


[GitHub] [arrow-rs] alamb commented on pull request #3096: Fix clippy by avoiding deprecated functions in chrono

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #3096:
URL: https://github.com/apache/arrow-rs/pull/3096#issuecomment-1312701343

   Thanks @viirya 


-- 
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


[GitHub] [arrow-rs] alamb commented on a diff in pull request #3096: Fix clippy by avoiding deprecated functions in chrono

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #3096:
URL: https://github.com/apache/arrow-rs/pull/3096#discussion_r1020881738


##########
arrow-array/src/delta.rs:
##########
@@ -105,75 +105,186 @@ mod tests {
 
     #[test]
     fn test_shift_months() {
-        let base = NaiveDate::from_ymd(2020, 1, 31);
-
-        assert_eq!(shift_months(base, 0), NaiveDate::from_ymd(2020, 1, 31));
-        assert_eq!(shift_months(base, 1), NaiveDate::from_ymd(2020, 2, 29));
-        assert_eq!(shift_months(base, 2), NaiveDate::from_ymd(2020, 3, 31));
-        assert_eq!(shift_months(base, 3), NaiveDate::from_ymd(2020, 4, 30));
-        assert_eq!(shift_months(base, 4), NaiveDate::from_ymd(2020, 5, 31));
-        assert_eq!(shift_months(base, 5), NaiveDate::from_ymd(2020, 6, 30));
-        assert_eq!(shift_months(base, 6), NaiveDate::from_ymd(2020, 7, 31));
-        assert_eq!(shift_months(base, 7), NaiveDate::from_ymd(2020, 8, 31));
-        assert_eq!(shift_months(base, 8), NaiveDate::from_ymd(2020, 9, 30));
-        assert_eq!(shift_months(base, 9), NaiveDate::from_ymd(2020, 10, 31));
-        assert_eq!(shift_months(base, 10), NaiveDate::from_ymd(2020, 11, 30));
-        assert_eq!(shift_months(base, 11), NaiveDate::from_ymd(2020, 12, 31));
-        assert_eq!(shift_months(base, 12), NaiveDate::from_ymd(2021, 1, 31));
-        assert_eq!(shift_months(base, 13), NaiveDate::from_ymd(2021, 2, 28));
-
-        assert_eq!(shift_months(base, -1), NaiveDate::from_ymd(2019, 12, 31));
-        assert_eq!(shift_months(base, -2), NaiveDate::from_ymd(2019, 11, 30));
-        assert_eq!(shift_months(base, -3), NaiveDate::from_ymd(2019, 10, 31));
-        assert_eq!(shift_months(base, -4), NaiveDate::from_ymd(2019, 9, 30));
-        assert_eq!(shift_months(base, -5), NaiveDate::from_ymd(2019, 8, 31));
-        assert_eq!(shift_months(base, -6), NaiveDate::from_ymd(2019, 7, 31));
-        assert_eq!(shift_months(base, -7), NaiveDate::from_ymd(2019, 6, 30));
-        assert_eq!(shift_months(base, -8), NaiveDate::from_ymd(2019, 5, 31));
-        assert_eq!(shift_months(base, -9), NaiveDate::from_ymd(2019, 4, 30));
-        assert_eq!(shift_months(base, -10), NaiveDate::from_ymd(2019, 3, 31));
-        assert_eq!(shift_months(base, -11), NaiveDate::from_ymd(2019, 2, 28));
-        assert_eq!(shift_months(base, -12), NaiveDate::from_ymd(2019, 1, 31));
-        assert_eq!(shift_months(base, -13), NaiveDate::from_ymd(2018, 12, 31));
-
-        assert_eq!(shift_months(base, 1265), NaiveDate::from_ymd(2125, 6, 30));
+        let base = NaiveDate::from_ymd_opt(2020, 1, 31).unwrap();
+
+        assert_eq!(
+            shift_months(base, 0),
+            NaiveDate::from_ymd_opt(2020, 1, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 1),
+            NaiveDate::from_ymd_opt(2020, 2, 29).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 2),
+            NaiveDate::from_ymd_opt(2020, 3, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 3),
+            NaiveDate::from_ymd_opt(2020, 4, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 4),
+            NaiveDate::from_ymd_opt(2020, 5, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 5),
+            NaiveDate::from_ymd_opt(2020, 6, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 6),
+            NaiveDate::from_ymd_opt(2020, 7, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 7),
+            NaiveDate::from_ymd_opt(2020, 8, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 8),
+            NaiveDate::from_ymd_opt(2020, 9, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 9),
+            NaiveDate::from_ymd_opt(2020, 10, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 10),
+            NaiveDate::from_ymd_opt(2020, 11, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 11),
+            NaiveDate::from_ymd_opt(2020, 12, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 12),
+            NaiveDate::from_ymd_opt(2021, 1, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, 13),
+            NaiveDate::from_ymd_opt(2021, 2, 28).unwrap()
+        );
+
+        assert_eq!(
+            shift_months(base, -1),
+            NaiveDate::from_ymd_opt(2019, 12, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -2),
+            NaiveDate::from_ymd_opt(2019, 11, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -3),
+            NaiveDate::from_ymd_opt(2019, 10, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -4),
+            NaiveDate::from_ymd_opt(2019, 9, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -5),
+            NaiveDate::from_ymd_opt(2019, 8, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -6),
+            NaiveDate::from_ymd_opt(2019, 7, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -7),
+            NaiveDate::from_ymd_opt(2019, 6, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -8),
+            NaiveDate::from_ymd_opt(2019, 5, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -9),
+            NaiveDate::from_ymd_opt(2019, 4, 30).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -10),
+            NaiveDate::from_ymd_opt(2019, 3, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -11),
+            NaiveDate::from_ymd_opt(2019, 2, 28).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -12),
+            NaiveDate::from_ymd_opt(2019, 1, 31).unwrap()
+        );
+        assert_eq!(
+            shift_months(base, -13),
+            NaiveDate::from_ymd_opt(2018, 12, 31).unwrap()
+        );
+
+        assert_eq!(
+            shift_months(base, 1265),
+            NaiveDate::from_ymd_opt(2125, 6, 30).unwrap()
+        );
     }
 
     #[test]
     fn test_shift_months_with_overflow() {
-        let base = NaiveDate::from_ymd(2020, 12, 31);
+        let base = NaiveDate::from_ymd_opt(2020, 12, 31).unwrap();
 
         assert_eq!(shift_months(base, 0), base);
-        assert_eq!(shift_months(base, 1), NaiveDate::from_ymd(2021, 1, 31));

Review Comment:
   🤔  this feels very familiar / similar to the work in https://github.com/apache/arrow-datafusion/pull/4189/files#diff-880863b84a09b210db1fc00012b1f3fbf0ade7f23c4297e15b54474ec65cb814R107
   
   I'll see if I can find a way to remove the copy in DataFusion



-- 
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


[GitHub] [arrow-rs] viirya commented on pull request #3096: Fix clippy by avoiding deprecated functions in chrono

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #3096:
URL: https://github.com/apache/arrow-rs/pull/3096#issuecomment-1312611700

   cc @tustvold @alamb


-- 
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


[GitHub] [arrow-rs] tustvold merged pull request #3096: Fix clippy by avoiding deprecated functions in chrono

Posted by GitBox <gi...@apache.org>.
tustvold merged PR #3096:
URL: https://github.com/apache/arrow-rs/pull/3096


-- 
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


[GitHub] [arrow-rs] ursabot commented on pull request #3096: Fix clippy by avoiding deprecated functions in chrono

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3096:
URL: https://github.com/apache/arrow-rs/pull/3096#issuecomment-1312645830

   Benchmark runs are scheduled for baseline = 94565bca99b5d9932a3e9a8e094aaf4e4384b1e5 and contender = ccc44170acadf1efb01b3a536ad48ae03328b3f1. ccc44170acadf1efb01b3a536ad48ae03328b3f1 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/db34e19dda294c9697248ec72a523ad7...32e2b45002204c0dabe780b62294a7b5/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/20ce32d36f784852be4ab249b82633c2...3c4efc073d3345969cc756b56295c44c/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/bbad9f23e1614efab118fda36ecc02f7...70c3502260834d4b94eb2f0cea274b2d/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/b2c991e330774b059a49fa175ea97c45...193bcd53c066435984ddc456a0fea35f/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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