Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
google::cloud::spanner::QueryPartition Class Reference

The QueryPartition class is a regular type that represents a single slice of a parallel SQL read. More...

#include <google/cloud/spanner/query_partition.h>

Public Member Functions

 QueryPartition ()=default
 Constructs an instance of QueryPartition that is not associated with any SqlStatement. More...
 
SqlStatement const & sql_statement () const
 Accessor for the SqlStatement associated with this QueryPartition. More...
 
Copy and move
 QueryPartition (QueryPartition const &)=default
 
 QueryPartition (QueryPartition &&)=default
 
QueryPartitionoperator= (QueryPartition const &)=default
 
QueryPartitionoperator= (QueryPartition &&)=default
 

Friends

StatusOr< std::string > SerializeQueryPartition (QueryPartition const &query_partition)
 Serializes an instance of QueryPartition to a string of bytes. More...
 
StatusOr< QueryPartitionDeserializeQueryPartition (std::string const &serialized_query_partition)
 Deserializes the provided string into a QueryPartition. More...
 
Equality
bool operator== (QueryPartition const &a, QueryPartition const &b)
 
bool operator!= (QueryPartition const &a, QueryPartition const &b)
 

Detailed Description

The QueryPartition class is a regular type that represents a single slice of a parallel SQL read.

Instances of QueryPartition are created by Client::PartitionQuery. Once created, QueryPartition objects can be serialized, transmitted to separate processes, and used to read data in parallel using Client::ExecuteQuery. If data_boost is set, those requests will be executed using the independent compute resources of Cloud Spanner Data Boost.

Constructor & Destructor Documentation

◆ QueryPartition() [1/3]

google::cloud::spanner::QueryPartition::QueryPartition ( )
default

Constructs an instance of QueryPartition that is not associated with any SqlStatement.

◆ QueryPartition() [2/3]

google::cloud::spanner::QueryPartition::QueryPartition ( QueryPartition const &  )
default

◆ QueryPartition() [3/3]

google::cloud::spanner::QueryPartition::QueryPartition ( QueryPartition &&  )
default

Member Function Documentation

◆ operator=() [1/2]

QueryPartition & google::cloud::spanner::QueryPartition::operator= ( QueryPartition &&  )
default

◆ operator=() [2/2]

QueryPartition & google::cloud::spanner::QueryPartition::operator= ( QueryPartition const &  )
default

◆ sql_statement()

SqlStatement const & google::cloud::spanner::QueryPartition::sql_statement ( ) const
inline

Accessor for the SqlStatement associated with this QueryPartition.

Friends And Related Function Documentation

◆ DeserializeQueryPartition

StatusOr< QueryPartition > DeserializeQueryPartition ( std::string const &  serialized_query_partition)
friend

Deserializes the provided string into a QueryPartition.

The serialized_query_partition argument must be a string that was previously returned by a call to SerializeQueryPartition().

Note
The serialized string may contain NUL and other non-printable characters. Therefore, callers should avoid formatted IO functions that may incorrectly reformat the string data.
Parameters
serialized_query_partition
Example
ReceiveQueryPartitionFromRemoteMachine() {
std::string serialized_partition = Receive();
serialized_partition);
}
StatusOr< QueryPartition > DeserializeQueryPartition(std::string const &serialized_query_partition)
Deserializes the provided string into a QueryPartition.

◆ operator!=

bool operator!= ( QueryPartition const &  a,
QueryPartition const &  b 
)
friend

◆ operator==

bool operator== ( QueryPartition const &  a,
QueryPartition const &  b 
)
friend

◆ SerializeQueryPartition

StatusOr< std::string > SerializeQueryPartition ( QueryPartition const &  query_partition)
friend

Serializes an instance of QueryPartition to a string of bytes.

The serialized string of bytes is suitable for writing to disk or transmission to another process.

Note
The serialized string may contain NUL and other non-printable characters. Therefore, callers should avoid formatted IO functions that may incorrectly reformat the string data.
Parameters
query_partition- instance to be serialized.
Example
namespace spanner = ::google::cloud::spanner;
google::cloud::StatusOr<std::string> serialized_partition =
if (!serialized_partition) throw std::move(serialized_partition).status();
std::string const& bytes = *serialized_partition;
// `bytes` contains the serialized data, which may contain NULs and other
// non-printable characters.
SendBinaryStringData(bytes);
StatusOr< std::string > SerializeQueryPartition(QueryPartition const &query_partition)
Serializes an instance of QueryPartition to a string of bytes.