Array-like data structure. Use the convenience method makeVector and vectorFromArray to create vectors.

Type Parameters

Constructors

Properties

TArray: T["TArray"]
TType: T["TType"]
TValue: T["TValue"]
[isConcatSpreadable]: true
data: readonly Data<T>[]

The primitive Data instances for this Vector's elements.

length: number

The number of elements in this Vector.

numChildren: number

The number of child Vectors if this Vector is a nested dtype.

stride: number

The number of primitive values per Vector element.

type: T

The DataType of this Vector.

Accessors

  • get ArrayType(): T["ArrayType"]
  • The Array or TypedArray constructor used for the JS representation of the element's values in Vector.prototype.toArray toArray().

    Returns T["ArrayType"]

  • get VectorName(): string
  • The name of this Vector.

    Returns string

  • get [toStringTag](): string
  • The name that should be printed when the Vector is logged in a message.

    Returns string

  • get byteLength(): number
  • The aggregate size (in bytes) of this Vector's buffers and/or child Vectors.

    Returns number

  • get isMemoized(): boolean
  • Returns boolean

  • get nullCount(): number
  • The number of null elements in this Vector.

    Returns number

  • get nullable(): boolean
  • Whether this Vector's elements can contain null values.

    Returns boolean

Methods

  • Iterator for the Vector's elements.

    Returns IterableIterator<null | T["TValue"]>

  • Get an element value by position.

    Parameters

    • index: number

      The index of the element to read. A negative index will count back from the last element.

    Returns null | T["TValue"]

  • Combines two or more Vectors of the same type.

    Parameters

    • Rest...others: Vector<T>[]

      Additional Vectors to add to the end of this Vector.

    Returns Vector<T>

  • Get an element value by position.

    Parameters

    • index: number

      The index of the element to read.

    Returns null | T["TValue"]

  • Returns a child Vector by name, or null if this Vector has no child with the given name.

    Type Parameters

    • R extends string | number | symbol

    Parameters

    • name: R

      The name of the child to retrieve.

    Returns null | Vector<any>

  • Returns a child Vector by index, or null if this Vector has no child at the supplied index.

    Type Parameters

    Parameters

    • index: number

      The index of the child to retrieve.

    Returns null | Vector<R>

  • Parameters

    • element: T["TValue"]
    • Optionaloffset: number

    Returns boolean

  • Retrieve the index of the first occurrence of a value in an Vector.

    Parameters

    • element: T["TValue"]

      The value to locate in the Vector.

    • Optionaloffset: number

      The index at which to begin the search. If offset is omitted, the search starts at index 0.

    Returns number

  • Check whether an element is null.

    Parameters

    • index: number

      The index at which to read the validity bitmap.

    Returns boolean

  • Adds memoization to the Vector's get method. For dictionary vectors, this method return a vector that memoizes only the dictionary values.

    Memoization is very useful when decoding a value is expensive such as Utf8. The memoization creates a cache of the size of the Vector and therefore increases memory usage.

    Returns MemoizedVector<T>

    A new vector that memoizes calls to get.

  • Set an element value by position.

    Parameters

    • index: number

      The index of the element to write.

    • value: null | T["TValue"]

      The value to set.

    Returns void

  • Return a zero-copy sub-section of this Vector.

    Parameters

    • Optionalbegin: number
    • Optionalend: number

      The end of the specified portion of the Vector. This is exclusive of the element at the index 'end'.

    Returns Vector<T>

  • Return a JavaScript Array or TypedArray of the Vector's elements.

    Returns T["TArray"]

    An Array or TypedArray of the Vector's elements, based on the Vector's DataType.

    If this Vector contains a single Data chunk and the Vector's type is a primitive numeric type corresponding to one of the JavaScript TypedArrays, this method returns a zero-copy slice of the underlying TypedArray values. If there's more than one chunk, the resulting TypedArray will be a copy of the data from each chunk's underlying TypedArray values.

  • Returns (null | T["TValue"])[]

  • Returns a string representation of the Vector.

    Returns string

    A string representation of the Vector.

  • Returns a vector without memoization of the get method. If this vector is not memoized, this method returns this vector.

    Returns Vector<T>

    A new vector without memoization.