thisisnic commented on a change in pull request #10269:
URL: https://github.com/apache/arrow/pull/10269#discussion_r635433846
##########
File path: r/tests/testthat/test-RecordBatch.R
##########
@@ -415,14 +414,42 @@ test_that("record_batch() handles null type
(ARROW-7064)", {
expect_equivalent(batch$schema, schema(a = int32(), n = null()))
})
-test_that("record_batch() scalar recycling", {
- skip("Not implemented (ARROW-11705)")
+test_that("record_batch() scalar recycling with vectors", {
expect_data_frame(
record_batch(a = 1:10, b = 5),
tibble::tibble(a = 1:10, b = 5)
)
})
+test_that("record_batch() scalar recycling with Scalars, Arrays, and
ChunkedArrays", {
+
+ expect_data_frame(
+ record_batch(a = Array$create(1:10), b = Scalar$create(5)),
+ tibble::tibble(a = 1:10, b = 5)
+ )
+
+ expect_data_frame(
+ record_batch(a = Array$create(1:10), b = Array$create(5)),
+ tibble::tibble(a = 1:10, b = 5)
+ )
+
+ expect_data_frame(
+ record_batch(a = Array$create(1:10), b = ChunkedArray$create(5)),
+ tibble::tibble(a = 1:10, b = 5)
+ )
+
+})
+
+test_that("record_batch() no recycling with tibbles", {
Review comment:
@nealrichardson I've now updated this so that the code uses either
`length` or `nrow` depending on whether the argument is something that inherits
from a `data.frame` or not.
I got stuck trying to recycle tibbles as I couldn't think how to do it in a
reasonable way with the packages we import.
Do you think there is one? If not, I'm tempted to say it's out of the scope
of this ticket anyway.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]