Skip to content

Conversation

@nealrichardson
Copy link
Member

Based on ARROW-10322

@github-actions
Copy link

@nealrichardson nealrichardson marked this pull request as ready for review December 29, 2020 18:34

expect_dplyr_equal(
input %>%
filter(dbl %/% 2 > 3) %>%
Copy link
Member Author

Choose a reason for hiding this comment

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

All these test are with dbl; should we add some with int or other columns? Or do you think the other types are better tested elsewhere (test-compute-arith.R) and this is really just testing the dplyr NSE?

r/R/expression.R Outdated
return(out)
}

# hack to use subtract instead of subtract_checked for timestamps
Copy link
Member Author

Choose a reason for hiding this comment

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

Why only subtract?

And technically this could also be else if from above

b <- Scalar$create(Sys.time())
result <- a - b
expect_is(result$type, "DataType")
expect_identical(result$type$ToString(), "duration[us]")
Copy link
Member Author

Choose a reason for hiding this comment

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

(1) I don't think this is right. timestamp + integer = timestamp, but because integer is cast to timestamp, you get duration.
(1b) Maybe you could support that by casting the integer to duration (same units as the timestamp), but this is a bunch of stuff that should probably get handled in C++
(2) According to https://arrow.apache.org/docs/r/articles/arrow.html#arrow-to-r, we don't support converting duration types to R.

Given this, I think arithmetic with dates/times/timestamps should be punted to its own JIRA.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I've made ARROW-11090 — I'm honestly not sure these tests are even worth keeping + skipping with that since we will almost certainly make better support for durations (and other time-related types that don't have as much support) arrow > R at that point.

@nealrichardson
Copy link
Member Author

Rebase wasn't clean so I opened #9117 with the commits cherry-picked.

nealrichardson added a commit that referenced this pull request Jan 7, 2021
Replaces #8947

@jonkeane

Closes #9117 from nealrichardson/arith2

Lead-authored-by: Jonathan Keane <jkeane@gmail.com>
Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com>
Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
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