The DataType
of this Builder
.
The type(s) of values which will be considered null-value sentinels.
A boolean indicating whether Builder.prototype.finish()
has been called on this Builder
.
The number of values written to the Builder
that haven't been flushed yet.
The list of null-value sentinels for this Builder
. When one of these values
is written to the Builder
(either via Builder.prototype.set()
or Builder.prototype.append()
),
a 1-bit is written to this Builder's underlying null BitmapBufferBuilder.
The number of elements in the underlying values TypedArray that
represent a single logical element, determined by this Builder's
DataType
. This is 1 for most types, but is larger when the DataType
is Int64
, Uint64
, Decimal
, DateMillisecond
, certain variants of
Interval
, Time
, or Timestamp
, FixedSizeBinary
, and FixedSizeList
.
The Builder's DataType
instance.
The aggregate length (in bytes) of the values that have been written.
The aggregate length (in bytes) that has been reserved to write new values.
The aggregate number of rows that have been reserved to write new values.
Appends a value (or null) to this Builder
.
This is equivalent to builder.set(builder.length, value)
.
The value to append.
Clear this Builder's internal state, including child Builders if applicable, and reset the length to 0.
The cleared Builder
instance.
Finalize this Builder
, and child builders if applicable.
The finalized Builder
instance.
Commit all the values that have been written to their underlying
ArrayBuffers, including any child Builders if applicable, and reset
the internal Builder
state.
A Data<T>
of the buffers and childData representing the values written.
Validates whether a value is valid (true), or null (false)
The value to compare against null the value representations
Write a value (or null-value sentinel) at the supplied index.
If the value matches one of the null-value representations, a 1-bit is
written to the null BitmapBufferBuilder
. Otherwise, a 0 is written to
the null BitmapBufferBuilder
, and the value is passed to
Builder.prototype.setValue()
.
The index of the value to write.
The value to write at the supplied index.
The updated Builder
instance.
Write a value to the underlying buffers at the supplied index, bypassing the null-value check. This is a low-level method that
Flush the Builder
and return a Vector<T>
.
A Vector<T>
of the flushed values.
Create a Builder
instance based on the type
property of the supplied options
object.
The DataType
of the Builder
to create.
The type(s) of values which will be considered null-value sentinels.
An object with a required DataType
instance
and other optional parameters to be passed to the Builder
subclass for the given type
.
Transform an AsyncIterable
of arbitrary JavaScript values into a
sequence of Arrow Vectoroptions
argument.
This function returns a function that accepts an AsyncIterable
of values to
transform. When called, this function returns an AsyncIterator of Vector<T>
.
The resulting AsyncIterator<Vector<T>>
yields Vectors based on the
queueingStrategy
and highWaterMark
specified in the options
argument.
queueingStrategy
is "count"
(or omitted), The AsyncIterator<Vector<T>>
will flush the underlying Builder
(and yield a new Vector<T>
) once the
Builder's length
reaches or exceeds the supplied highWaterMark
.queueingStrategy
is "bytes"
, the AsyncIterator<Vector<T>>
will flush
the underlying Builder
(and yield a new Vector<T>
) once its byteLength
reaches or exceeds the supplied highWaterMark
.An object of properties which determine the Builder
to create and the chunking semantics to use.
A function which accepts a JavaScript AsyncIterable
of values
to write, and returns an AsyncIterator
that yields Vectors
according to the chunking semantics defined in the options
argument.
Transform a synchronous Iterable
of arbitrary JavaScript values into a
sequence of Arrow Vectoroptions
argument.
This function returns a function that accepts an Iterable
of values to
transform. When called, this function returns an Iterator of Vector<T>
.
The resulting Iterator<Vector<T>>
yields Vectors based on the
queueingStrategy
and highWaterMark
specified in the options
argument.
queueingStrategy
is "count"
(or omitted), The Iterator<Vector<T>>
will flush the underlying Builder
(and yield a new Vector<T>
) once the
Builder's length
reaches or exceeds the supplied highWaterMark
.queueingStrategy
is "bytes"
, the Iterator<Vector<T>>
will flush
the underlying Builder
(and yield a new Vector<T>
) once its byteLength
reaches or exceeds the supplied highWaterMark
.An object of properties which determine the Builder
to create and the chunking semantics to use.
A function which accepts a JavaScript Iterable
of values to
write, and returns an Iterator
that yields Vectors according
to the chunking semantics defined in the options
argument.
Generated using TypeDoc
An abstract base class for types that construct Arrow Vectors from arbitrary JavaScript values.
A
Builder
is responsible for writing arbitrary JavaScript values to ArrayBuffers and/or child Builders according to the Arrow specification for each DataType, creating or resizing the underlying ArrayBuffers as necessary.The
Builder
for each ArrowDataType
handles converting and appending values for a givenDataType
. The high-levelBuilder.new()
convenience method creates the specificBuilder
subclass for the suppliedDataType
.Once created,
Builder
instances support both appending values to the end of theBuilder
, and random-access writes to specific indices (Builder.prototype.append(value)
is a convenience method forbuilder.set(builder.length, value)
). Appending or setting values beyond the Builder's current length may cause the builder to grow its underlying buffers or child Builders (if applicable) to accommodate the new values.After enough values have been written to a
Builder
,Builder.prototype.flush()
will commit the values to the underlying ArrayBuffers (or child Builders). The internal Builder state will be reset, and an instance ofData<T>
is returned. Alternatively,Builder.prototype.toVector()
will flush theBuilder
and return an instance ofVector<T>
instead.When there are no more values to write, use
Builder.prototype.finish()
to finalize theBuilder
. This does not reset the internal state, so it is necessary to callBuilder.prototype.flush()
ortoVector()
one last time if there are still values queued to be flushed.Note: calling
Builder.prototype.finish()
is required when using aDictionaryBuilder
, because this is when it flushes the values that have been enqueued in its internal dictionary'sBuilder
, and creates thedictionaryVector
for theDictionary
DataType
.