Class ProfileQueryResult (2.28.0)

Represents the stream of Rows and profile stats returned from spanner::Client::ProfileQuery().

This is a range defined by the Input Iterators returned from its begin() and end() members. Callers may directly iterate the ProfileQueryResult instance, which will return a sequence of StatusOr<Row> objects.

For convenience, callers may wrap instances in a StreamOf<std::tuple<...>> object, which will automatically parse each Row into a std::tuple with the specified types.

Example:
  namespace spanner = ::google::cloud::spanner;
  spanner::SqlStatement select(
      "SELECT AlbumId, AlbumTitle, MarketingBudget"
      " FROM Albums"
      " WHERE AlbumTitle >= 'Aardvark' AND AlbumTitle < 'Goo'");
  auto profile_query_result = client.ProfileQuery(std::move(select));
  for (auto& row : profile_query_result) {
    if (!row) throw std::move(row).status();
    // Discard rows for brevity in this example.
  }

  // Stats are only available after all rows from the result have been read.
  auto execution_stats = profile_query_result.ExecutionStats();
  if (execution_stats) {
    for (auto const& stat : *execution_stats) {
      std::cout << stat.first << ":\t" << stat.second << "\n";
    }
  }

Constructors

ProfileQueryResult()

ProfileQueryResult(std::unique_ptr< ResultSourceInterface >)

Parameter
Name Description
source std::unique_ptr< ResultSourceInterface >

ProfileQueryResult(ProfileQueryResult &&)

Parameter
Name Description
ProfileQueryResult &&

Operators

operator=(ProfileQueryResult &&)

Parameter
Name Description
ProfileQueryResult &&
Returns
Type Description
ProfileQueryResult &

Functions

begin()

Returns a RowStreamIterator defining the beginning of this result set.

Returns
Type Description
RowStreamIterator

end()

Returns a RowStreamIterator defining the end of this result set.

Returns
Type Description
RowStreamIterator

ReadTimestamp() const

Retrieves the timestamp at which the read occurred.

Returns
Type Description
absl::optional< Timestamp >

ExecutionStats() const

Returns a collection of key value pair statistics for the SQL statement execution.

Returns
Type Description
absl::optional< std::unordered_map< std::string, std::string > >

ExecutionPlan() const

Returns the plan of execution for the SQL statement.

Returns
Type Description
absl::optional< spanner::ExecutionPlan >