Builds scan tokens for a table.
More...
#include <client.h>
Builds scan tokens for a table.
- Note
- This class is not thread-safe.
◆ KuduScanTokenBuilder()
kudu::client::KuduScanTokenBuilder::KuduScanTokenBuilder |
( |
KuduTable * | table | ) |
|
|
explicit |
Construct an instance of the class.
- Parameters
-
[in] | table | The table the tokens should scan. The given object must remain valid for the lifetime of the builder, and the tokens which it builds. |
◆ AddConjunctPredicate()
Add a predicate for the scan.
- Parameters
-
[in] | pred | Predicate 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()
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] | key | Lower bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter. |
- Returns
- Operation result status.
◆ AddUpperBound()
Add an upper bound (exclusive) primary key.
If any bound is already added, this bound is intersected with that one.
- Parameters
-
[in] | key | Upper bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter. |
- Returns
- Operation result status.
◆ Build()
Build the set of scan tokens.
The builder may be reused after this call.
- Parameters
-
[out] | tokens | Result 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_metadata | true, 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_metadata | true, 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_size | Batch 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_blocks | If 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_indexes | Column 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_names | Column names for the projection. |
- Returns
- Operation result status.
◆ SetQueryId()
Status kudu::client::KuduScanTokenBuilder::SetQueryId |
( |
const std::string & | query_id | ) |
|
Set a query id for the scan to trace the whole process. Query id is set by the user or generated automatically. It is used to trace the whole query process for for troubleshooting and debugging.
- Parameters
-
[in] | query_id | A query id to identify a query. |
- Returns
- Operation result status.
◆ SetReadMode()
Set the ReadMode. Default is READ_LATEST
.
- Parameters
-
[in] | read_mode | Read mode to set. |
- Returns
- Operation result status.
◆ SetSelection()
Set the replica selection policy while scanning.
- Parameters
-
[in] | selection | Selection 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_micros | Timestamp 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_timestamp | Timestamp 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_bytes | The 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] | millis | Timeout to set (in milliseconds). Must be greater than 0. |
- Returns
- Operation result status.
The documentation for this class was generated from the following file: