Class Query
Represents a TileDB query object.
Implements
Namespace: TileDB.CSharp
Assembly: TileDB.CSharp.dll
Syntax
public sealed class Query : IDisposable
Constructors
| Edit this page View SourceQuery(Array)
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. |
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 SourceArray()
Returns the array of the query.
Declaration
public Array Array()
Returns
| Type | Description |
|---|---|
| Array |
Config()
Get config.
Declaration
public Config Config()
Returns
| Type | Description |
|---|---|
| Config |
Dispose()
Disposes this Query.
Declaration
public void Dispose()
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 |
FinalizeQuery()
Flushes all internal state of a query object and finalizes the query, only applicable to global layout writes.
Declaration
public void FinalizeQuery()
FragmentNum()
Returns the number of written fragments. Applicable only to WRITE queries.
Declaration
public uint FragmentNum()
Returns
| Type | Description |
|---|---|
| uint |
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> |
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 |
GetDefaultChannel()
Returns the query's default QueryChannel.
Declaration
public QueryChannel GetDefaultChannel()
Returns
| Type | Description |
|---|---|
| QueryChannel |
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 |
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 |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | No data buffer has
been registered with |
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 |
| InvalidOperationException | The data buffer had been
set with an overload of |
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 |
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 |
GetStatusDetails()
Returns a QueryStatusDetails value describing this Query.
Declaration
public QueryStatusDetails GetStatusDetails()
Returns
| Type | Description |
|---|---|
| QueryStatusDetails |
GetSubarray()
Creates a Subarray corresponding to this query.
Declaration
public Subarray GetSubarray()
Returns
| Type | Description |
|---|---|
| Subarray |
HasResults()
Returns true if the query has results. Applicable only to read; false for write queries.
Declaration
public bool HasResults()
Returns
| Type | Description |
|---|---|
| bool |
QueryLayout()
Sets the layout of the cells to be written or read.
Declaration
public LayoutType QueryLayout()
Returns
| Type | Description |
|---|---|
| LayoutType |
QueryType()
Returns the query type (read or write).
Declaration
public QueryType QueryType()
Returns
| Type | Description |
|---|---|
| QueryType |
ResultBufferElements()
Returns the number of elements read into result buffers from a read query.
| Dictionary key | Name of buffer used in call to SetDataBuffer<T>(string, T[]), SetOffsetsBuffer(string, ulong[]), or SetValidityBuffer(string, byte[]). |
| Tuple Item1 | Number of elements read by the query |
| Tuple Item2 | Number of offset elements read by the query or null if the buffer is not variable-sized. |
| Tuple Item3 | Number 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.
SetCondition(QueryCondition)
Sets the query condition to be applied on a read.
Declaration
public void SetCondition(QueryCondition condition)
Parameters
| Type | Name | Description |
|---|---|---|
| QueryCondition | condition |
SetConfig(Config)
Set config.
Declaration
public void SetConfig(Config config)
Parameters
| Type | Name | Description |
|---|---|---|
| Config | config |
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 |
|
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 |
Type Parameters
| Name | Description |
|---|---|
| T |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
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 |
|
| ArgumentException |
|
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 |
|
| NotSupportedException | The query's type is Read |
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 |
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 |
|
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 |
|
| ArgumentException |
|
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 |
|
| ArgumentException |
|
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 |
|
| NotSupportedException | The query's type is Read |
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. |
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 |
|
| ArgumentException |
|
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 |
|
| ArgumentException |
|
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 |
|
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 |
|
| NotSupportedException | The query's type is Read |
Stats()
Gets a JSON string with statistics about the query.
Declaration
public string Stats()
Returns
| Type | Description |
|---|---|
| string |
Status()
Returns the query status.
Declaration
public QueryStatus Status()
Returns
| Type | Description |
|---|---|
| QueryStatus |
Submit()
Submits the query. Call will block until query is complete.
Declaration
public QueryStatus Submit()
Returns
| Type | Description |
|---|---|
| QueryStatus |
SubmitAndFinalize()
Submits and finalizes the query.
Declaration
public void SubmitAndFinalize()
See Also
| Edit this page View SourceUnsafeSetDataBuffer(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
nameis reassigned through subsequent calls to this method. - This method call throws an exception.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
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 |
|
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 |
|
| ArgumentException |
|
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 |
|
| NotSupportedException | The query's type is Read |