diff --git a/BigQuery/src/ValueMapper.php b/BigQuery/src/ValueMapper.php index 9d23b08f6d1d..ac21347107fa 100644 --- a/BigQuery/src/ValueMapper.php +++ b/BigQuery/src/ValueMapper.php @@ -121,6 +121,10 @@ public function fromBigQuery(array $value, array $schema) ? $this->int64TimestampFromBigQuery($value) : $this->floatTimestampFromBigQuery($value); case self::TYPE_RECORD: + if (is_null($value)) { + return null; + } + return $this->recordFromBigQuery($value, $schema['fields']); case self::TYPE_GEOGRAPHY: return new Geography((string) $value); diff --git a/BigQuery/tests/Unit/ValueMapperTest.php b/BigQuery/tests/Unit/ValueMapperTest.php index 078da0d7687b..489cc095285f 100644 --- a/BigQuery/tests/Unit/ValueMapperTest.php +++ b/BigQuery/tests/Unit/ValueMapperTest.php @@ -223,6 +223,25 @@ public function bigQueryValueProvider() ], ['Say' => 'Hello', 'To the' => 'World'] ], + [ + [ + 'v' => null + ], + [ + 'type' => 'RECORD', + 'fields' => [ + [ + 'name' => 'Say', + 'type' => 'STRING' + ], + [ + 'name' => 'To the', + 'type' => 'STRING' + ] + ] + ], + null + ], [ [ 'v' => [