/** * Triggers a network request to reload the query's details. * * Useful when needing to poll an incomplete query * for status. Configuration options will be inherited from * {@see Google\Cloud\BigQuery\Job::queryResults()} or * {@see Google\Cloud\BigQuery\BigQueryClient::runQuery()}, but they can be * overridden if needed. * * Example: * ``` * $queryResults->isComplete(); // returns false * sleep(1); // let's wait for a moment... * $queryResults->reload(); // executes a network request * $queryResults->isComplete(); // true * ``` * * @see https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults * Jobs getQueryResults API documentation. * * @param array $options [optional] { * Configuration options. * * @type int $maxResults Maximum number of results to read. * @type int $startIndex Zero-based index of the starting row. * @type int $timeoutMs How long to wait for the query to complete, in * milliseconds. **Defaults to** `10000` milliseconds (10 seconds). * } * @return array */ public function reload(array $options = []) { $options += $this->identity; return $this->info = $this->connection->getQueryResults($options + $this->reloadOptions); }
/** * Retrieves the results of a query job. * * Example: * ``` * $queryResults = $job->queryResults(); * ``` * * @see https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults * Jobs getQueryResults API documentation. * * @param array $options [optional] { * Configuration options. * * @type int $maxResults Maximum number of results to read. * @type int $startIndex Zero-based index of the starting row. * @type int $timeoutMs How long to wait for the query to complete, in * milliseconds. **Defaults to** `10000` milliseconds (10 seconds). * } * @return QueryResults */ public function queryResults(array $options = []) { $response = $this->connection->getQueryResults($options + $this->identity); return new QueryResults($this->connection, $this->identity['jobId'], $this->identity['projectId'], $response, $options, $this->mapper ?: new ValueMapper(false)); }