pitrou commented on code in PR #31:
URL: https://github.com/apache/arrow-experiments/pull/31#discussion_r1727561967
##########
http/get_simple/python/server/server.py:
##########
@@ -56,24 +56,44 @@ def GetPutData():
return batches
-def make_reader(schema, batches):
- return pa.RecordBatchReader.from_batches(schema, batches)
-
-def generate_batches(schema, reader):
+def generate_buffers(schema, source):
with io.BytesIO() as sink, pa.ipc.new_stream(sink, schema) as writer:
- for batch in reader:
+ for batch in source:
sink.seek(0)
- sink.truncate(0)
writer.write_batch(batch)
+ sink.truncate()
yield sink.getvalue()
Review Comment:
See my comment above. The `del` is unidiomatic is this case, while `with`
triggers reliable closing of the buffer view.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]