Skip to content

Conversation

@dragosmg
Copy link
Contributor

Once this PR is merged the following code snippet will be valid

suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(arrow))

df <- tibble(
  dates = as.Date(c("2021-04-30", "2021-07-31", "2021-10-31", "2021-01-31"))
  )
df %>% 
  record_batch() %>% 
  mutate(
    semester_without_year = semester(dates),
    semester_with_year = semester(dates, with_year = TRUE)) %>% 
  collect()
#> # A tibble: 4 × 3
#>   dates      semester_without_year semester_with_year
#>   <date>                     <int>              <dbl>
#> 1 2021-04-30                     1              2021.1
#> 2 2021-07-31                     2              2021.2
#> 3 2021-10-31                     2              2021.2
#> 4 2021-01-31                     1              2021.1

and identical with the lubridate result:

suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))

df <- tibble(
  dates = as.Date(c("2021-04-30", "2021-07-31", "2021-10-31", "2021-01-31"))
  )
df %>% 
  mutate(
    semester_without_year = semester(dates),
    semester_with_year = semester(dates, with_year = TRUE))
#> # A tibble: 4 × 3
#>   dates      semester_without_year semester_with_year
#>   <date>                     <int>              <dbl>
#> 1 2021-04-30                     1              2021.1
#> 2 2021-07-31                     2              2021.2
#> 3 2021-10-31                     2              2021.2
#> 4 2021-01-31                     1              2021.1

Created on 2022-02-15 by the reprex package (v2.0.1)

@dragosmg dragosmg marked this pull request as ready for review February 15, 2022 11:16
@github-actions
Copy link

@github-actions
Copy link

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, thanks!

One comment (TIL about the return value of lubridate::semseter()!), and a request for some more testing on various kinds of (bad) inputs

@dragosmg
Copy link
Contributor Author

Not sure if we should (and if yes, at what level) support integer / numeric arguments to month(). If the answer is yes, I feel that should not happen only inside / for semester. lubridate::month() has dual purpose - it can be used both to get and set months. arrow currently supports only extraction and, therefore, the input type needs to be temporal.

Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting closer — a few small changes.

It's up to you if you want to sweep the r-based month() improvements in to this ticket or do those improvements + the changes you'll need to these tests later as a separate ticket soon after, but we should do those sooner rather than later.

@dragosmg dragosmg requested a review from jonkeane February 17, 2022 16:30
Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pulling in some of the month changes, that's looking like it's headed in the right direction.

I've got a few comments + a few requests for a few more tests. Also a longer point (which you might already be totally aware of!) about how we might test bindings like this where the underlying data changes has an impact on what we need to do.

@dragosmg dragosmg requested a review from jonkeane February 21, 2022 16:22
Copy link
Member

@jonkeane jonkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for what we can do before we expand month() could you resolve the conflicts and then I'll merge?

@jonkeane jonkeane closed this in 16f36a5 Feb 22, 2022
@ursabot
Copy link

ursabot commented Feb 22, 2022

Benchmark runs are scheduled for baseline = 5680d20 and contender = 16f36a5. 16f36a5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.46% ⬆️0.04%] test-mac-arm
[Failed ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.34% ⬆️0.04%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. 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

@dragosmg dragosmg deleted the lubridate_semester branch February 23, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants