Mallard
Search Results for

    Show / Hide Table of Contents

    Class DuckDbVectorMethods

    Extension methods on DuckDbVectorReader<T> and DuckDbVectorRawReader<T>.

    Inheritance
    object
    DuckDbVectorMethods
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mallard
    Assembly: Mallard.dll
    Syntax
    public static class DuckDbVectorMethods
    Remarks

    These methods are extension methods rather than instance methods primarily so they can be precisely defined to apply to certain cases for the type parameter.

    Methods

    | Edit this page View Source

    AsSpan<T>(in DuckDbVectorRawReader<T>)

    Get the contents of a DuckDB vector as a .NET span.

    Declaration
    public static ReadOnlySpan<T> AsSpan<T>(this in DuckDbVectorRawReader<T> vector) where T : unmanaged
    Parameters
    Type Name Description
    DuckDbVectorRawReader<T> vector

    The DuckDB vector to read from.

    Returns
    Type Description
    ReadOnlySpan<T>

    Span covering all the elements of the DuckDB vector. Note that elements of the vector that are invalid, may be "garbage" or un-initialized when indexed using the returned span.

    Type Parameters
    Name Description
    T

    The type of element in the DuckDB vector. This method is only available for "primitive" types, i.e. types containing data of fixed size, as variable-length data cannot be safely exposed except through a "ref struct", but a "ref struct" cannot be the element type of ReadOnlySpan<T>.

    Exceptions
    Type Condition
    InvalidOperationException

    When T is DuckDbArrayRef.
    A DuckDB vector of such type does not have directly have elements, and therefore no span can be made available. The contents of vector are made available in the "children vector".

    | Edit this page View Source

    GetChildrenRawVector<T>(in DuckDbVectorRawReader<DuckDbArrayRef>)

    Get the raw vector for the children of a vector of lists.

    Declaration
    public static DuckDbVectorRawReader<T> GetChildrenRawVector<T>(this in DuckDbVectorRawReader<DuckDbArrayRef> parent) where T : unmanaged, allows ref struct
    Parameters
    Type Name Description
    DuckDbVectorRawReader<DuckDbArrayRef> parent

    The raw vector of lists.

    Returns
    Type Description
    DuckDbVectorRawReader<T>

    The raw vector for reading the children (items) of the lists inside parent.

    Type Parameters
    Name Description
    T

    The element type of the lists. It must be compatible with DuckDbVectorRawReader<T>.

    | Edit this page View Source

    GetChildrenRaw<T>(in DuckDbVectorRawReader<DuckDbListRef>)

    Retrieve the vector containing all the children across all lists in a vector of lists, allowing "raw" access (spans).

    Declaration
    public static DuckDbVectorRawReader<T> GetChildrenRaw<T>(this in DuckDbVectorRawReader<DuckDbListRef> parent) where T : unmanaged, allows ref struct
    Parameters
    Type Name Description
    DuckDbVectorRawReader<DuckDbListRef> parent

    The vector of lists.

    Returns
    Type Description
    DuckDbVectorRawReader<T>

    The lists' children, collected into one vector, i.e. the "children vector" or "vector of list children".

    Type Parameters
    Name Description
    T

    The .NET type to bind an element of the lists to.

    Exceptions
    Type Condition
    DuckDbException
    | Edit this page View Source

    GetMemberItemsRaw<T>(in DuckDbVectorRawReader<DuckDbStructRef>, int)

    Retrieve the vector containing all the items of one member of a struct, within a struct-typed parent vector.

    Declaration
    public static DuckDbVectorRawReader<T> GetMemberItemsRaw<T>(this in DuckDbVectorRawReader<DuckDbStructRef> parent, int memberIndex) where T : unmanaged, allows ref struct
    Parameters
    Type Name Description
    DuckDbVectorRawReader<DuckDbStructRef> parent

    The struct-typed parent vector.

    int memberIndex

    The index of the member in the struct, numbered starting from 0.

    Returns
    Type Description
    DuckDbVectorRawReader<T>

    The lists' children, collected into one vector, i.e. the "children vector" or "vector of list children".

    Type Parameters
    Name Description
    T

    The .NET type to bind struct member values to.

    | Edit this page View Source

    GetMemberName(in DuckDbVectorRawReader<DuckDbStructRef>, int)

    Get the name of a member for a struct-typed vector.

    Declaration
    public static string GetMemberName(this in DuckDbVectorRawReader<DuckDbStructRef> parent, int memberIndex)
    Parameters
    Type Name Description
    DuckDbVectorRawReader<DuckDbStructRef> parent

    The struct-typed DuckDB vector.

    int memberIndex

    The index of the member in the struct, numbered from 0 (inclusive) to ElementSize (exclusive).

    Returns
    Type Description
    string

    The name of the struct member.

    Remarks

    The name needs to be queried from DuckDB every time this method is called, so the caller should cache the result if it is needed multiple times.

    | Edit this page View Source

    GetNullableValue<T>(in DuckDbVectorReader<T>, int)

    Retrieve one element from a DuckDB vector, allowing null values.

    Declaration
    public static T? GetNullableValue<T>(this in DuckDbVectorReader<T> vector, int index) where T : struct
    Parameters
    Type Name Description
    DuckDbVectorReader<T> vector

    The vector to retrieve from.

    int index

    The index of the desired element.

    Returns
    Type Description
    T?

    The value of the selected element, or null (if it is null in the DuckDB vector).

    Type Parameters
    Name Description
    T

    The .NET value type for the element.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    The index is out of range for the vector.

    | Edit this page View Source

    GetNullable<T>(in DuckDbVectorReader<T>, int)

    Retrieve one element from a DuckDB vector, allowing null references.

    Declaration
    public static T? GetNullable<T>(this in DuckDbVectorReader<T> vector, int index) where T : class
    Parameters
    Type Name Description
    DuckDbVectorReader<T> vector

    The vector to retrieve from.

    int index

    The index of the desired element.

    Returns
    Type Description
    T

    The value of the selected element, or null (if it is null in the DuckDB vector).

    Type Parameters
    Name Description
    T

    The .NET reference type for the element.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    The index is out of range for the vector.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX