Show / Hide Table of Contents

Class Query

Represents a TileDB query object.

Inheritance
object
Query
Implements
IDisposable
Namespace: TileDB.CSharp
Assembly: TileDB.CSharp.dll
Syntax
public sealed class Query : IDisposable

Constructors

| Edit this page View Source

Query(Array)

Creates a Query with an implicit QueryType.

Declaration
public Query(Array array)
Parameters
Type Name Description
Array array

The array on which the query will operate. Its QueryType() will be used for the query.

| Edit this page View Source

Query(Array, QueryType)

Creates a Query.

Declaration
public Query(Array array, QueryType queryType)
Parameters
Type Name Description
Array array

The array on which the query will operate.

QueryType queryType

The query's type.

Methods

| Edit this page View Source

Array()

Returns the array of the query.

Declaration
public Array Array()
Returns
Type Description
Array
| Edit this page View Source

Config()

Get config.

Declaration
public Config Config()
Returns
Type Description
Config
| Edit this page View Source

Dispose()

Disposes this Query.

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

EstResultSize(string)

Estimates the result size for an attribute or dimension.

Declaration
public ResultSize EstResultSize(string name)
Parameters
Type Name Description
string name

The name of the attribute or dimension.

Returns
Type Description
ResultSize
| Edit this page View Source

FinalizeQuery()

Flushes all internal state of a query object and finalizes the query, only applicable to global layout writes.

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

FragmentNum()

Returns the number of written fragments. Applicable only to WRITE queries.

Declaration
public uint FragmentNum()
Returns
Type Description
uint
| Edit this page View Source

FragmentTimestampRange(ulong)

Retrieves the timestamp range of the written fragment with the input index. Applicable only to WRITE queries.

Declaration
public Tuple<ulong, ulong> FragmentTimestampRange(ulong idx)
Parameters
Type Name Description
ulong idx
Returns
Type Description
Tuple<ulong, ulong>
| Edit this page View Source

FragmentUri(ulong)

Returns the URI of the written fragment with the input index. Applicable only to WRITE queries.

Declaration
public string FragmentUri(ulong idx)
Parameters
Type Name Description
ulong idx
Returns
Type Description
string
| Edit this page View Source

GetDefaultChannel()

Returns the query's default QueryChannel.

Declaration
public QueryChannel GetDefaultChannel()
Returns
Type Description
QueryChannel
| Edit this page View Source

GetField(string)

Gets information about a field in a query.

Declaration
public QueryField GetField(string name)
Parameters
Type Name Description
string name

The field's name.

Returns
Type Description
QueryField
| Edit this page View Source

GetResultDataBytes(string)

Returns the number of bytes read into the data buffer of an attribute or dimension.

Declaration
public ulong GetResultDataBytes(string name)
Parameters
Type Name Description
string name

The name of the attribute or dimension.

Returns
Type Description
ulong

The number of elements read, or the number of bytes read if the data buffer had been assigned with an overload of the Query.UnsafeSetDataBuffer method.

Exceptions
Type Condition
KeyNotFoundException

No data buffer has been registered with name.

| Edit this page View Source

GetResultDataElements(string)

Returns the number of elements read into the data buffer of an attribute or dimension.

Declaration
public ulong GetResultDataElements(string name)
Parameters
Type Name Description
string name

The name of the attribute or dimension.

Returns
Type Description
ulong
Exceptions
Type Condition
KeyNotFoundException

No data buffer has been registered with name.

InvalidOperationException

The data buffer had been set with an overload of UnsafeSetDataBuffer.

| Edit this page View Source

GetResultOffsets(string)

Returns the number of offsets read into the offsets buffer of a variable-sized attribute or dimension.

Declaration
public ulong GetResultOffsets(string name)
Parameters
Type Name Description
string name

The name of the attribute or dimension.

Returns
Type Description
ulong
Exceptions
Type Condition
KeyNotFoundException

No offsets buffer has been registered with name.

| Edit this page View Source

GetResultValidities(string)

Returns the number of validity bytes read into the validity buffer of a nullable attribute.

Declaration
public ulong GetResultValidities(string name)
Parameters
Type Name Description
string name

The name of the attribute or dimension.

Returns
Type Description
ulong
Exceptions
Type Condition
KeyNotFoundException

No validity buffer has been registered with name.

| Edit this page View Source

GetStatusDetails()

Returns a QueryStatusDetails value describing this Query.

Declaration
public QueryStatusDetails GetStatusDetails()
Returns
Type Description
QueryStatusDetails
| Edit this page View Source

GetSubarray()

Creates a Subarray corresponding to this query.

Declaration
public Subarray GetSubarray()
Returns
Type Description
Subarray
| Edit this page View Source

HasResults()

Returns true if the query has results. Applicable only to read; false for write queries.

Declaration
public bool HasResults()
Returns
Type Description
bool
| Edit this page View Source

QueryLayout()

Sets the layout of the cells to be written or read.

Declaration
public LayoutType QueryLayout()
Returns
Type Description
LayoutType
| Edit this page View Source

QueryType()

Returns the query type (read or write).

Declaration
public QueryType QueryType()
Returns
Type Description
QueryType
| Edit this page View Source

ResultBufferElements()

Returns the number of elements read into result buffers from a read query.

Dictionary keyName of buffer used in call to SetDataBuffer<T>(string, T[]), SetOffsetsBuffer(string, ulong[]), or SetValidityBuffer(string, byte[]).
Tuple Item1Number of elements read by the query
Tuple Item2Number of offset elements read by the query or null if the buffer is not variable-sized.
Tuple Item3Number of validity bytes read by the query or null if the buffer is not nullable.
Declaration
public Dictionary<string, Tuple<ulong, ulong?, ulong?>> ResultBufferElements()
Returns
Type Description
Dictionary<string, Tuple<ulong, ulong?, ulong?>>

Dictionary mapping buffer name to number of results

Remarks

This method exhibits poor performance characteristics. Consider using GetResultDataElements(string), GetResultDataBytes(string), GetResultOffsets(string) and GetResultValidities(string) instead.

| Edit this page View Source

SetCondition(QueryCondition)

Sets the query condition to be applied on a read.

Declaration
public void SetCondition(QueryCondition condition)
Parameters
Type Name Description
QueryCondition condition
| Edit this page View Source

SetConfig(Config)

Set config.

Declaration
public void SetConfig(Config config)
Parameters
Type Name Description
Config config
| Edit this page View Source

SetDataBuffer<T>(string, Memory<T>)

Sets the data buffer for an attribute or dimension to a Memory<T>.

Declaration
public void SetDataBuffer<T>(string name, Memory<T> data) where T : struct
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

Memory<T> data

An Memory<T> where the data will be read or written.

Type Parameters
Name Description
T

The buffer's type.

Exceptions
Type Condition
ArgumentException

data is empty or T does not match the excepted data type.

| Edit this page View Source

SetDataBuffer<T>(string, T*, ulong)

Sets the data buffer for an attribute or dimension to an unmanaged memory buffer.

Declaration
public void SetDataBuffer<T>(string name, T* data, ulong size) where T : struct
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

T* data

A pointer to the memory buffer.

ulong size

The buffer's size in T values.

Type Parameters
Name Description
T
Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

size is zero or T does not match the excepted data type.

| Edit this page View Source

SetDataBuffer<T>(string, T[])

Sets the data buffer for an attribute or dimension to an array.

Declaration
public void SetDataBuffer<T>(string name, T[] data) where T : struct
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

T[] data

An array where the data will be read or written.

Type Parameters
Name Description
T

The buffer's type.

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

data is empty or T does not match the excepted data type.

| Edit this page View Source

SetDataReadOnlyBuffer<T>(string, ReadOnlyMemory<T>)

Sets the data buffer for an attribute or dimension to a ReadOnlyMemory<T>. Not supported for Read queries.

Declaration
public void SetDataReadOnlyBuffer<T>(string name, ReadOnlyMemory<T> data) where T : struct
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

ReadOnlyMemory<T> data

A ReadOnlyMemory<T> from where the data will be written.

Type Parameters
Name Description
T

The buffer's type.

Exceptions
Type Condition
ArgumentException

data is empty or T does not match the excepted data type.

NotSupportedException

The query's type is Read

| Edit this page View Source

SetLayout(LayoutType)

Sets the layout of the cells to be written or read.

Declaration
public void SetLayout(LayoutType layouttype)
Parameters
Type Name Description
LayoutType layouttype
| Edit this page View Source

SetOffsetsBuffer(string, Memory<ulong>)

Sets the offsets buffer for a variable-sized attribute or dimension to a Memory<T>.

Declaration
public void SetOffsetsBuffer(string name, Memory<ulong> data)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

Memory<ulong> data

A Memory<T> where the offsets will be read or written.

Exceptions
Type Condition
ArgumentException

data is empty.

| Edit this page View Source

SetOffsetsBuffer(string, ulong*, ulong)

Sets the offsets buffer for a variable-sized attribute or dimension to an unmanaged memory buffer.

Declaration
public void SetOffsetsBuffer(string name, ulong* data, ulong size)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

ulong* data

A pointer to the memory buffer.

ulong size

The buffer's size in 64-bit integers.

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

size is zero.

| Edit this page View Source

SetOffsetsBuffer(string, ulong[])

Sets the offsets buffer for a variable-sized attribute or dimension to an array.

Declaration
public void SetOffsetsBuffer(string name, ulong[] data)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

ulong[] data

An array where the offsets will be read or written.

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

data is empty.

| Edit this page View Source

SetOffsetsReadOnlyBuffer(string, ReadOnlyMemory<ulong>)

Sets the offsets buffer for a variable-sized attribute or dimension to a ReadOnlyMemory<T>. Not supported for Read queries.

Declaration
public void SetOffsetsReadOnlyBuffer(string name, ReadOnlyMemory<ulong> data)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

ReadOnlyMemory<ulong> data

A ReadOnlyMemory<T> from where the offsets will be written.

Exceptions
Type Condition
ArgumentException

data is empty.

NotSupportedException

The query's type is Read

| Edit this page View Source

SetSubarray(Subarray)

Indicates that the query will write to or read from a Subarray, and provides the appropriate information.

Declaration
public void SetSubarray(Subarray subarray)
Parameters
Type Name Description
Subarray subarray

The subarray to use.

| Edit this page View Source

SetValidityBuffer(string, byte*, ulong)

Sets the validity buffer for a nullable attribute to an unmanaged memory buffer.

Declaration
public void SetValidityBuffer(string name, byte* data, ulong size)
Parameters
Type Name Description
string name

The name of the attribute.

byte* data

A pointer to the memory buffer.

ulong size

The buffer's size.

Remarks

Each value corresponds to whether an element exists (1) or not (0).

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

size is zero.

| Edit this page View Source

SetValidityBuffer(string, byte[])

Sets the validity buffer for a nullable attribute to an array.

Declaration
public void SetValidityBuffer(string name, byte[] data)
Parameters
Type Name Description
string name

The name of the attribute.

byte[] data

An array where the validities will be read or written.

Remarks

Each value corresponds to whether an element exists (1) or not (0).

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

data is empty.

| Edit this page View Source

SetValidityBuffer(string, Memory<byte>)

Sets the validity buffer for a nullable attribute to a Memory<T>.

Declaration
public void SetValidityBuffer(string name, Memory<byte> data)
Parameters
Type Name Description
string name

The name of the attribute.

Memory<byte> data

A Memory<T> where the validities will be read or written.

Remarks

Each value corresponds to whether an element exists (1) or not (0).

Exceptions
Type Condition
ArgumentException

data is empty.

| Edit this page View Source

SetValidityReadOnlyBuffer(string, ReadOnlyMemory<byte>)

Sets the validity buffer for a nullable attribute to a ReadOnlyMemory<T>. Not supported for Read queries.

Declaration
public void SetValidityReadOnlyBuffer(string name, ReadOnlyMemory<byte> data)
Parameters
Type Name Description
string name

The name of the attribute.

ReadOnlyMemory<byte> data

A ReadOnlyMemory<T> from where the validities will be written.

Remarks

Each value corresponds to whether an element exists (1) or not (0).

Exceptions
Type Condition
ArgumentException

data is empty.

NotSupportedException

The query's type is Read

| Edit this page View Source

Stats()

Gets a JSON string with statistics about the query.

Declaration
public string Stats()
Returns
Type Description
string
| Edit this page View Source

Status()

Returns the query status.

Declaration
public QueryStatus Status()
Returns
Type Description
QueryStatus
| Edit this page View Source

Submit()

Submits the query. Call will block until query is complete.

Declaration
public QueryStatus Submit()
Returns
Type Description
QueryStatus
| Edit this page View Source

SubmitAndFinalize()

Submits and finalizes the query.

Declaration
public void SubmitAndFinalize()
See Also
Submit()
FinalizeQuery()
| Edit this page View Source

UnsafeSetDataBuffer(string, MemoryHandle, ulong)

Sets the data buffer for an attribute or dimension to a pinned memory buffer pointed by a MemoryHandle. This method does not perform type validation.

Declaration
public void UnsafeSetDataBuffer(string name, MemoryHandle memoryHandle, ulong byteSize)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

MemoryHandle memoryHandle

A MemoryHandle pointing to the buffer.

ulong byteSize

The buffer's size in bytes.

Remarks

After calling this method, user code must not use memoryHandle; its ownership is transferred to this Query object.

memoryHandle will be disposed when one of the following happens:

  • The Dispose() method is called.
  • The buffer for name is reassigned through subsequent calls to this method.
  • This method call throws an exception.
Exceptions
Type Condition
ArgumentException

byteSize is zero.

| Edit this page View Source

UnsafeSetDataBuffer(string, Memory<byte>)

Sets the data buffer for an attribute or dimension to a byte buffer without performing type validation.

Declaration
public void UnsafeSetDataBuffer(string name, Memory<byte> data)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

Memory<byte> data

A Memory<T> of bytes pointing to the buffer.

Exceptions
Type Condition
ArgumentException

data is empty.

| Edit this page View Source

UnsafeSetDataBuffer(string, void*, ulong)

Sets the data buffer for an attribute or dimension to an unmanaged memory buffer without performing type validation.

Declaration
public void UnsafeSetDataBuffer(string name, void* data, ulong byteSize)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

void* data

A pointer to the memory buffer.

ulong byteSize

The buffer's size in bytes.

Exceptions
Type Condition
ArgumentNullException

data is null.

ArgumentException

byteSize is zero.

| Edit this page View Source

UnsafeSetDataReadOnlyBuffer(string, ReadOnlyMemory<byte>)

Sets the data buffer for an attribute or dimension to a read-only byte buffer without performing type validation. Not supported for Read queries.

Declaration
public void UnsafeSetDataReadOnlyBuffer(string name, ReadOnlyMemory<byte> data)
Parameters
Type Name Description
string name

The name of the attribute or the dimension.

ReadOnlyMemory<byte> data

A ReadOnlyMemory<T> of bytes pointing to the buffer.

Exceptions
Type Condition
ArgumentException

data is empty.

NotSupportedException

The query's type is Read

Implements

IDisposable
  • Edit this page
  • View Source
In this article
Back to top Copyright © 2018-2023 TileDB Inc.