Mallard
Search Results for

    Show / Hide Table of Contents

    Class DuckDbResultChunk

    A chunk that has been retrieved (and captured) from the results of a query to DuckDB.

    Inheritance
    object
    DuckDbResultChunk
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mallard
    Assembly: Mallard.dll
    Syntax
    public sealed class DuckDbResultChunk : IDisposable
    Remarks

    This class allows the same chunk to be processed or read over and over again. Such functionality helps to implement row-oriented readers (whereas DuckDB is naturally column-oriented), that implement methods returning individual rows.

    For more efficient column-oriented, streaming processing, use methods like ProcessNextChunk<TState, TReturn>(TState, DuckDbChunkReadingFunc<TState, TReturn>, out TReturn) instead.

    The data in the chunk is held by the native DuckDB library. Instances of this class should be disposed after the user is finished with a chunk, to avoid unpredictable memory usage (before garbage collection kicks in).

    Properties

    | Edit this page View Source

    ColumnCount

    Declaration
    public int ColumnCount { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Length

    The number of rows present in this chunk.

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Dispose()

    Disposes this object along with resources allocated in the native DuckDB library for it.

    Declaration
    public void Dispose()
    | Edit this page View Source

    ~DuckDbResultChunk()

    Destructor which will dispose this object if it has yet been already.

    Declaration
    protected ~DuckDbResultChunk()
    | Edit this page View Source

    GetColumnIndex(string)

    Declaration
    public int GetColumnIndex(string columnName)
    Parameters
    Type Name Description
    string columnName
    Returns
    Type Description
    int
    | Edit this page View Source

    GetColumnInfo(int)

    Declaration
    public DuckDbColumnInfo GetColumnInfo(int columnIndex)
    Parameters
    Type Name Description
    int columnIndex
    Returns
    Type Description
    DuckDbColumnInfo
    | Edit this page View Source

    GetColumnName(int)

    Declaration
    public string GetColumnName(int columnIndex)
    Parameters
    Type Name Description
    int columnIndex
    Returns
    Type Description
    string
    | Edit this page View Source

    ProcessContents<TState, TResult>(TState, DuckDbChunkReadingFunc<TState, TResult>)

    Access the contents of this chunk of results in a direct, column-oriented manner.

    Declaration
    public TResult ProcessContents<TState, TResult>(TState state, DuckDbChunkReadingFunc<TState, TResult> func) where TState : allows ref struct
    Parameters
    Type Name Description
    TState state

    The state object or structure to pass into func.

    DuckDbChunkReadingFunc<TState, TResult> func

    The caller-specified function that receives the results from the next chunk and may do any processing on it.

    Returns
    Type Description
    TResult

    Whatever func returns.

    Type Parameters
    Name Description
    TState

    Type of arbitrary state to pass into the caller-specified function.

    TResult

    The type of value returned by the caller-specified function.

    Remarks

    This method offers fast, direct access to the native memory backing the DuckDB vectors (columns) of the results. However, to make these operations safe (allowing no dangling pointers), this library must be able to bound the scope of access. Thus, the code to consume the vectors' data must be encapsulated in a function that this method invokes.

    This method can be called over and over again, and the same data will be seen by the caller-specified function on each invocation.

    Implements

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