Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Error reading IPC file with no record batches #20503

Closed
asfimport opened this issue Nov 27, 2018 · 5 comments
Closed

[Python] Error reading IPC file with no record batches #20503

asfimport opened this issue Nov 27, 2018 · 5 comments

Comments

@asfimport
Copy link

When using the RecordBatchFileWriter without actually writing a record batch. The magic byte at the beginning of the file is not written. This causes the exception File is smaller than indicated metadata size when reading that file with the RecordBatchFileReader.

Reporter: Rik Coenders
Assignee: Wes McKinney / @wesm

PRs and other links:

Note: This issue was originally created as ARROW-3894. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Is this in Python?

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Making the assumption that this is C++/Python related, but someone can update if they find out this is not the case

@asfimport
Copy link
Author

Rik Coenders:
I have got the issue in python, but looking at the code my assumption is that this problem is in the underlying c++ library, so it might occur in other languages as well.

@asfimport
Copy link
Author

Rik Coenders:
To reproduce:

import pyarrow
import tempfile

schema = pyarrow.schema([('field', pyarrow.int64())])
filename = tempfile.mkstemp()[1]

with pyarrow.OSFile(filename, 'w') as file:
    writer = pyarrow.RecordBatchFileWriter(file, schema)
    writer.close()

with pyarrow.OSFile(filename, 'r') as file:
    reader = pyarrow.RecordBatchFileReader(file)
    reader.read_all()

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Issue resolved by pull request 3095
#3095

@asfimport asfimport added this to the 0.12.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants