eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r990536980


##########
r/R/dplyr.R:
##########
@@ -182,7 +182,7 @@ dim.arrow_dplyr_query <- function(x) {
     # Query on in-memory Table, so evaluate the filter
     # Don't need any columns
     x <- select.arrow_dplyr_query(x, NULL)
-    rows <- nrow(compute.arrow_dplyr_query(x))
+    rows <- nrow(as_arrow_table(x))

Review Comment:
   This is because manipulating metadata for a table with no rows will cause 
the size to be updated to 0 x 0.
   
   
   ``` r
   mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> 
arrow::as_arrow_table()
   #> Table
   #> 32 rows x 0 columns
   #>
   #>
   #> See $metadata for additional Schema metadata
   mtcars |> arrow::arrow_table() |> dplyr::select(NULL) |> 
arrow::as_arrow_table() |> dplyr::ungroup()
   #> Table
   #> 0 rows x 0 columns
   #>
   #>
   #> See $metadata for additional Schema metadata
   ```
   
   <sup>Created on 2022-10-07 with [reprex 
v2.0.2](https://reprex.tidyverse.org)</sup>
   
   I don't know if this (handling of tables with no rows) is the problem.



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