Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-3439: [R] R language bindings for Feather format #2947

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
until we figure out how to probably do double dispatch and 🤐 check
  • Loading branch information
romainfrancois committed Nov 14, 2018
commit 14b169dd6aa8f63fd0198d7a2f5d4b8e2774a5c1
10 changes: 5 additions & 5 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ S3method("==","arrow::DataType")
S3method("==","arrow::Field")
S3method("==","arrow::RecordBatch")
S3method("==","arrow::ipc::Message")
S3method("write_feather.arrow::RecordBatch","arrow::io::OutputStream")
S3method("write_feather.arrow::RecordBatch",character)
S3method("write_feather.arrow::RecordBatch",default)
S3method("write_feather.arrow::RecordBatch",fs_path)
S3method(as_tibble,"arrow::RecordBatch")
S3method(as_tibble,"arrow::Table")
S3method(buffer,default)
Expand Down Expand Up @@ -64,6 +60,10 @@ S3method(write_arrow,data.frame)
S3method(write_feather,"arrow::RecordBatch")
S3method(write_feather,data.frame)
S3method(write_feather,default)
S3method(write_feather_RecordBatch,"arrow::io::OutputStream")
S3method(write_feather_RecordBatch,character)
S3method(write_feather_RecordBatch,default)
S3method(write_feather_RecordBatch,fs_path)
S3method(write_record_batch,"arrow::io::OutputStream")
S3method(write_record_batch,"arrow::ipc::RecordBatchWriter")
S3method(write_record_batch,character)
Expand All @@ -74,7 +74,6 @@ S3method(write_table,"arrow::ipc::RecordBatchWriter")
S3method(write_table,character)
S3method(write_table,fs_path)
S3method(write_table,raw)
export("write_feather.arrow::RecordBatch")
export(DateUnit)
export(FileMode)
export(MessageType)
Expand Down Expand Up @@ -136,6 +135,7 @@ export(uint8)
export(utf8)
export(write_arrow)
export(write_feather)
export(write_feather_RecordBatch)
export(write_record_batch)
export(write_table)
importFrom(R6,R6Class)
Expand Down
30 changes: 17 additions & 13 deletions r/R/feather.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,40 @@ write_feather.data.frame <- function(data, stream) {
write_feather(record_batch(data), stream)
}

#' @rdname write_feather
#' @method write_feather arrow::RecordBatch
#' @export write_feather.arrow::RecordBatch
#' @export
`write_feather.arrow::RecordBatch` <- function(data, stream) {
UseMethod("write_feather.arrow::RecordBatch", stream)
write_feather_RecordBatch(data, stream)
}

#' @rdname write_feather
#' @export
write_feather_RecordBatch <- function(data, stream) {
UseMethod("write_feather_RecordBatch", stream)
}

#' @export
#' @method write_feather.arrow::RecordBatch default
`write_feather.arrow::RecordBatch.default` <- function(data, stream) {
#' @method write_feather_RecordBatch default
`write_feather_RecordBatch.default` <- function(data, stream) {
stop("unsupported")
}

#' @export
#' @method write_feather.arrow::RecordBatch character
`write_feather.arrow::RecordBatch.character` <- function(data, stream) {
`write_feather.arrow::RecordBatch.fs_path`(data, fs::path_abs(stream))
#' @method write_feather_RecordBatch character
`write_feather_RecordBatch.character` <- function(data, stream) {
`write_feather_RecordBatch.fs_path`(data, fs::path_abs(stream))
}

#' @export
#' @method write_feather.arrow::RecordBatch fs_path
`write_feather.arrow::RecordBatch.fs_path` <- function(data, stream) {
#' @method write_feather_RecordBatch fs_path
`write_feather_RecordBatch.fs_path` <- function(data, stream) {
file_stream <- close_on_exit(file_output_stream(stream))
`write_feather.arrow::RecordBatch.arrow::io::OutputStream`(data, file_stream)
`write_feather_RecordBatch.arrow::io::OutputStream`(data, file_stream)
}

#' @export
#' @method write_feather.arrow::RecordBatch arrow::io::OutputStream
`write_feather.arrow::RecordBatch.arrow::io::OutputStream` <- function(data, stream) {
#' @method write_feather_RecordBatch arrow::io::OutputStream
`write_feather_RecordBatch.arrow::io::OutputStream` <- function(data, stream) {
ipc___TableWriter__RecordBatch__WriteFeather(table_writer(stream), data)
}

Expand Down
4 changes: 2 additions & 2 deletions r/man/write_feather.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.