Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

ReadStream

class ReadStream

A ReadStream is one part of a parallelized read of a table, query, or upload. Each stream contains a subset of the rows, and can be read independently of the others, with the same to* methods as its parent.

Constructors

Method
Description

Table.toReadStreams([targetCount, options])

Split a table into ReadStreams. Also callable on Queries and Uploads.

Examples

const table = redivis.table('demo.us_forest_service_fires:5k9t:v1_1.us_fire_perimeters:9r58');

// The server may return fewer streams than requested, depending on the size of the table
const streams = await table.toReadStreams(4, { variables: ['FIRENAME', 'FIREYEAR'] });

// Read the streams concurrently
const results = await Promise.all(streams.map((stream) => stream.toRowsArray()));
const rows = results.flat();

Attributes

Name
Description

id

The stream's id.

parent

The Table, Query, or Upload that the stream was created from.

properties

An object containing the stream's metadata, including estimatedRows.

Methods

Method
Description

ReadStream.to*([maxResults, options])

Various methods to read the stream's data. Mirrors the corresponding Table.to* methods (e.g., stream.toArrowTable()).

Was this helpful?