thisisnic commented on code in PR #35039:
URL: https://github.com/apache/arrow/pull/35039#discussion_r1162967939


##########
r/tests/testthat/test-Table.R:
##########
@@ -711,3 +711,20 @@ test_that("as_arrow_table() errors on data.frame with NULL 
names", {
   names(df) <- NULL
   expect_error(as_arrow_table(df), "Input data frame columns must be named")
 })
+
+test_that("we only preserve metadata of input to arrow_table when passed a 
single data.frame", {
+  # data.frame in, data.frame out
+  df <- data.frame(x = 1)
+  out1 <- as.data.frame(arrow_table(df))
+  expect_s3_class(out1, "data.frame", exact = TRUE)
+
+  # tibble in, tibble out
+  tib <- tibble::tibble(x = 1)
+  out2 <- as.data.frame(arrow_table(tib))
+  expect_s3_class(out2, c("tbl_df", "tbl", "data.frame"), exact = TRUE)
+
+  # GH-35038 - passing in multiple arguments doesn't affect return type
+  out3 <- as.data.frame(arrow::arrow_table(df, name = "1"))
+  out4 <- as.data.frame(arrow::arrow_table(name = "1", df))

Review Comment:
   Yeah, that's more explicit, done.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to