Kinetica   C#   API  Version 7.2.3.1
GenericRecordRetriever Class Reference

Object that permits efficient retrieval of records from GPUdb using GenericRecord More...

+ Collaboration diagram for GenericRecordRetriever:

Public Member Functions

 GenericRecordRetriever (Kinetica kdb, string tableName, KineticaType ktype, WorkerList? workers=null)
 Create a GenericRecordRetriever for the given table. More...
 
ExecuteSqlResponse GetRecordsByKey (IDictionary< string, object?> keyValues, string? expression=null, IList< string >? columns=null, long offset=0, long limit=-9999)
 Retrieves records for a given shard key using SQL with fast index lookup. More...
 
ExecuteSqlResponse GetRecordsByExpression (string whereExpression, IList< string >? columns=null, long offset=0, long limit=-9999)
 Retrieves records using a SQL WHERE clause expression with fast index lookup optimization. More...
 
bool HasAllShardKeyValues (IDictionary< string, object?> keyValues)
 Checks if the given key values contain all required shard key columns. More...
 
int GetWorkerIndexForKey (IDictionary< string, object?> keyValues)
 Computes the worker index that would handle records with the given key values. More...
 

Public Attributes

Kinetica KineticaDB => _kinetica
 Gets the Kinetica connection. More...
 
string TableName => _tableName
 Gets the table name. More...
 
KineticaType KType => _ktype
 Gets the KineticaType for the table. More...
 
int NumClusterSwitches => _numClusterSwitches
 Gets the number of cluster switches due to HA failover. More...
 
int HARingSize => _dbHaRingSize
 Gets the HA ring size. More...
 
bool MultiHeadEnabled => _multiHeadEnabled
 Gets whether multi-head retrieval is enabled. More...
 
IList< string > ShardKeyColumnNames => _shardKeyBuilder?.GetRoutingColumnNames() ?? new List<string>()
 Gets the shard key column names, or empty if table is not sharded. More...
 

Detailed Description

Object that permits efficient retrieval of records from GPUdb using GenericRecord

and dictionary-based records, with support for multi-head access and HA failover.

This is used by the ADO.NET driver for key lookup operations where we don't have strongly-typed record classes. It uses SQL execution with optimized expression building based on shard keys.

GenericRecordRetriever instances are thread safe and may be used from any number of threads simultaneously.

Definition at line 18 of file GenericRecordRetriever.cs.

Constructor & Destructor Documentation

◆ GenericRecordRetriever()

GenericRecordRetriever.GenericRecordRetriever ( Kinetica  kdb,
string  tableName,
KineticaType  ktype,
WorkerList workers = null 
)
inline

Create a GenericRecordRetriever for the given table.

Parameters
kdbThe Kinetica connection.
tableNameThe table name to retrieve from.
ktypeThe KineticaType for the table.
workersOptional worker list for multi-head retrieval.

Definition at line 95 of file GenericRecordRetriever.cs.

Member Function Documentation

◆ GetRecordsByExpression()

ExecuteSqlResponse GenericRecordRetriever.GetRecordsByExpression ( string  whereExpression,
IList< string >?  columns = null,
long  offset = 0,
long  limit = -9999 
)
inline

Retrieves records using a SQL WHERE clause expression with fast index lookup optimization.

Parameters
whereExpressionSQL WHERE clause expression.
columnsOptional list of columns to retrieve. Null means all columns.
offsetStarting record offset (default 0).
limitMaximum number of records to retrieve (default -9999 means no limit).
Returns
The ExecuteSqlResponse containing the results.

Definition at line 409 of file GenericRecordRetriever.cs.

◆ GetRecordsByKey()

ExecuteSqlResponse GenericRecordRetriever.GetRecordsByKey ( IDictionary< string, object?>  keyValues,
string?  expression = null,
IList< string >?  columns = null,
long  offset = 0,
long  limit = -9999 
)
inline

Retrieves records for a given shard key using SQL with fast index lookup.

All records matching the key and satisfying the optional additional expression will be returned, up to the specified limit.

Parameters
keyValuesDictionary of column name -> value for the shard key columns.
expressionAn optional additional filter expression.
columnsOptional list of columns to retrieve. Null means all columns (SELECT *).
offsetStarting record offset (default 0).
limitMaximum number of records to retrieve (default -9999 means no limit).
Returns
The ExecuteSqlResponse containing the results.

Definition at line 337 of file GenericRecordRetriever.cs.

◆ GetWorkerIndexForKey()

int GenericRecordRetriever.GetWorkerIndexForKey ( IDictionary< string, object?>  keyValues)
inline

Computes the worker index that would handle records with the given key values.

This is useful for understanding data distribution.

Parameters
keyValuesDictionary of column name -> value for the shard key columns.
Returns
The worker index (0-based), or -1 if routing is not possible.

Definition at line 451 of file GenericRecordRetriever.cs.

◆ HasAllShardKeyValues()

bool GenericRecordRetriever.HasAllShardKeyValues ( IDictionary< string, object?>  keyValues)
inline

Checks if the given key values contain all required shard key columns.

Parameters
keyValuesDictionary of column name -> value.
Returns
True if all shard key columns are present.

Definition at line 431 of file GenericRecordRetriever.cs.

Member Data Documentation

◆ HARingSize

int GenericRecordRetriever.HARingSize => _dbHaRingSize

Gets the HA ring size.

Definition at line 72 of file GenericRecordRetriever.cs.

◆ KineticaDB

Kinetica GenericRecordRetriever.KineticaDB => _kinetica

Gets the Kinetica connection.

Definition at line 52 of file GenericRecordRetriever.cs.

◆ KType

KineticaType GenericRecordRetriever.KType => _ktype

Gets the KineticaType for the table.

Definition at line 62 of file GenericRecordRetriever.cs.

◆ MultiHeadEnabled

bool GenericRecordRetriever.MultiHeadEnabled => _multiHeadEnabled

Gets whether multi-head retrieval is enabled.

Definition at line 77 of file GenericRecordRetriever.cs.

◆ NumClusterSwitches

int GenericRecordRetriever.NumClusterSwitches => _numClusterSwitches

Gets the number of cluster switches due to HA failover.

Definition at line 67 of file GenericRecordRetriever.cs.

◆ ShardKeyColumnNames

IList<string> GenericRecordRetriever.ShardKeyColumnNames => _shardKeyBuilder?.GetRoutingColumnNames() ?? new List<string>()

Gets the shard key column names, or empty if table is not sharded.

Definition at line 82 of file GenericRecordRetriever.cs.

◆ TableName

string GenericRecordRetriever.TableName => _tableName

Gets the table name.

Definition at line 57 of file GenericRecordRetriever.cs.


The documentation for this class was generated from the following file: