[
https://issues.apache.org/jira/browse/ARROW-17438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17614070#comment-17614070
]
Dewey Dunnington commented on ARROW-17438:
------------------------------------------
Thanks Will! I just tested on master too...I think the lazy 'head'
implementation did the trick here.
{code:R}
library(arrow, warn.conflicts = FALSE)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()` for
more information.
library(dplyr, warn.conflicts = FALSE)
register_scalar_function(
"test",
function(context, x) paste(x, collapse=","),
utf8(),
utf8(),
auto_convert=TRUE
)
Table$create(x = c("a", "b", "c")) |>
transmute(test(x)) |>
glimpse()
#> Table (query)
#> 3 rows x 1 columns
#> $ `test(x)` <string> "a,b,c"
#> Call `print()` for query details
{code}
> [R] glimpse() errors if there is a UDF
> --------------------------------------
>
> Key: ARROW-17438
> URL: https://issues.apache.org/jira/browse/ARROW-17438
> Project: Apache Arrow
> Issue Type: Bug
> Components: R
> Affects Versions: 9.0.0
> Reporter: Neal Richardson
> Priority: Major
> Fix For: 10.0.0
>
>
> Using the example from ARROW-17437:
> {code}
> register_scalar_function(
> "test",
> function(context, x) paste(x, collapse=","),
> utf8(),
> utf8(),
> auto_convert=TRUE
> )
> Table$create(x = c("a", "b", "c")) |>
> transmute(test(x)) |>
> glimpse()
> # Table (query)
> # 3 rows x 1 columns
> # Error in `dplyr::collect()`:
> # ! NotImplemented: Call to R (resolve scalar user-defined function output
> data type) from a non-R thread from an unsupported context
> # Run `rlang::last_error()` to see where the error occurred.
> {code}
> A variety of things could fix this:
> * Supporting UDFs in any query (I think there's a draft PR open for this)
> * The limit operator (FetchNode?) so that {{head()}} is handled in the
> ExecPlan and we don't need to use the RecordBatchReader workaround to get it
> efficiently (also PR in the works)
> * Worse case, error more informatively
--
This message was sent by Atlassian Jira
(v8.20.10#820010)