[ 
https://issues.apache.org/jira/browse/ARROW-17397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579067#comment-17579067
 ] 

Will Jones commented on ARROW-17397:
------------------------------------

Hi Roy,

I think what you are looking for is a 
[read_ipc_stream|https://arrow.apache.org/docs/r/reference/read_ipc_stream.html].

Here is an example:

{code:R}
library(arrow)
library(dplyr)

output_stream <- BufferOutputStream$create()

test_tbl <- tibble::tibble(
  x = 1:1e4,
  y = vapply(x, rlang::hash, character(1), USE.NAMES = FALSE),
  z = vapply(y, rlang::hash, character(1), USE.NAMES = FALSE)
)

write_ipc_stream(test_tbl, output_stream)

ipc_buffer <- output_stream$finish()

read_ipc_stream(ipc_buffer)
{code}
 

> [R] Does R API for Apache Arrow has a tableFromIPC function ? 
> --------------------------------------------------------------
>
>                 Key: ARROW-17397
>                 URL: https://issues.apache.org/jira/browse/ARROW-17397
>             Project: Apache Arrow
>          Issue Type: Improvement
>            Reporter: Roy Assis
>            Priority: Minor
>
> I'm building an API using python and flask. I want to return a dataframe from 
> the API, i'm serializing the dataframe like so and sending it in the response:
> {code:python}
> batch = pa.record_batch(df)
> sink = pa.BufferOutputStream()
> with pa.ipc.new_stream(sink, batch.schema) as writer:
> writer.write_batch(batch)
> pybytes = sink.getvalue().to_pybytes()
> {code}
> Is it possible to read it with R ? If so can you provide a code snippet.
> Best,
> Roy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to