Kudu C++ client API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kudu::client::KuduScanTokenBuilder Class Reference

Builds scan tokens for a table. More...

#include <client.h>

Public Member Functions

 KuduScanTokenBuilder (KuduTable *table)
 
Status SetProjectedColumnNames (const std::vector< std::string > &col_names) WARN_UNUSED_RESULT
 
Status SetProjectedColumnIndexes (const std::vector< int > &col_indexes) WARN_UNUSED_RESULT
 
Status AddConjunctPredicate (KuduPredicate *pred) WARN_UNUSED_RESULT
 
Status AddLowerBound (const KuduPartialRow &key) WARN_UNUSED_RESULT
 
Status AddUpperBound (const KuduPartialRow &key) WARN_UNUSED_RESULT
 
Status SetCacheBlocks (bool cache_blocks) WARN_UNUSED_RESULT
 
Status SetBatchSizeBytes (uint32_t batch_size) WARN_UNUSED_RESULT
 
Status SetSelection (KuduClient::ReplicaSelection selection) WARN_UNUSED_RESULT
 
Status SetReadMode (KuduScanner::ReadMode read_mode) WARN_UNUSED_RESULT
 
Status SetFaultTolerant () WARN_UNUSED_RESULT
 
Status SetSnapshotMicros (uint64_t snapshot_timestamp_micros) WARN_UNUSED_RESULT
 
Status SetSnapshotRaw (uint64_t snapshot_timestamp) WARN_UNUSED_RESULT
 
Status SetTimeoutMillis (int millis) WARN_UNUSED_RESULT
 
Status IncludeTableMetadata (bool include_metadata) WARN_UNUSED_RESULT
 
Status IncludeTabletMetadata (bool include_metadata) WARN_UNUSED_RESULT
 
void SetSplitSizeBytes (uint64_t split_size_bytes)
 
Status Build (std::vector< KuduScanToken * > *tokens) WARN_UNUSED_RESULT
 

Detailed Description

Builds scan tokens for a table.

Note
This class is not thread-safe.

Constructor & Destructor Documentation

◆ KuduScanTokenBuilder()

kudu::client::KuduScanTokenBuilder::KuduScanTokenBuilder ( KuduTable table)
explicit

Construct an instance of the class.

Parameters
[in]tableThe table the tokens should scan. The given object must remain valid for the lifetime of the builder, and the tokens which it builds.

Member Function Documentation

◆ AddConjunctPredicate()

Status kudu::client::KuduScanTokenBuilder::AddConjunctPredicate ( KuduPredicate pred)

Add a predicate for the scan.

Parameters
[in]predPredicate to set. The KuduScanTokenBuilder instance takes ownership of the parameter even if a bad Status is returned. Multiple calls of this method make the specified set of predicates work in conjunction, i.e. all predicates must be true for a row to be returned.
Returns
Operation result status.

◆ AddLowerBound()

Status kudu::client::KuduScanTokenBuilder::AddLowerBound ( const KuduPartialRow key)

Add a lower bound (inclusive) primary key for the scan.

If any bound is already added, this bound is intersected with that one.

Parameters
[in]keyLower bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter.
Returns
Operation result status.

◆ AddUpperBound()

Status kudu::client::KuduScanTokenBuilder::AddUpperBound ( const KuduPartialRow key)

Add an upper bound (exclusive) primary key.

If any bound is already added, this bound is intersected with that one.

Parameters
[in]keyUpper bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter.
Returns
Operation result status.

◆ Build()

Status kudu::client::KuduScanTokenBuilder::Build ( std::vector< KuduScanToken * > *  tokens)

Build the set of scan tokens.

The builder may be reused after this call.

Parameters
[out]tokensResult set of tokens. The caller takes ownership of the container elements.
Returns
Operation result status.

◆ IncludeTableMetadata()

Status kudu::client::KuduScanTokenBuilder::IncludeTableMetadata ( bool  include_metadata)

If the table metadata is included on the scan token a GetTableSchema RPC call to the master can be avoided when deserializing each scan token into a scanner.

Parameters
[in]include_metadatatrue, if table metadata should be included.
Returns
Operation result status.

◆ IncludeTabletMetadata()

Status kudu::client::KuduScanTokenBuilder::IncludeTabletMetadata ( bool  include_metadata)

If the tablet metadata is included on the scan token a GetTableLocations RPC call to the master can be avoided when scanning with a scanner constructed from a scan token.

Parameters
[in]include_metadatatrue, if table metadata should be included.
Returns
Operation result status.

◆ SetBatchSizeBytes()

Status kudu::client::KuduScanTokenBuilder::SetBatchSizeBytes ( uint32_t  batch_size)

Set the hint for the size of the next batch in bytes.

Parameters
[in]batch_sizeBatch size to set (in bytes). If set to 0, the first call to the tablet server won't return data.
Returns
Operation result status.

◆ SetCacheBlocks()

Status kudu::client::KuduScanTokenBuilder::SetCacheBlocks ( bool  cache_blocks)

Set the block caching policy.

Parameters
[in]cache_blocksIf true, scanned data blocks will be cached in memory and made available for future scans. Default is true.
Returns
Operation result status.

◆ SetFaultTolerant()

Status kudu::client::KuduScanTokenBuilder::SetFaultTolerant ( )

Make scans resumable at another tablet server if current server fails.

Scans are by default non fault-tolerant, and scans will fail if scanning an individual tablet fails (for example, if a tablet server crashes in the middle of a tablet scan). If this method is called, scans will be resumed at another tablet server in the case of failure.

Fault-tolerant scans typically have lower throughput than non fault-tolerant scans. Fault tolerant scans use READ_AT_SNAPSHOT mode: if no snapshot timestamp is provided, the server will pick one.

Returns
Operation result status.

◆ SetProjectedColumnIndexes()

Status kudu::client::KuduScanTokenBuilder::SetProjectedColumnIndexes ( const std::vector< int > &  col_indexes)

Set the column projection by passing the column indexes to read.

Set the column projection used for this scanner by passing the column indices to read. A call to this method overrides any previous call to SetProjectedColumnNames() or SetProjectedColumnIndexes().

Parameters
[in]col_indexesColumn indices for the projection.
Returns
Operation result status.

◆ SetProjectedColumnNames()

Status kudu::client::KuduScanTokenBuilder::SetProjectedColumnNames ( const std::vector< std::string > &  col_names)

Set the column projection by passing the column names to read.

Set the column projection used for this scanner by passing the column names to read. A call of this method overrides any previous call to SetProjectedColumnNames() or SetProjectedColumnIndexes().

Parameters
[in]col_namesColumn names for the projection.
Returns
Operation result status.

◆ SetReadMode()

Status kudu::client::KuduScanTokenBuilder::SetReadMode ( KuduScanner::ReadMode  read_mode)

Set the ReadMode. Default is READ_LATEST.

Parameters
[in]read_modeRead mode to set.
Returns
Operation result status.

◆ SetSelection()

Status kudu::client::KuduScanTokenBuilder::SetSelection ( KuduClient::ReplicaSelection  selection)

Set the replica selection policy while scanning.

Parameters
[in]selectionSelection policy to set.
Returns
Operation result status.
Todo:
Kill this in favor of a consistency-level-based API.

◆ SetSnapshotMicros()

Status kudu::client::KuduScanTokenBuilder::SetSnapshotMicros ( uint64_t  snapshot_timestamp_micros)

Set snapshot timestamp for scans in READ_AT_SNAPSHOT mode.

Parameters
[in]snapshot_timestamp_microsTimestamp to set in in microseconds since the Epoch.
Returns
Operation result status.

◆ SetSnapshotRaw()

Status kudu::client::KuduScanTokenBuilder::SetSnapshotRaw ( uint64_t  snapshot_timestamp)

Set snapshot timestamp for scans in READ_AT_SNAPSHOT mode (raw).

Note
This method is experimental and will either disappear or change in a future release.
Parameters
[in]snapshot_timestampTimestamp to set in raw encoded form (i.e. as returned by a previous call to a server).
Returns
Operation result status.

◆ SetSplitSizeBytes()

void kudu::client::KuduScanTokenBuilder::SetSplitSizeBytes ( uint64_t  split_size_bytes)

Set approximate data size (in bytes) for each key range that a single scan token is built for.

Parameters
[in]split_size_bytesThe approximate target size of the data to be retrieved per scan token. If set to 0 (and that's the default, unless explicitly set by calling this method), the key ranges of the scan tokens to be produced are determined by the table's partition schema, so a single token is built per single tablet. Also see KuduScanToken::setSplitSizeBytes in the Java client.

◆ SetTimeoutMillis()

Status kudu::client::KuduScanTokenBuilder::SetTimeoutMillis ( int  millis)

Set the maximum time that Open() and NextBatch() are allowed to take.

Parameters
[in]millisTimeout to set (in milliseconds). Must be greater than 0.
Returns
Operation result status.

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