Uh oh!
There was an error while loading. Please reload this page.
ARROW-16703: [R] Refactor map_batches() so it can stream results - #13650
Conversation
paleolimbot
commented
Jul 19, 2022
@wjones127 I'd love your review on this when you have a chance! A note that I'm going to keep this as a draft until #13397/ARROW-16444 is merged because after it is we can pass this type of record batch reader directly into the query engine (i.e., the awkward |
wjones127
left a comment
There was a problem hiding this comment.
I think as_record_batch_reader.function is so cool! 😍 As a follow-up, we should add an example to the datasets vignette. It seems like it might be useful to show how to use it to generate a larger-than-memory simulated dataset.
There was a problem hiding this comment.
It doesn't right now because the requisite RunWithCapturedR() isn't there yet (it gets added here: https://github.com/apache/arrow/pull/13397/files#diff-0d1ff6f17f571f6a348848af7de9c05ed588d3339f46dd3bcf2808489f7dca92R132-R144 )
Details
library(arrow, warn.conflicts=FALSE)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()` for more information.source_reader<-RecordBatchReader$create(
batches=list(
as_record_batch(mtcars[1:10, ]),
as_record_batch(mtcars[11:20, ]),
as_record_batch(mtcars[21:nrow(mtcars), ])
)
)
reader<-source_reader|> map_batches(~rbind(as.data.frame(.), as.data.frame(.))) dplyr::collect(reader)
#> Error in `dplyr::collect()` at r/R/dplyr-collect.R:43:48:#> ! NotImplemented: Call to R from a non-R thread without calling RunWithCapturedR#> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/record_batch.h:242 ReadNext(&batch)#> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/util/iterator.h:428 it_.Next()#> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/compute/exec/exec_plan.cc:559 iterator_.Next()#> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/record_batch.cc:337 ReadNext(&batch)#> /Users/deweydunnington/Desktop/rscratch/arrow/cpp/src/arrow/record_batch.cc:351 ToRecordBatches()Created on 2022-07-19 by the reprex package (v2.0.1)
There was a problem hiding this comment.
Ah right I should have read your earlier comment to completion. Thanks for explaining!
There was a problem hiding this comment.
We should probably add a test to make sure the dots are being passed through.
There was a problem hiding this comment.
That was a really good catch (it needed to be c(list(batch), dots))!
paleolimbot
commented
Jul 22, 2022
@wjones127 any thoughts on whether or not this is too large of a change to merge? I don't know how many users we have of |
wjones127
commented
Jul 22, 2022
On one hand we do mark this as experimental, so I'm no super worried about breaking it right now. But also I find "an exec plan that ends with head() won't work" alarming. Why wouldn't that work? |
paleolimbot
commented
Jul 22, 2022
It is a bit alarming...it's because some exec plans that end in |
wjones127
commented
Jul 22, 2022
Okay that’s less alarming than I thought. Let’s add that extra param then; it sounds like the best solution for now. Hopefully we can make a goal to stabilize and document in the next version though; we’ve been messing with it for a while. |
ursabot
commented
Jul 24, 2022
Benchmark runs are scheduled for baseline = ee2e944 and contender = 70904df. 70904df is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
…Hub issue numbers (#34260) Rewrite the Jira issue numbers to the GitHub issue numbers, so that the GitHub issue numbers are automatically linked to the issues by pkgdown's auto-linking feature. Issue numbers have been rewritten based on the following correspondence. Also, the pkgdown settings have been changed and updated to link to GitHub. I generated the Changelog page using the `pkgdown::build_news()` function and verified that the links work correctly. --- ARROW-6338#5198ARROW-6364#5201ARROW-6323#5169ARROW-6278#5141ARROW-6360#5329ARROW-6533#5450ARROW-6348#5223ARROW-6337#5399ARROW-10850#9128ARROW-10624#9092ARROW-10386#8549ARROW-6994#23308ARROW-12774#10320ARROW-12670#10287ARROW-16828#13484ARROW-14989#13482ARROW-16977#13514ARROW-13404#10999ARROW-16887#13601ARROW-15906#13206ARROW-15280#13171ARROW-16144#13183ARROW-16511#13105ARROW-16085#13088ARROW-16715#13555ARROW-16268#13550ARROW-16700#13518ARROW-16807#13583ARROW-16871#13517ARROW-16415#13190ARROW-14821#12154ARROW-16439#13174ARROW-16394#13118ARROW-16516#13163ARROW-16395#13627ARROW-14848#12589ARROW-16407#13196ARROW-16653#13506ARROW-14575#13160ARROW-15271#13170ARROW-16703#13650ARROW-16444#13397ARROW-15016#13541ARROW-16776#13563ARROW-15622#13090ARROW-18131#14484ARROW-18305#14581ARROW-18285#14615 * Closes: #33631 Authored-by: SHIMA Tatsuya <ts1s1andn@gmail.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
No description provided.