jonkeane commented on a change in pull request #11032:
URL: https://github.com/apache/arrow/pull/11032#discussion_r727512895
##########
File path: r/tests/testthat/test-dataset.R
##########
@@ -672,3 +672,33 @@ test_that("Collecting zero columns from a dataset doesn't
return entire dataset"
c(32, 0)
)
})
+
+
+test_that("dataset RecordBatchReader to C-interface to arrow_dplyr_query", {
+ ds <- open_dataset(ipc_dir, partitioning = "part", format = "feather")
+
+ # export the RecordBatchReader via the C-interface
+ stream_ptr <- allocate_arrow_array_stream()
+ scan <- Scanner$create(ds)
+ reader <- scan$ToRecordBatchReader()
+ reader$export_to_c(stream_ptr)
+
+ # then import it and check that the roundtripped value is the same
+ circle <- RecordBatchStreamReader$import_from_c(stream_ptr)
+
+ # create an arrow_dplyr_query() from the recordbatch reader
+ reader_adq <- arrow_dplyr_query(circle)
+
+ tab_from_c_new <- reader_adq %>%
+ dplyr::collect()
+ expect_equal(
+ tab_from_c_new %>%
+ arrange(dbl),
Review comment:
I'm getting a segfault on that right now (though maybe I need a rebase
to get the work that you've done to make that possible?) I'll add it as a TODO
after we merge
##########
File path: r/tests/testthat/test-duckdb.R
##########
@@ -64,6 +64,53 @@ test_that("to_duckdb", {
)
})
+test_that("to_duckdb then to_arrow", {
+ ds <- InMemoryDataset$create(example_data)
+
+ ds_rt <- ds %>%
+ to_duckdb() %>%
+ # factors don't roundtrip
+ select(-fct) %>%
+ to_arrow()
+
+ expect_identical(
+ collect(ds_rt),
+ ds %>%
+ select(-fct) %>%
+ collect()
+ )
+
+ # And we can continue the pipeline
+ ds_rt <- ds %>%
+ to_duckdb() %>%
+ # factors don't roundtrip
Review comment:
I've added https://github.com/duckdb/duckdb/issues/1879 which talks
about implementing them in duckdb
--
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]