You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/07 22:42:19 UTC

[GitHub] [arrow] eitsupi commented on a diff in pull request #14175: ARROW-17737: [R] Continue to retain grouping metadata even if ungroup arrow dplyr query

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org