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BAAiB,CAAC,IAAI,CAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,UAAU,IAAI,CAAC,UAA2D,EAAE,MAA4B;QACzG,IAAI,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,GAA0C,IAAI,CAAC;QACpD,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YACpC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC5B,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE;gBAC7B,OAAO;aACV;SACJ;QACD,UAAU,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACL,CAAC","file":"reader.js","sourcesContent":["// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { DataType } from '../../type';\nimport { RecordBatch } from '../../recordbatch';\nimport { AsyncByteQueue } from '../../io/stream';\nimport { RecordBatchReader } from '../../ipc/reader';\n\n/** @ignore */\nexport function recordBatchReaderThroughDOMStream<T extends { [key: string]: DataType } = any>(writableStrategy?: ByteLengthQueuingStrategy, readableStrategy?: { autoDestroy: boolean }) {\n\n const queue = new AsyncByteQueue();\n let reader: RecordBatchReader<T> | null = null;\n\n const readable = new ReadableStream<RecordBatch<T>>({\n async cancel() { await queue.close(); },\n async start(controller) { await next(controller, reader || (reader = await open())); },\n async pull(controller) { reader ? await next(controller, reader) : controller.close(); }\n });\n\n return { writable: new WritableStream(queue, { 'highWaterMark': 2 ** 14, ...writableStrategy }), readable };\n\n async function open() {\n return await (await RecordBatchReader.from<T>(queue)).open(readableStrategy);\n }\n\n async function next(controller: ReadableStreamDefaultController<RecordBatch<T>>, reader: RecordBatchReader<T>) {\n let size = controller.desiredSize;\n let r: IteratorResult<RecordBatch<T>> | null = null;\n while (!(r = await reader.next()).done) {\n controller.enqueue(r.value);\n if (size != null && --size <= 0) {\n return;\n }\n }\n controller.close();\n }\n}\n"]} |