Skip to content

Commit 8d8cdd1

Browse files
+ read_arrow / write_arrow for now
1 parent c1385a0 commit 8d8cdd1

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

r/NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export(int64)
2929
export(int8)
3030
export(list_of)
3131
export(null)
32+
export(read_arrow)
3233
export(read_record_batch)
3334
export(record_batch)
3435
export(schema)
@@ -42,6 +43,7 @@ export(uint32)
4243
export(uint64)
4344
export(uint8)
4445
export(utf8)
46+
export(write_arrow)
4547
importFrom(R6,R6Class)
4648
importFrom(Rcpp,sourceCpp)
4749
importFrom(assertthat,assert_that)

r/R/array.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ array <- function(...){
7878
RecordBatch_to_dataframe(x)
7979
}
8080

81+
#' @export
82+
write_arrow <- function(data, path){
83+
record_batch(data)$to_file(path)
84+
}
85+
86+
#' @export
87+
read_arrow <- function(path){
88+
as_tibble(read_record_batch(path))
89+
}
8190

8291
#' Create an arrow::RecordBatch from a data frame
8392
#'

r/src/buffer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ List RecordBatch_to_dataframe(const std::shared_ptr<arrow::RecordBatch>& batch){
159159
return tbl;
160160
}
161161

162-
163-
164162
// [[Rcpp::export]]
165163
std::shared_ptr<arrow::Table> dataframe_to_Table(DataFrame tbl){
166164
auto rb = dataframe_to_RecordBatch(tbl);

0 commit comments

Comments
 (0)