Dewey Dunnington created ARROW-16517:
----------------------------------------

             Summary: [R] as_arrow_table() and as_record_batch() do not 
preserve row count for empty data.frame
                 Key: ARROW-16517
                 URL: https://issues.apache.org/jira/browse/ARROW-16517
             Project: Apache Arrow
          Issue Type: Improvement
          Components: R
            Reporter: Dewey Dunnington


It's definitely an edge case, but preserving the row-count on zero-column 
tables/record batches is helpful when programming on those objects (I ran into 
this when working with GeoParquet tables, where I separate the geometry and 
non-geometry columns and then recombine. The functionality is there but it 
looks like it's not implemented for the data.frame case.

{code:R}
arrow::as_arrow_table(tibble::tibble(.rows = 5))
#> Table
#> 0 rows x 0 columns
arrow::record_batch(tibble::tibble(.rows = 5))
#> RecordBatch
#> 0 rows x 0 columns

# workaround
arrow::arrow_table(x = 1:5)[integer()]
#> Table
#> 5 rows x 0 columns
{code}




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to