[JS] Values returned as undefined when arrow file bigger than 2gb

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
data

Research direction

Start with the JavaScript SDK entry points RecordBatchReader.from, tableFromIPC, and table.get(0).toArray(), using the provided Python generator and large-file reader example to reproduce the failure. Done means the 2GB-plus Arrow file still reports the correct row count and returns its values instead of undefined.

Written by the indexing model from the issue text.

Description

Type: bug

Steps:

 

  1. Generate arrow file bigger than 2gb

import pyarrow as pa

nums1 = [42]
nums2 = [42.42]
mil = 1000000

for n in range(1, 140 * mil):
  nums1.append(n)
  nums2.append(1 / n)

arr1 = pa.array(nums1)
arr2 = pa.array(nums2)

schema = pa.schema([
  pa.field('nums1', arr1.type),
  pa.field('nums2', arr2.type),
])

with pa.OSFile('arraydata.arrow', 'wb') as sink:
  with pa.ipc.new_file(sink, schema=schema) as writer:
    batch = pa.record_batch([arr1, arr2], schema=schema)
    writer.write(batch) 
  1. Try to read it via the JS SDK

const fs = require("fs");
const { tableFromIPC, RecordBatchReader } = require("apache-arrow");

const filePath = "./arraydata.arrow";

const stream = fs.createReadStream(filePath);
const reader = RecordBatchReader.from(stream);

(async function () {
  const table = await tableFromIPC(reader);

  console.log("numRows", table.numRows);
  console.log("first row", table.get(0).toArray());
})(); 

The code above prints:


numRows 140000000
first row [ undefined, undefined ] 

numRows is correct, but the values are coming out as {}undefined{}.

Reporter: Denis Gursky

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

Dominant language
TypeScript
Stars
114
Forks
35
Avg merge
13h 35m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-js

All issues in apache/arrow-js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.