Skip to content

Conversation

@romainfrancois
Copy link
Contributor

@romainfrancois
Copy link
Contributor Author

library(arrow)
#> 
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#> 
#>     timestamp
#> The following objects are masked from 'package:base':
#> 
#>     array, table

b <- record_batch(tibble::tibble(int = 1:2, dbl = rnorm(2)))
tab <- table_from_batches(b,b,b)
tab
#> arrow::Table
as_tibble(tab)
#> # A tibble: 6 x 2
#>     int     dbl
#>   <int>   <dbl>
#> 1     1 -0.267 
#> 2     2 -0.0270
#> 3     1 -0.267 
#> 4     2 -0.0270
#> 5     1 -0.267 
#> 6     2 -0.0270

# this supports !!! splicing so
batches <- rep(list(b), 20L)
tab <- table_from_batches(!!!batches)
tab
#> arrow::Table
as_tibble(tab)
#> # A tibble: 40 x 2
#>      int     dbl
#>    <int>   <dbl>
#>  1     1 -0.267 
#>  2     2 -0.0270
#>  3     1 -0.267 
#>  4     2 -0.0270
#>  5     1 -0.267 
#>  6     2 -0.0270
#>  7     1 -0.267 
#>  8     2 -0.0270
#>  9     1 -0.267 
#> 10     2 -0.0270
#> # … with 30 more rows

Created on 2019-02-05 by the reprex package (v0.2.1.9000)

@romainfrancois
Copy link
Contributor Author

I'm just not sure about the naming. In python the py.Table is exposed but in the R package, the classes are not really meant to be used directly, so defining a static method does not really work, as of now the class is arrow:::`arrow::Table` ...

We could expose certain classes a first class citizens of the package if we really want the syntax Table$from_batches()

@romainfrancois
Copy link
Contributor Author

Actually #3565 is better because it does not need a separate table_from_arrays() function, as the table() itself can handle list of record batches

@xhochy xhochy force-pushed the ARROW-3818/Table_from_batches branch from 123947e to 760accd Compare February 8, 2019 21:23
@xhochy
Copy link
Member

xhochy commented Feb 8, 2019

Rebased.

@romainfrancois romainfrancois force-pushed the ARROW-3818/Table_from_batches branch from 760accd to da51b90 Compare February 13, 2019 09:02
@romainfrancois romainfrancois force-pushed the ARROW-3818/Table_from_batches branch 2 times, most recently from 72ea93a to 53dbf5e Compare February 19, 2019 15:39
@romainfrancois romainfrancois force-pushed the ARROW-3818/Table_from_batches branch from 53dbf5e to c7c5d0f Compare February 26, 2019 08:39
@romainfrancois
Copy link
Contributor Author

Obsolete now, as #3635 was merged.

@romainfrancois romainfrancois deleted the ARROW-3818/Table_from_batches branch March 6, 2019 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants