> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/api/client-libraries/redivis-js/reference/table/table.toarrowbatchiterator.md).

# Table.toArrowBatchIterator

### Table.<mark style="color:purple;">toArrowBatchIterator</mark>(*\[maxResults, options]*) → `AsyncGenerator<arrow.RecordBatch>`

Returns an async iterator of arrow [RecordBatches](https://arrow.apache.org/docs/js/classes/Arrow_dom.RecordBatch.html), for processing the table's data in a memory-efficient streaming manner. Nothing is read until iteration begins, and breaking out of the loop stops the read. When the table is read in parallel, batches arrive in no particular order.

{% hint style="info" %}
Also callable on [Queries](https://docs.redivis.com/api/client-libraries/redivis-js/reference/query.md), [Uploads](https://docs.redivis.com/api/client-libraries/redivis-js/reference/upload.md), and [ReadStreams](https://docs.redivis.com/api/client-libraries/redivis-js/reference/readstream.md) → `query.toArrowBatchIterator(...)` | `upload.toArrowBatchIterator(...)`
{% endhint %}

```javascript
let count = 0;
for await (const batch of table.toArrowBatchIterator({ variables: ['FIRENAME', 'GISACRES'] })) {
  count += batch.numRows;
}
```

**Parameters:**

**`maxResults`** : *number, optional*\
The maximum number of rows to return. If not specified, all rows in the table will be read.

**`variables`** : *string\[], optional*\
A list of variable names to read, improving performance when not all variables are needed. If unspecified, all variables will be represented in the returned rows. Variable names are case-insensitive, though the names in the results will reflect the variable's true casing. The order of the columns returned will correspond to the order of names in this list.

**`maxParallelization`** : *number, default the number of CPU cores, up to 8*\
The maximum number of streams to read in parallel, for large reads.

**`batchPreprocessor`** : *function, optional*\
A function used to preprocess the data, invoked for each `RecordBatch` as it is read. It must return a `RecordBatch` (or a promise of one), or `null` to drop the batch.

**`onProgress`** : *function, optional*\
Called with `{ rowsRead, totalRows }` as batches are read.

**`signal`** : *AbortSignal, optional*\
Cancels the read.

**Returns:** `AsyncGenerator<`[`arrow.RecordBatch`](https://arrow.apache.org/docs/js/classes/Arrow_dom.RecordBatch.html)`>`

{% hint style="success" %}
**See also**

* [Table.toArrowTable()](https://docs.redivis.com/api/client-libraries/redivis-js/reference/table/table.toarrowtable.md)
* [Table.toRowsArray()](https://docs.redivis.com/api/client-libraries/redivis-js/reference/table/table.torowsarray.md)
* [Table.toReadStreams()](https://docs.redivis.com/api/client-libraries/redivis-js/reference/table/table.toreadstreams.md)
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.redivis.com/api/client-libraries/redivis-js/reference/table/table.toarrowbatchiterator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
