BigQuery/src/QueryResults.php
public function rows(array $options = [])
    {
        $options += $this->queryResultsOptions;
        $this->waitUntilComplete($options);
        $schema = $this->info['schema']['fields'];

        return new ItemIterator(
            new PageIterator(
                function (array $row) use ($schema) {
                    $mergedRow = [];

                    if ($row === null) {
                        return $mergedRow;
                    }

                    if (!array_key_exists('f', $row)) {
                        throw new GoogleException('Bad response - missing key "f" for a row.');
                    }

                    foreach ($row['f'] as $key => $value) {
                        $fieldSchema = $schema[$key];
                        $mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
                    }

                    return $mergedRow;
                },
                [$this->connection, 'getQueryResults'],
                $options + $this->identity,
                [
                    'itemsKey' => 'rows',
                    'firstPage' => $this->info,
                    'nextResultTokenKey' => 'pageToken'
                ]
            )
        );
    }
public function rows(array $options = [])
    {
        $options += $this->queryResultsOptions;
        $this->waitUntilComplete($options);
        $schema = $this->info['schema']['fields'];

        return new ItemIterator(
            new PageIterator(
                function (array $row) use ($schema) {
                    $mergedRow = [];

                    if ($row === null) {
                        return $mergedRow;
                    }

                    if (!array_key_exists('f', $row)) {
                        throw new GoogleException('Bad response - missing key "f" for a row.');
                    }

                    foreach ($row['f'] as $key => $value) {
                        $fieldSchema = $schema[$key];
                        $mergedRow[$fieldSchema['name']] = $this->mapper->fromBigQuery($value, $fieldSchema);
                    }

                    return $mergedRow;
                },
                [$this->connection, 'getQueryResults'],
                $options + $this->identity,
                [
                    'itemsKey' => 'rows',
                    'firstPage' => $this->info,
                    'nextResultTokenKey' => 'pageToken'
                ]
            )
        );
    }
public function rows ( array $ options = [ ] ) { $ options += $ this -> queryResultsOptions ; $ this -> waitUntilComplete ( $ options ) ; $ schema = $ this -> info [ 'schema' ] [ 'fields' ] ; return new ItemIterator ( new PageIterator ( function ( array $ row ) use ( $ schema ) { $ mergedRow = [ ] ; if ( $ row === null ) { return $ mergedRow ; } if ( ! array_key_exists ( 'f' , $ row ) ) { throw new GoogleException ( 'Bad response - missing key "f" for a row.' ) ; } foreach ( $ row [ 'f' ] as $ key => $ value ) { $ fieldSchema = $ schema [ $ key ] ; $ mergedRow [ $ fieldSchema [ 'name' ] ] = $ this -> mapper -> fromBigQuery ( $ value , $ fieldSchema ) ; } return $ mergedRow ; } , [ $ this -> connection , 'getQueryResults' ] , $ options + $ this -> identity , [ 'itemsKey' => 'rows' , 'firstPage' => $ this -> info , 'nextResultTokenKey' => 'pageToken' ] ) ) ; }
Retrieves the rows associated with the query and merges them together
with the table's schema.

Refer to the table below for a guide on how BigQuery types are mapped as
they come back from the API.

| **PHP Type**                               | **BigQuery Data Type**               |
|--------------------------------------------|--------------------------------------|
| `\DateTimeInterface`                       | `DATETIME`                           |
| {@see Google\Cloud\BigQuery\Bytes}         | `BYTES`                              |
| {@see Google\Cloud\BigQuery\Date}          | `DATE`                               |
| {@see Google\Cloud\Core\Int64}             | `INTEGER`                            |
| {@see Google\Cloud\BigQuery\Time}          | `TIME`                               |
| {@see Google\Cloud\BigQuery\Timestamp}     | `TIMESTAMP`                          |
| Associative Array                          | `RECORD`                             |
| Non-Associative Array                      | `RECORD` (Repeated)                  |
| `float`                                    | `FLOAT`                              |
| `int`                                      | `INTEGER`                            |
| `string`                                   | `STRING`                             |
| `bool`                                     | `BOOLEAN`                            |

Example:
```
$rows = $queryResults->rows();

foreach ($rows as $row) {
echo $row['name'] . PHP_EOL;
}
```

@param array $options [optional] {
Configuration options. Please note, these options will inherit the
values set by either
{@see Google\Cloud\BigQuery\BigQueryClient::runQuery()} or
{@see Google\Cloud\BigQuery\Job::queryResults()}.

@type int $maxResults Maximum number of results to read per page.
@type int $startIndex Zero-based index of the starting row.
@type int $timeoutMs How long, in milliseconds, each API call will
wait for query results to become available before timing out.
Depending on whether the $maxRetries has been exceeded, the
results will be polled again after the timeout has been reached.
**Defaults to** `10000` milliseconds (10 seconds).
@type int $maxRetries The number of times to poll the Job status,
until the job is complete. By default, will poll indefinitely.
}
@return ItemIterator
@throws JobException If the maximum number of retries while waiting for
query completion has been exceeded.
@throws GoogleException Thrown in the case of a malformed response.
Retrieves the rows associated with the query and merges them together with the table s schema .