Skip to content

Commit

Permalink
docs: Update struct proxy docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jheer committed Sep 11, 2024
1 parent badf145 commit b174781
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/api/column.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ Column.<b>toArray</b>()
Extract column values into a single array instance. When possible, a zero-copy subarray of the input Arrow data is returned. A typed array is used if possible. If a column contains `null` values, a standard `Array` is created and populated.

<hr/><a id="iterator" href="#iterator">#</a>
Column.<b>[Symbol.iterator]</b>()
Column<b>[Symbol.iterator]</b>()

Return an iterator over the values in this column.
4 changes: 3 additions & 1 deletion docs/api/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ Create a List type instance, representing variably-sized lists (arrays) with 32-
<hr/><a id="struct" href="#struct">#</a>
<b>struct</b>(<i>children</i>)

Create a Struct type instance. A struct consists of multiple named child data types. Struct values are stored as parallel child batches, one per child type, and extracted to standard JavaScript objects.
Create a Struct type instance. A struct consists of multiple named child data types. Struct values are stored as parallel child batches, one per child type.

By default, structs are fully extracted to standard JavaScript objects. Pass the `useProxy` extraction option (e.g., to [`tableFromIPC`](/flechette/api/#tableFromIPC) or [`tableFromArrays`](/flechette/api/#tableFromArrays)) to instead use zero-copy proxy row objects that extract data on-demand from underlying Arrow batches. Proxy objects can improve performance and reduce memory usage, but do not support convenient property enumeration (`Object.keys`, `Object.values`, `Object.entries`) or spreading (`{ ...object }`). A proxy object can be converted to a standard object by calling its `toJSON()` method.

* *children* (`Field[] | object`): An array of property fields, or an object mapping property names to data types. If an object, the instantiated fields are assumed to be nullable and have no metadata.

Expand Down
11 changes: 6 additions & 5 deletions docs/api/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ A table consists of named data [columns](#column) (or 'children'). To extract ta
* [Symbol.iterator](#iterator)

<hr/><a id="constructor" href="#constructor">#</a>
Table.<b>constructor</b>(<i>schema</i>, <i>children</i>)
Table.<b>constructor</b>(<i>schema</i>, <i>children</i>[, <i>useProxy</i>])

Create a new table with the given *schema* and *children* columns. The column types and order *must* be consistent with the given *schema*.

* *schema* (`Schema`): The table schema.
* *children* (`Column[]`): The table columns.
* *useProxy* (`boolean`): Flag indicating if zero-copy row proxy objects should be used to represent table rows instead of standard JavaScript objects (default `false`). Proxy objects can improve performance and reduce memory usage, but do not support convenient property enumeration (`Object.keys`, `Object.values`, `Object.entries`) or spreading (`{ ...object }`). A proxy object can be converted to a standard object by calling its `toJSON()` method.

<hr/><a id="numCols" href="#numCols">#</a>
Table.<b>numCols</b>
Expand Down Expand Up @@ -73,7 +74,7 @@ Construct a new table containing only columns with the specified *names*. If col
<hr/><a id="at" href="#at">#</a>
Table.<b>at</b>(<i>index</i>)

Return a row object for the given *index*.
Return a row object for the given *index*. The type of object (standard object or row proxy object) is determined by the table `useProxy` constructor argument.

* *index* (`number`): The row index.

Expand All @@ -90,9 +91,9 @@ Return an object that maps column names to extracted value arrays.
<hr/><a id="toArray" href="#toArray">#</a>
Table.<b>toArray</b>()

Return an array of objects representing the rows of this table.
Return an array of objects representing the rows of this table. The type of object (standard object or row proxy object) is determined by the table `useProxy` constructor argument.

<hr/><a id="iterator" href="#iterator">#</a>
Table.<b>[Symbol.iterator]</b>()
Table<b>[Symbol.iterator]</b>()

Return an iterator over row objects representing the rows of this table.
Return an iterator over row objects representing the rows of this table. The type of object (standard object or row proxy object) is determined by the table `useProxy` constructor argument.

0 comments on commit b174781

Please sign in to comment.