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/01/07 07:50:18 UTC
[GitHub] [arrow] AlenkaF opened a new pull request #12097: ARROW-14590: [R] Implement lubridate::week
AlenkaF opened a new pull request #12097:
URL: https://github.com/apache/arrow/pull/12097
This PR adds the implementation of `lubridate::week` following the way it is calculated in [lubridate](https://github.com/tidyverse/lubridate/blob/9cece5680d0280c5cd1ccdbc9309ccb4724b3a34/R/accessors-week.r#L26-L27).
--
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] AlenkaF commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
AlenkaF commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r781103385
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
After talking to Rok I am confident it is better to match this PR with "yday" then "week" as `lubirdate::week` is not connected with calander week at all but is a calculation of "complete seven day periods", [see here](https://lubridate.tidyverse.org/reference/week.html). And[ see Arrow C++ week description](https://arrow.apache.org/docs/cpp/compute.html#temporal-component-extraction) for comparison.
As for the PyArrow side, the logic behind [`pc.week()`](https://arrow.apache.org/docs/python/generated/pyarrow.compute.week.html#pyarrow.compute.week) is in line with the week compute function and Pandas [`dt.week`](https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.week.html).
What I will try to do is to use a divide C++ function instead of %%.
--
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] thisisnic commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780125202
##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -382,6 +382,15 @@ test_that("extract epiweek from timestamp", {
)
})
+test_that("extract week from timestamp", {
Review comment:
This looks good! Would you mind also adding a test for "extract week from date"?
--
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] rok commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
rok commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r781176982
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
Apparently we had [this discussion](https://github.com/apache/arrow/pull/11026/files#r703012684) before. Sorry I forgot about it.
--
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] AlenkaF commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
AlenkaF commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780134565
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I initially used "week" with `first_week_is_fully_in_year=True` but it didn't match and I didn't want to manually adjust that as I feel it uses a different logic than `lubridate::week`. What do you think?
--
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] thisisnic commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780126775
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
This approach makes sense, although I think there might be a C++ compute function which can do this instead of calculating it manually.
--
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] thisisnic commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r783088569
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
@rok and @AlenkaF Basically, when we're using mathematical operators[1], because `Ops.Expression` has been defined, it means that these are automagically turned into expressions:
https://github.com/apache/arrow/blob/9359026bad4a626de3699e023f96f0c1383d7032/r/R/expression.R#L260-L266
So the rule of thumb would be to wrap them when they're not operators, otherwise just use them as normal.
[1] https://stat.ethz.ch/R-manual/R-devel/library/base/html/groupGeneric.html
--
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] dragosmg commented on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
dragosmg commented on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1011070835
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
[GitHub] [arrow] rok commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
rok commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780237616
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I think `lubridate::week` should match `WeekOptions::USDefaults()`. [See here](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/api_scalar.h#L421-L425).
If needed we cal always adjust the [week compute function](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc#L413-L478) to also match lubridate.
--
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] rok commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
rok commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780237616
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I think `lubridate::week` should match `WeekOptions::USDefaults()`. [See here](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/api_scalar.h#L421-L425).
If needed we cal always adjust the [week compute function](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc#L413-L478) to also match lubridate.
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I think `lubridate::week` should match `WeekOptions::USDefaults()`. [See here](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/api_scalar.h#L421-L425).
If needed we can always adjust the [week compute function](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc#L413-L478) to also match lubridate.
--
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] jonkeane commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
jonkeane commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r783470625
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
> After talking to Rok I am confident it is better to match this PR with "yday" then "week" as lubirdate::week is not connected with calander week at all but is a calculation of "complete seven day periods", see here. And see Arrow C++ week description for comparison.
I also had this concern, but indeed like Alenka says _this_ week is literally 7-day periods from January 1. It's almost too deceptively simple compared to ... every other week circumstance 😂 , but that's definitely what it is! Here's the source too: https://github.com/tidyverse/lubridate/blob/7f5323b295813812bf52ffafb1fe26ac8bec95dd/R/accessors-week.r#L27
--
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] ursabot edited a comment on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1011490798
Benchmark runs are scheduled for baseline = b582af1771a84ae3a13438cf721f5c13c3bcff2a and contender = d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7. d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/1a09b808f25d416e94ddd5009ffc170c...323839ae746b49838bee1b8f75dc5b92/)
[Scheduled] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/7a14661cf6c94196bfefbc2b1a6170f8...3a843011b53b40d0a4c963d536cfcf55/)
[Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/21e22f7d4a934bb6a7f44d7bb86b4b3b...c37b302b0a90416a94c05fbc1f9d31d7/)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
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
[GitHub] [arrow] thisisnic commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780125202
##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -382,6 +382,15 @@ test_that("extract epiweek from timestamp", {
)
})
+test_that("extract week from timestamp", {
Review comment:
This looks good! Would you mind also adding a test for "extract week from date"?
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
This approach makes sense, although I think there might be a C++ compute function which can do this instead of calculating it manually.
--
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] github-actions[bot] commented on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1007206380
--
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] ursabot commented on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
ursabot commented on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1011490798
Benchmark runs are scheduled for baseline = b582af1771a84ae3a13438cf721f5c13c3bcff2a and contender = d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7. d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Scheduled] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/1a09b808f25d416e94ddd5009ffc170c...323839ae746b49838bee1b8f75dc5b92/)
[Scheduled] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/7a14661cf6c94196bfefbc2b1a6170f8...3a843011b53b40d0a4c963d536cfcf55/)
[Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/21e22f7d4a934bb6a7f44d7bb86b4b3b...c37b302b0a90416a94c05fbc1f9d31d7/)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
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
[GitHub] [arrow] github-actions[bot] commented on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1007206380
--
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] thisisnic commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
thisisnic commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r781188884
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
Sounds good @AlenkaF but you I think you should be fine writing things as they were before without wrapping in multiple `call_binding()` functions as the code already converts it into the correct expressions.
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
Sounds good @AlenkaF but I think you should be fine writing things as they were before without wrapping in multiple `call_binding()` functions as the code already converts it into the correct expressions.
--
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] jonkeane closed pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
jonkeane closed pull request #12097:
URL: https://github.com/apache/arrow/pull/12097
--
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] ursabot edited a comment on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1011490798
Benchmark runs are scheduled for baseline = b582af1771a84ae3a13438cf721f5c13c3bcff2a and contender = d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7. d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/1a09b808f25d416e94ddd5009ffc170c...323839ae746b49838bee1b8f75dc5b92/)
[Failed :arrow_down:0.45% :arrow_up:0.45%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/7a14661cf6c94196bfefbc2b1a6170f8...3a843011b53b40d0a4c963d536cfcf55/)
[Scheduled] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/21e22f7d4a934bb6a7f44d7bb86b4b3b...c37b302b0a90416a94c05fbc1f9d31d7/)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
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
[GitHub] [arrow] ursabot edited a comment on pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
ursabot edited a comment on pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#issuecomment-1011490798
Benchmark runs are scheduled for baseline = b582af1771a84ae3a13438cf721f5c13c3bcff2a and contender = d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7. d1fb8e70d4a7f49bcb21ca1ce5c8127a45d1c4f7 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/1a09b808f25d416e94ddd5009ffc170c...323839ae746b49838bee1b8f75dc5b92/)
[Failed :arrow_down:0.45% :arrow_up:0.45%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/7a14661cf6c94196bfefbc2b1a6170f8...3a843011b53b40d0a4c963d536cfcf55/)
[Failed :arrow_down:0.31% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/21e22f7d4a934bb6a7f44d7bb86b4b3b...c37b302b0a90416a94c05fbc1f9d31d7/)
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
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
[GitHub] [arrow] rok commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
rok commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r781236541
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
Sounds good!
Out of curiosity - is there a rule of thumb what to do in such cases? When do you go for multiple calls vs when do you just do it in R?
--
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] AlenkaF commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
AlenkaF commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780134565
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I initially used "week" with `first_week_is_fully_in_year=True` but it didn't match and I didn't want to manually adjust that as I feel it uses a different logic than `lubridate::week`. What do you think?
--
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] rok commented on a change in pull request #12097: ARROW-14590: [R] Implement lubridate::week
Posted by GitBox <gi...@apache.org>.
rok commented on a change in pull request #12097:
URL: https://github.com/apache/arrow/pull/12097#discussion_r780237616
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -101,6 +101,10 @@ register_bindings_datetime <- function() {
Expression$create("day_of_week", x, options = list(count_from_zero = FALSE, week_start = week_start))
})
+ register_binding("week", function(x) {
+ (call_binding("yday", x) - 1) %/% 7 + 1
+ })
+
Review comment:
I think `lubridate::week` should match `WeekOptions::USDefaults()`. [See here](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/api_scalar.h#L421-L425).
If needed we can always adjust the [week compute function](https://github.com/apache/arrow/blob/master/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc#L413-L478) to also match lubridate.
--
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