giocomai opened a new issue, #37645:
URL: https://github.com/apache/arrow/issues/37645

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   The `input` object used in Shiny apps does not seem to be fully available to 
arrow when passed to a function which is used for filtering.
   
   Here is a basic Shiny app that can be used to reproduce this issue:
   
   ```
   library("shiny")
   library("arrow")
   ui <- fluidPage(
     
     titlePanel("Arrow issue"),
     
     sidebarLayout(
       sidebarPanel(
         textInput(inputId = "pattern",
                   value = "Lotus Europa",
                   label = "pattern")
       ),
       mainPanel(
         h3("Arrow with pattern passed to `filter(str_detect)`:"),
         tableOutput("arrow_table_detect"),
         h3("Arrow table with pattern passed to `filter():"),
         tableOutput("arrow_table"),
         h3("Plain table with pattern passed to `filter(str_detect)` :"),
         tableOutput("plain_table")
       )
     )
   )
   
   # Define server logic required to draw a histogram
   server <- function(input, output) {
     
     output$arrow_table_detect <- renderTable({
       arrow_table(mtcars |> 
                     tibble::rownames_to_column(var = "name")) |> 
         dplyr::filter(stringr::str_detect(string = name,
                                           pattern = input$pattern)) |> 
         dplyr::collect()
     })
     
     output$arrow_table <- renderTable({
       arrow_table(mtcars |> 
                     tibble::rownames_to_column(var = "name")) |> 
         dplyr::filter(name == input$pattern) |> 
         dplyr::collect()
     })
     
     
     output$plain_table <- renderTable({
       mtcars |> 
         tibble::rownames_to_column(var = "name") |> 
         dplyr::filter(stringr::str_detect(string = name,
                                           pattern = input$pattern)) 
     })
     
   }
   
   shinyApp(ui = ui, server = server)
   
   ```
   
   Screenshot of the result:
   ![Screenshot from 2023-09-11 
00-55-27](https://github.com/apache/arrow/assets/11276752/45a0cd55-5b48-4204-be5e-7c939d39a580)
   
   If input object is passed directly to `filter`, then it does work. If it is 
passed to e.g. `str_detect()` inside a `filter()`, then it throws the error: 
"object 'input' not found" 
   
   Collecting the arrow object fixes the issue, but then we're not using arrow 
any more.
   
   Bug found with the current arrow version 13.
   
   ### Component(s)
   
   R


-- 
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