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

ARROW-6795: [C#] Fix for reading large (2GB+) files #5412

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions csharp/src/Apache.Arrow/Ipc/ArrowFileReaderImplementation.cs
Expand Up @@ -33,11 +33,6 @@ internal sealed class ArrowFileReaderImplementation : ArrowStreamReaderImplement
/// </summary>
private int _recordBatchIndex;

/// <summary>
/// Notes what byte position where the footer data is in the stream
/// </summary>
private int _footerStartPostion;

private ArrowFooter _footer;

public ArrowFileReaderImplementation(Stream stream, MemoryAllocator allocator, bool leaveOpen)
Expand Down Expand Up @@ -77,9 +72,9 @@ protected override async ValueTask ReadSchemaAsync()

await ArrayPool<byte>.Shared.RentReturnAsync(footerLength, async (buffer) =>
{
_footerStartPostion = (int)GetFooterLengthPosition() - footerLength;
long footerStartPostion = GetFooterLengthPosition() - footerLength;

BaseStream.Position = _footerStartPostion;
BaseStream.Position = footerStartPostion;

int bytesRead = await BaseStream.ReadFullBufferAsync(buffer).ConfigureAwait(false);
EnsureFullRead(buffer, bytesRead);
Expand Down Expand Up @@ -110,9 +105,9 @@ protected override void ReadSchema()

ArrayPool<byte>.Shared.RentReturn(footerLength, (buffer) =>
{
_footerStartPostion = (int)GetFooterLengthPosition() - footerLength;
long footerStartPostion = GetFooterLengthPosition() - footerLength;

BaseStream.Position = _footerStartPostion;
BaseStream.Position = footerStartPostion;

int bytesRead = BaseStream.ReadFullBuffer(buffer);
EnsureFullRead(buffer, bytesRead);
Expand Down