You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "schaefer01 (via GitHub)" <gi...@apache.org> on 2023/05/08 15:01:25 UTC

[GitHub] [arrow] schaefer01 commented on issue #35477: using to_bytes() prior to adds overhead, no info on how to recover (index to) original data

schaefer01 commented on issue #35477:
URL: https://github.com/apache/arrow/issues/35477#issuecomment-1538505737

   I forgot the to_bytes function:
   def pa_to_bytes(data_in):
     debug_f = False
   
     batch = pa.record_batch([data_in],names=['f0'])
   
     if (debug_f):
       print("len(batch)=",len(batch))
   
     sink = pa.BufferOutputStream()
   
     # print("len(sink)=",len(sink)) # sink has no length
   
     with pa.ipc.new_stream(sink, batch.schema) as writer:
       #for i in range(8*1024):
         writer.write_batch(batch)
       # end for
     # end with 
   
     buf = sink.getvalue()
   
     pa_bytes = buf.to_pybytes()
   
     return pa_bytes
   
   # end pa_to_bytes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org