[
https://issues.apache.org/jira/browse/ARROW-10617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Joris Van den Bossche updated ARROW-10617:
------------------------------------------
Description:
The following example code doesn't work with python 3.8:
{code}
import pyarrow as pa
data = [
pa.array([1, 2, 3, 4]),
pa.array(['foo', 'bar', 'baz', None]),
pa.array([True, None, False, True])
]
batch = pa.record_batch(data, names=['f0', 'f1', 'f2'])
sink = pa.BufferOutputStream()
writer = pa.ipc.new_stream(sink, batch.schema)
for i in range(5):
writer.write_batch(batch)
writer.close()
buf = sink.getvalue()
reader = pa.ipc.open_stream(buf)
[i for i in reader]
{code}
It will raise the following runtime error:
{{StopIteration Traceback (most recent call last)}}
{{ /usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in
pyarrow.lib._CRecordBatchReader.read_next_batch()}}
{{StopIteration:}}
{{During handling of the above exception, another exception occurred:}}
{{RuntimeError Traceback (most recent call last)}}
{{ <ipython-input-7-225bed213dc7> in <module>}}
{{ 18 reader = pa.ipc.open_stream(buf)}}
{{ 19}}
{{ ---> 20 [i for i in reader]}}
{{<ipython-input-7-225bed213dc7> in <listcomp>(.0)}}
{{ 18 reader = pa.ipc.open_stream(buf)}}
{{ 19}}
{{ ---> 20 [i for i in reader]}}
{{/usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in __iter__()}}
{{RuntimeError: generator raised StopIteration}}
was:
The following example code doesn't work with python 3.8:
{{import pyarrow as pa}}
{{ data = [}}
{{ pa.array([1, 2, 3, 4]),}}
{{ pa.array(['foo', 'bar', 'baz', None]),}}
{{ pa.array([True, None, False, True])}}
{{ ]}}
{{ batch = pa.record_batch(data, names=['f0', 'f1', 'f2'])}}
{{sink = pa.BufferOutputStream()}}
{{ writer = pa.ipc.new_stream(sink, batch.schema)}}
{{for i in range(5):}}
{{ writer.write_batch(batch)}}
{{ writer.close()}}
{{ buf = sink.getvalue()}}
{{reader = pa.ipc.open_stream(buf)}}
{{ [i for i in reader]}}
It will raise the following runtime error:
{{StopIteration Traceback (most recent call last)}}
{{ /usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in
pyarrow.lib._CRecordBatchReader.read_next_batch()}}
{{StopIteration:}}
{{During handling of the above exception, another exception occurred:}}
{{RuntimeError Traceback (most recent call last)}}
{{ <ipython-input-7-225bed213dc7> in <module>}}
{{ 18 reader = pa.ipc.open_stream(buf)}}
{{ 19}}
{{ ---> 20 [i for i in reader]}}
{{<ipython-input-7-225bed213dc7> in <listcomp>(.0)}}
{{ 18 reader = pa.ipc.open_stream(buf)}}
{{ 19}}
{{ ---> 20 [i for i in reader]}}
{{/usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in __iter__()}}
{{RuntimeError: generator raised StopIteration}}
> [Python] RecordBatchStreamReader's iterator doesn't work with python 3.8
> ------------------------------------------------------------------------
>
> Key: ARROW-10617
> URL: https://issues.apache.org/jira/browse/ARROW-10617
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 1.0.1
> Reporter: Tao He
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h
> Remaining Estimate: 0h
>
> The following example code doesn't work with python 3.8:
> {code}
> import pyarrow as pa
> data = [
> pa.array([1, 2, 3, 4]),
> pa.array(['foo', 'bar', 'baz', None]),
> pa.array([True, None, False, True])
> ]
> batch = pa.record_batch(data, names=['f0', 'f1', 'f2'])
> sink = pa.BufferOutputStream()
> writer = pa.ipc.new_stream(sink, batch.schema)
> for i in range(5):
> writer.write_batch(batch)
> writer.close()
> buf = sink.getvalue()
> reader = pa.ipc.open_stream(buf)
> [i for i in reader]
> {code}
> It will raise the following runtime error:
> {{StopIteration Traceback (most recent call last)}}
> {{ /usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in
> pyarrow.lib._CRecordBatchReader.read_next_batch()}}
> {{StopIteration:}}
> {{During handling of the above exception, another exception occurred:}}
> {{RuntimeError Traceback (most recent call last)}}
> {{ <ipython-input-7-225bed213dc7> in <module>}}
> {{ 18 reader = pa.ipc.open_stream(buf)}}
> {{ 19}}
> {{ ---> 20 [i for i in reader]}}
> {{<ipython-input-7-225bed213dc7> in <listcomp>(.0)}}
> {{ 18 reader = pa.ipc.open_stream(buf)}}
> {{ 19}}
> {{ ---> 20 [i for i in reader]}}
> {{/usr/local/lib/python3.8/dist-packages/pyarrow/ipc.pxi in __iter__()}}
> {{RuntimeError: generator raised StopIteration}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)