The DataType
of this Builder
.
The type(s) of values which will be considered null-value sentinels.
Construct a builder with the given Arrow DataType with optional null values,
which will be interpreted as "null" when set or appended to the Builder
.
A BuilderOptions
object used to create this Builder
.
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 children 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.
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-levelmakeBuilder()
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
.