/**
* Runs a load job which loads the provided data into the table.
*
* Example:
* ```
* $table->load(fopen('/path/to/my/data.csv', 'r'));
* ```
*
* @see https://cloud.google.com/bigquery/docs/reference/v2/jobs Jobs insert API Documentation.
*
* @param string|resource|StreamInterface $data The data to load.
* @param array $options [optional] {
* Configuration options.
*
* @type array $jobConfig Configuration settings for a load job are
* outlined in the [API Docs for `configuration.load`](https://goo.gl/j6jyHv).
* If not provided default settings will be used.
* }
* @return Job
*/
public function load($data, array $options = [])
{
$response = null;
$config = $this->buildJobConfig('load', $this->identity['projectId'], ['destinationTable' => $this->identity], $options);
if ($data) {
$config['data'] = $data;
$response = $this->connection->insertJobUpload($config)->upload();
} else {
$response = $this->connection->insertJob($config);
}
return new Job($this->connection, $response['jobReference']['jobId'], $this->identity['projectId'], $response);
}