Google Cloud Spanner C++ Client  1.32.1
A C++ Client Library for Google Cloud Spanner
Public Member Functions | Friends | List of all members
google::cloud::spanner::v1::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

class QueryPartitionTester
 
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::PartitionSql. Once created, QueryPartition objects can be serialized, transmitted to separate process, and used to read data in parallel using Client::ExecuteQuery.

Definition at line 86 of file query_partition.h.

Constructor & Destructor Documentation

◆ QueryPartition() [1/3]

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

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

◆ QueryPartition() [2/3]

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

◆ QueryPartition() [3/3]

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

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ sql_statement()

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

Accessor for the SqlStatement associated with this QueryPartition.

Definition at line 105 of file query_partition.h.

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
google::cloud::StatusOr<google::cloud::spanner::QueryPartition>
ReceiveQueryPartitionFromRemoteMachine() {
std::string serialized_partition = Receive();
serialized_partition);
}
StatusOr< QueryPartition > DeserializeQueryPartition(std::string const &serialized_query_partition)
Deserializes the provided string into a QueryPartition.

Definition at line 71 of file query_partition.cc.

◆ operator!=

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

Definition at line 110 of file query_partition.h.

◆ operator==

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

Definition at line 34 of file query_partition.cc.

◆ QueryPartitionTester

friend class QueryPartitionTester
friend

Definition at line 116 of file query_partition.h.

◆ 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::runtime_error(serialized_partition.status().message());
}
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.
Contains all the Cloud Spanner C++ client types and functions.
Definition: backup.cc:21

Definition at line 42 of file query_partition.cc.