trxcllnt commented on code in PR #489:
URL: https://github.com/apache/arrow-js/pull/489#discussion_r4077155876


##########
src/data.ts:
##########
@@ -168,6 +168,16 @@ export class Data<T extends DataType = DataType> {
             this.variadicBuffers = variadicBuffers;
         }
         this.variadicBuffers ??= [];
+
+        // Slice offsets to the correct length defined by the spec. Often the
+        // backing buffer of `valueOffsets` is longer than the spec requires,
+        // either due to IPC padding or builder over-allocation.
+        if (this.valueOffsets) {
+            const numValueOffsets = DataType.isUnion(type) ? this.length : 
this.length + 1;

Review Comment:
   Sparse unions don't have value offsets, right? If so, this should be fine. 
We can call `isDenseUnion()` if we want to be super explicit though.



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