You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/01 04:37:49 UTC

[GitHub] [arrow] domoritz commented on a diff in pull request #13278: ARROW-16704: [JS] Handle case where `tableFromIPC` input is an async `RecordBatchReader`

domoritz commented on code in PR #13278:
URL: https://github.com/apache/arrow/pull/13278#discussion_r886310516


##########
js/test/unit/ipc/serialization-tests.ts:
##########
@@ -37,6 +37,30 @@ function createTable<T extends TypeMap = any>(schema: Schema<T>, chunkLengths: n
     return generate.table(chunkLengths, schema).table;
 }
 
+describe('tableFromIPC', () => {
+    test('handles AsyncRecordBatchReader input', async () => {
+        type T = { a: Uint8 };
+
+        const sources = [
+            new Table({ a: makeVector(new Uint8Array([1, 2, 3])) }),
+            new Table({ a: makeVector(new Uint8Array([4, 5, 6])) }),
+        ];
+
+        const writer = sources.reduce(
+            (writer, source) => writer.writeAll(source),
+            new RecordBatchStreamWriter<T>({ autoDestroy: false })
+        );
+
+        writer.close();
+
+        let index = 0;
+
+        for await (const reader of RecordBatchReader.readAll<T>(writer[Symbol.asyncIterator]())) {
+            expect(sources[index++]).toEqualTable(await tableFromIPC(reader));

Review Comment:
   Shouldn't this be the other way around (actual on the left)? 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org