Spaces:
Running
Running
File size: 13,614 Bytes
78c921d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
/// <reference types="node" />
/// <reference types="node" />
import { Vector } from '../vector.js';
import { DataType, TypeMap } from '../type.js';
import { MessageHeader } from '../enum.js';
import { Footer } from './metadata/file.js';
import { Schema, Field } from '../schema.js';
import { Message } from './metadata/message.js';
import * as metadata from './metadata/message.js';
import { ArrayBufferViewInput } from '../util/buffer.js';
import { ByteStream, AsyncByteStream } from '../io/stream.js';
import { RandomAccessFile, AsyncRandomAccessFile } from '../io/file.js';
import { RecordBatch } from '../recordbatch.js';
import { FileHandle, ArrowJSONLike, ReadableInterop } from '../io/interfaces.js';
import { MessageReader, AsyncMessageReader } from './message.js';
/** @ignore */ export declare type FromArg0 = ArrowJSONLike;
/** @ignore */ export declare type FromArg1 = PromiseLike<ArrowJSONLike>;
/** @ignore */ export declare type FromArg2 = Iterable<ArrayBufferViewInput> | ArrayBufferViewInput;
/** @ignore */ export declare type FromArg3 = PromiseLike<Iterable<ArrayBufferViewInput> | ArrayBufferViewInput>;
/** @ignore */ export declare type FromArg4 = Response | NodeJS.ReadableStream | ReadableStream<ArrayBufferViewInput> | AsyncIterable<ArrayBufferViewInput>;
/** @ignore */ export declare type FromArg5 = FileHandle | PromiseLike<FileHandle> | PromiseLike<FromArg4>;
/** @ignore */ export declare type FromArgs = FromArg0 | FromArg1 | FromArg2 | FromArg3 | FromArg4 | FromArg5;
/** @ignore */ declare type OpenOptions = {
autoDestroy?: boolean;
};
/** @ignore */ declare type RecordBatchReaders<T extends TypeMap = any> = RecordBatchFileReader<T> | RecordBatchStreamReader<T>;
/** @ignore */ declare type AsyncRecordBatchReaders<T extends TypeMap = any> = AsyncRecordBatchFileReader<T> | AsyncRecordBatchStreamReader<T>;
/** @ignore */ declare type RecordBatchFileReaders<T extends TypeMap = any> = RecordBatchFileReader<T> | AsyncRecordBatchFileReader<T>;
/** @ignore */ declare type RecordBatchStreamReaders<T extends TypeMap = any> = RecordBatchStreamReader<T> | AsyncRecordBatchStreamReader<T>;
export declare class RecordBatchReader<T extends TypeMap = any> extends ReadableInterop<RecordBatch<T>> {
protected _impl: RecordBatchReaderImpls<T>;
protected constructor(impl: RecordBatchReaderImpls<T>);
get closed(): boolean;
get schema(): Schema<T>;
get autoDestroy(): boolean;
get dictionaries(): Map<number, Vector<any>>;
get numDictionaries(): number;
get numRecordBatches(): number;
get footer(): Footer | null;
isSync(): this is RecordBatchReaders<T>;
isAsync(): this is AsyncRecordBatchReaders<T>;
isFile(): this is RecordBatchFileReaders<T>;
isStream(): this is RecordBatchStreamReaders<T>;
next(): IteratorResult<RecordBatch<T>, any> | Promise<IteratorResult<RecordBatch<T>, any>>;
throw(value?: any): IteratorResult<any, any> | Promise<IteratorResult<any, any>>;
return(value?: any): IteratorResult<any, any> | Promise<IteratorResult<any, any>>;
cancel(): void | Promise<void>;
reset(schema?: Schema<T> | null): this;
open(options?: OpenOptions): this | Promise<this>;
readRecordBatch(index: number): RecordBatch<T> | null | Promise<RecordBatch<T> | null>;
[Symbol.iterator](): IterableIterator<RecordBatch<T>>;
[Symbol.asyncIterator](): AsyncIterableIterator<RecordBatch<T>>;
toDOMStream(): ReadableStream<RecordBatch<T>>;
toNodeStream(): import("stream").Readable;
/** @nocollapse */
static throughNode(options?: import('stream').DuplexOptions & {
autoDestroy: boolean;
}): import('stream').Duplex;
/** @nocollapse */
static throughDOM<T extends TypeMap>(writableStrategy?: ByteLengthQueuingStrategy, readableStrategy?: {
autoDestroy: boolean;
}): {
writable: WritableStream<Uint8Array>;
readable: ReadableStream<RecordBatch<T>>;
};
static from<T extends RecordBatchReader>(source: T): T;
static from<T extends TypeMap = any>(source: FromArg0): RecordBatchStreamReader<T>;
static from<T extends TypeMap = any>(source: FromArg1): Promise<RecordBatchStreamReader<T>>;
static from<T extends TypeMap = any>(source: FromArg2): RecordBatchFileReader<T> | RecordBatchStreamReader<T>;
static from<T extends TypeMap = any>(source: FromArg3): Promise<RecordBatchFileReader<T> | RecordBatchStreamReader<T>>;
static from<T extends TypeMap = any>(source: FromArg4): Promise<AsyncRecordBatchFileReader<T> | AsyncRecordBatchStreamReader<T>>;
static from<T extends TypeMap = any>(source: FromArg5): Promise<AsyncRecordBatchFileReader<T> | AsyncRecordBatchStreamReader<T>>;
static readAll<T extends RecordBatchReader>(source: T): T extends RecordBatchReaders ? IterableIterator<T> : AsyncIterableIterator<T>;
static readAll<T extends TypeMap = any>(source: FromArg0): IterableIterator<RecordBatchStreamReader<T>>;
static readAll<T extends TypeMap = any>(source: FromArg1): AsyncIterableIterator<RecordBatchStreamReader<T>>;
static readAll<T extends TypeMap = any>(source: FromArg2): IterableIterator<RecordBatchFileReader<T> | RecordBatchStreamReader<T>>;
static readAll<T extends TypeMap = any>(source: FromArg3): AsyncIterableIterator<RecordBatchFileReader<T> | RecordBatchStreamReader<T>>;
static readAll<T extends TypeMap = any>(source: FromArg4): AsyncIterableIterator<AsyncRecordBatchReaders<T>>;
static readAll<T extends TypeMap = any>(source: FromArg5): AsyncIterableIterator<AsyncRecordBatchReaders<T>>;
}
/** @ignore */
export declare class RecordBatchStreamReader<T extends TypeMap = any> extends RecordBatchReader<T> {
protected _impl: RecordBatchStreamReaderImpl<T>;
constructor(_impl: RecordBatchStreamReaderImpl<T>);
readAll(): RecordBatch<T>[];
[Symbol.iterator](): IterableIterator<RecordBatch<T>>;
[Symbol.asyncIterator](): AsyncIterableIterator<RecordBatch<T>>;
}
/** @ignore */
export declare class AsyncRecordBatchStreamReader<T extends TypeMap = any> extends RecordBatchReader<T> {
protected _impl: AsyncRecordBatchStreamReaderImpl<T>;
constructor(_impl: AsyncRecordBatchStreamReaderImpl<T>);
readAll(): Promise<RecordBatch<T>[]>;
[Symbol.iterator](): IterableIterator<RecordBatch<T>>;
[Symbol.asyncIterator](): AsyncIterableIterator<RecordBatch<T>>;
}
/** @ignore */
export declare class RecordBatchFileReader<T extends TypeMap = any> extends RecordBatchStreamReader<T> {
protected _impl: RecordBatchFileReaderImpl<T>;
constructor(_impl: RecordBatchFileReaderImpl<T>);
}
/** @ignore */
export declare class AsyncRecordBatchFileReader<T extends TypeMap = any> extends AsyncRecordBatchStreamReader<T> {
protected _impl: AsyncRecordBatchFileReaderImpl<T>;
constructor(_impl: AsyncRecordBatchFileReaderImpl<T>);
}
/** @ignore */
export interface RecordBatchStreamReader<T extends TypeMap = any> extends RecordBatchReader<T> {
open(options?: OpenOptions | undefined): this;
cancel(): void;
throw(value?: any): IteratorResult<any>;
return(value?: any): IteratorResult<any>;
next(value?: any): IteratorResult<RecordBatch<T>>;
}
/** @ignore */
export interface AsyncRecordBatchStreamReader<T extends TypeMap = any> extends RecordBatchReader<T> {
open(options?: OpenOptions | undefined): Promise<this>;
cancel(): Promise<void>;
throw(value?: any): Promise<IteratorResult<any>>;
return(value?: any): Promise<IteratorResult<any>>;
next(value?: any): Promise<IteratorResult<RecordBatch<T>>>;
}
/** @ignore */
export interface RecordBatchFileReader<T extends TypeMap = any> extends RecordBatchStreamReader<T> {
readRecordBatch(index: number): RecordBatch<T> | null;
}
/** @ignore */
export interface AsyncRecordBatchFileReader<T extends TypeMap = any> extends AsyncRecordBatchStreamReader<T> {
readRecordBatch(index: number): Promise<RecordBatch<T> | null>;
}
/** @ignore */
declare type RecordBatchReaderImpls<T extends TypeMap = any> = RecordBatchJSONReaderImpl<T> | RecordBatchFileReaderImpl<T> | RecordBatchStreamReaderImpl<T> | AsyncRecordBatchFileReaderImpl<T> | AsyncRecordBatchStreamReaderImpl<T>;
/** @ignore */
interface RecordBatchReaderImpl<T extends TypeMap = any> {
closed: boolean;
schema: Schema<T>;
autoDestroy: boolean;
dictionaries: Map<number, Vector>;
isFile(): this is RecordBatchFileReaders<T>;
isStream(): this is RecordBatchStreamReaders<T>;
isSync(): this is RecordBatchReaders<T>;
isAsync(): this is AsyncRecordBatchReaders<T>;
reset(schema?: Schema<T> | null): this;
}
/** @ignore */
interface RecordBatchStreamReaderImpl<T extends TypeMap = any> extends RecordBatchReaderImpl<T> {
open(options?: OpenOptions): this;
cancel(): void;
throw(value?: any): IteratorResult<any>;
return(value?: any): IteratorResult<any>;
next(value?: any): IteratorResult<RecordBatch<T>>;
[Symbol.iterator](): IterableIterator<RecordBatch<T>>;
}
/** @ignore */
interface AsyncRecordBatchStreamReaderImpl<T extends TypeMap = any> extends RecordBatchReaderImpl<T> {
open(options?: OpenOptions): Promise<this>;
cancel(): Promise<void>;
throw(value?: any): Promise<IteratorResult<any>>;
return(value?: any): Promise<IteratorResult<any>>;
next(value?: any): Promise<IteratorResult<RecordBatch<T>>>;
[Symbol.asyncIterator](): AsyncIterableIterator<RecordBatch<T>>;
}
/** @ignore */
interface RecordBatchFileReaderImpl<T extends TypeMap = any> extends RecordBatchStreamReaderImpl<T> {
readRecordBatch(index: number): RecordBatch<T> | null;
}
/** @ignore */
interface AsyncRecordBatchFileReaderImpl<T extends TypeMap = any> extends AsyncRecordBatchStreamReaderImpl<T> {
readRecordBatch(index: number): Promise<RecordBatch<T> | null>;
}
/** @ignore */
declare abstract class RecordBatchReaderImpl<T extends TypeMap = any> implements RecordBatchReaderImpl<T> {
schema: Schema<T>;
closed: boolean;
autoDestroy: boolean;
dictionaries: Map<number, Vector>;
protected _dictionaryIndex: number;
protected _recordBatchIndex: number;
get numDictionaries(): number;
get numRecordBatches(): number;
constructor(dictionaries?: Map<number, Vector<any>>);
protected _loadRecordBatch(header: metadata.RecordBatch, body: any): RecordBatch<T>;
protected _loadDictionaryBatch(header: metadata.DictionaryBatch, body: any): Vector<any>;
protected _loadVectors(header: metadata.RecordBatch, body: any, types: (Field | DataType)[]): import("../data.js").Data<any>[];
}
/** @ignore */
declare class RecordBatchStreamReaderImpl<T extends TypeMap = any> extends RecordBatchReaderImpl<T> implements IterableIterator<RecordBatch<T>> {
protected _reader: MessageReader;
protected _handle: ByteStream | ArrowJSONLike;
constructor(source: ByteStream | ArrowJSONLike, dictionaries?: Map<number, Vector>);
isSync(): this is RecordBatchReaders<T>;
isStream(): this is RecordBatchStreamReaders<T>;
protected _readNextMessageAndValidate<T extends MessageHeader>(type?: T | null): Message<T> | null;
}
/** @ignore */
declare class AsyncRecordBatchStreamReaderImpl<T extends TypeMap = any> extends RecordBatchReaderImpl<T> implements AsyncIterableIterator<RecordBatch<T>> {
protected _handle: AsyncByteStream;
protected _reader: AsyncMessageReader;
constructor(source: AsyncByteStream, dictionaries?: Map<number, Vector>);
isAsync(): this is AsyncRecordBatchReaders<T>;
isStream(): this is RecordBatchStreamReaders<T>;
protected _readNextMessageAndValidate<T extends MessageHeader>(type?: T | null): Promise<Message<T> | null>;
}
/** @ignore */
declare class RecordBatchFileReaderImpl<T extends TypeMap = any> extends RecordBatchStreamReaderImpl<T> {
protected _footer?: Footer;
protected _handle: RandomAccessFile;
get footer(): Footer;
get numDictionaries(): number;
get numRecordBatches(): number;
constructor(source: RandomAccessFile | ArrayBufferViewInput, dictionaries?: Map<number, Vector>);
isSync(): this is RecordBatchReaders<T>;
isFile(): this is RecordBatchFileReaders<T>;
open(options?: OpenOptions): this;
protected _readDictionaryBatch(index: number): void;
protected _readFooter(): Footer;
protected _readNextMessageAndValidate<T extends MessageHeader>(type?: T | null): Message<T> | null;
}
/** @ignore */
declare class AsyncRecordBatchFileReaderImpl<T extends TypeMap = any> extends AsyncRecordBatchStreamReaderImpl<T> implements AsyncRecordBatchFileReaderImpl<T> {
protected _footer?: Footer;
protected _handle: AsyncRandomAccessFile;
get footer(): Footer;
get numDictionaries(): number;
get numRecordBatches(): number;
constructor(source: FileHandle, byteLength?: number, dictionaries?: Map<number, Vector>);
constructor(source: FileHandle | AsyncRandomAccessFile, dictionaries?: Map<number, Vector>);
isFile(): this is RecordBatchFileReaders<T>;
isAsync(): this is AsyncRecordBatchReaders<T>;
open(options?: OpenOptions): Promise<this>;
protected _readDictionaryBatch(index: number): Promise<void>;
protected _readFooter(): Promise<Footer>;
protected _readNextMessageAndValidate<T extends MessageHeader>(type?: T | null): Promise<Message<T> | null>;
}
/** @ignore */
declare class RecordBatchJSONReaderImpl<T extends TypeMap = any> extends RecordBatchStreamReaderImpl<T> {
constructor(source: ArrowJSONLike, dictionaries?: Map<number, Vector>);
protected _loadVectors(header: metadata.RecordBatch, body: any, types: (Field | DataType)[]): import("../data.js").Data<any>[];
}
export {};
|