Skip to main content
pub struct RecordRetriever<R = GenericRecord>  /* private fields */ 

Object that permits efficient retrieval of records from GPUdb, with support for multi-head access.

RecordRetriever instances are thread safe and may be used from any number of tasks simultaneously. Records are returned as R: GenericRecords by default, or any type serde can deserialize (see RetrievedRecord).

Implementations

Source

pub async fn new( kinetica: Arc<Kinetica>, table_name: &str, record_type: Arc<Type>, ) -> Result<Self, KineticaError>

Creates a retriever of the records of table_name, which are of record_type, returning them as GenericRecords.

The worker list is derived from the connection’s own worker addresses, and records are retrieved with no options.

Source

pub async fn with_retriever_options( kinetica: Arc<Kinetica>, table_name: &str, record_type: Arc<Type>, options: RecordRetrieverOptions, ) -> Result<Self, KineticaError>

Creates a retriever passing options to its retrievals.

Source

pub async fn with_workers( kinetica: Arc<Kinetica>, table_name: &str, record_type: Arc<Type>, workers: Option<WorkerList>, ) -> Result<Self, KineticaError>

Creates a retriever with the given worker list.

None derives the list from the connection’s own worker addresses, which is the default; an empty list (WorkerList::empty) declines multi-head for this retriever.

Source

pub async fn with_options( kinetica: Arc<Kinetica>, table_name: &str, record_type: Arc<Type>, workers: Option<WorkerList>, options: Option<HashMap<String, String>>, ) -> Result<Self, KineticaError>

Creates a retriever with the given worker list and options.

Source

pub async fn new_typed( kinetica: Arc<Kinetica>, table_name: &str, record_type: Arc<Type>, workers: Option<WorkerList>, options: Option<HashMap<String, String>>, ) -> Result<Self, KineticaError>

Creates a retriever returning records decoded as T, from the Avro schema of record_type. workers and options are as for RecordRetriever::with_options.

Source

pub fn kinetica(&self) -> &Arc<Kinetica>

Gets the connection from which records will be retrieved.

Source

pub fn table_name(&self) -> &str

Gets the name of the table from which records will be retrieved.

Returns whether this RecordRetriever is using the head rank for simple record fetching (not utilizing the server’s key lookup feature).

Returns whether this RecordRetriever is using worker ranks for key lookups.

Gets the options currently used for the retriever methods.

Source

pub fn set_options(&self, options: HashMap<String, String>)

Sets the options to be used for the retriever methods.

Source

pub async fn get_by_key( &self, key_values: &[ShardKeyValue<’_>], expression: Option<&str>, ) -> Result<GetRecordsResponse<R>, KineticaError>

Retrieves records with the given key values and filter expression.

This method operates in four modes, depending on the parameters passed:

  • key values only: attempts a direct-to-rank lookup for records matching the given key values
  • key values and expression: attempts a direct-to-rank lookup for records matching the given key values, filtering them by the given expression
  • expression only: requests, via the head rank, all records in the table matching the given filter expression
  • neither: retrieves all records from the table via the head rank
  • key_values - The key values to use for the lookup, one per key column in key order, or none; these must correspond to either the explicit or implicit shard key for sharded tables or the primary key of replicated tables. Each must be of a type its column takes (see RecordKeyBuilder::build_expression).
  • expression - A filter expression that will be applied to the data requested by the key values; if no key values are specified this filter will be applied to all of the data in the target table

The requested records, decoded.

Source

pub async fn get_by_key_with_offset( &self, key_values: &[ShardKeyValue<’_>], expression: Option<&str>, offset: i64, ) -> Result<GetRecordsResponse<R>, KineticaError>

Retrieves records with the given key values and filter expression, starting from an offset.

  • key_values - The key values to use for the lookup, or none
  • expression - A filter expression
  • offset - Offset of the record(s) within the result set to return

The requested records, decoded.

Source

pub async fn get_columns_by_key( &self, columns: Vec<String>, key_values: &[ShardKeyValue<’_>], expression: Option<&str>, ) -> Result<GetRecordsByColumnResponse, KineticaError>

Retrieves specific columns with the given key values and filter expression.

  • columns - The requested columns (which can include expressions). May use “*” for all columns.
  • key_values - The key values to use for the lookup, or none
  • expression - A filter expression

The requested records, typed by the response.

Source

pub async fn get_columns_by_key_with_offset( &self, columns: Vec<String>, key_values: &[ShardKeyValue<’_>], expression: Option<&str>, offset: i64, ) -> Result<GetRecordsByColumnResponse, KineticaError>

Retrieves specific columns with the given key values and filter expression, starting from an offset.

  • columns - The requested columns
  • key_values - The key values to use for the lookup, or none
  • expression - A filter expression
  • offset - Offset of the record(s) within the result set to return

The requested records, typed by the response.