zbs commented on issue #37732:
URL: https://github.com/apache/arrow/issues/37732#issuecomment-1720423091
Unfortunately I don't have a simple reproducer, since this is hooked up to
live data streams and other large internal data sources. I can paste my writer
and reader code.
In writer script:
```
writer_exit_stack = ExitStack()
id_to_writer = {}
with writer_exit_stack:
# data_reader is effectively a `pa.ipc.open_stream(obj)`
for data_batch in data_reader:
if len(data_batch) == 0:
continue
for id in pc.unique(data_batch["id"]):
batch = data_batch.filter(pc.equal(data_batch["id"], id))
path = f"foo_{id}.arrow"
if id not in id_to_writer:
writer = pa.ipc.new_stream(path, data_reader.schema)
id_to_writer[id] = writer
writer_exit_stack.enter_context(writer)
writer = id_to_writer[id]
writer.write_batch(batch)
```
In reader script:
```
with pa.ipc.open_stream(path) as reader:
batch = reader.read_all()
df = batch.to_pandas()
```
Some notes from debugging:
- The writer script was running with a four hour time allotment. At the end
of that allotment, the process was killed. I noticed that the paths which
contained the bad indices all had timestamps equalling the time when the
process was killed. I did add the writers to the exit stack, but is it possible
that some sort of finalization was pre-empted, and the data is resultingly
corrupt?
- Across files with the same schema, the issue occurred in different
columns. The first instance of this was in column A, the second in column Z,
etc.
--
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]