rustyconover opened a new pull request, #402:
URL: https://github.com/apache/arrow-js/pull/402

   ## Summary
   
   When a zero-column RecordBatch is deserialized from IPC, 
`ensureSameLengthData`
   in the `RecordBatch` constructor recomputes length from children via
   `chunks.reduce((max, col) => Math.max(max, col.length), 0)`. With zero 
children,
   this always returns 0 — discarding the original length from the IPC message 
header.
   
   Other Arrow implementations (PyArrow, Arrow Go, arrow-rs) correctly preserve
   numRows for zero-column batches.
   
   ## Fix
   
   Pass `this.data.length` to `ensureSameLengthData` as the explicit `maxLength`
   parameter, which the function already accepts as an optional third argument.
   For batches with columns, `this.data.length` already matches the max column
   length, so there is no behavior change.
   
   ## Tests
   
   - Read a PyArrow-generated zero-column IPC stream (100 rows) and verify 
numRows
   - JS round-trip: write + read zero-column batch, verify numRows preserved
   - Direct constructor: verify zero-column RecordBatch preserves length
   
   Closes #401


-- 
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]

Reply via email to