You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an endpoint that receives a stream of Arrow data (coming from Rust). The data is streamed via gRPC as record batches, which I then join when the stream completes, and generate an Arrow table with JavaScript.
I'm comfortable that Rust generates the correct data, as I can read it correctly in JS, but I'm struggling with figuring out how to create a table out of this data.
I have the below snippet;
import*asArrowfrom"@apache-arrow/esnext-umd/Arrow";import*asviewerfrom"@finos/perspective-viewer";// ... getting a stream of bytes and joining themconstdata: Uint8Array[]=streamData;// already collected// create JS tablelettable=Arrow.Table.from(data);// this works as I can read the schema and the data// get the viewerletpV: viewer.HTMLPerspectiveViewerElement=components.perspectiveViewer.nativeElement;// option 1: loading arrow data from the tablepV.load(table);// option 2: loading the bytespV.load(data);
Option 1
This fails with the below, I presume because I'm actually passing a JavaScript object, which might be unsupported:
I would have expected this to work as I'm passing raw data which would be compatible with cpp/wasm. I however get OOMs even if I'm passing a very small table.
Is there a way that I can pass this data without converting it to CSV or the like? I can't stream a table through via websockets.
Similar issue(s)
This is similar to #601, but after looking at what RandomFractals was doing for the vscode-preview, I couldn't find a workaround.
Thanks
The text was updated successfully, but these errors were encountered:
I found a solution after @sc1f pointed out that I need to pass my data as an ArrayBuffer.
My solution looks like:
letdata: Uint8Array[]=[all,my,data,as,arrays,of,record,batches];lettable=Arrow.Table.from(data);// arrow seems to be flexible in what it takes// count the length of the chunked dataletlength=0;data.forEach(d=>length+=d.length);// create a new array (couldn't figure out how to combine the other arrays without creating a new oneletbuffer=newUint8Array(length);letoffset=0;data.forEach(d=>{// append the databuffer.set(d,offset);offset=offset+d.length;});// finally load the data from an array bufferpV.load(<any>buffer.buffer);
Interestingly, I had to cast my buffer to <any> because the load() function expects a string or object[]. I think if the typings had an ArrayBuffer I could have self-discovered what I needed to do.
Support Question
I have an endpoint that receives a stream of Arrow data (coming from Rust). The data is streamed via gRPC as record batches, which I then join when the stream completes, and generate an Arrow table with JavaScript.
I'm comfortable that Rust generates the correct data, as I can read it correctly in JS, but I'm struggling with figuring out how to create a table out of this data.
I have the below snippet;
Option 1
This fails with the below, I presume because I'm actually passing a JavaScript object, which might be unsupported:
Option 2
I would have expected this to work as I'm passing raw data which would be compatible with cpp/wasm. I however get OOMs even if I'm passing a very small table.
Is there a way that I can pass this data without converting it to CSV or the like? I can't stream a table through via websockets.
Similar issue(s)
This is similar to #601, but after looking at what RandomFractals was doing for the vscode-preview, I couldn't find a workaround.
Thanks
The text was updated successfully, but these errors were encountered: