Skip to content

Commit 2bb05ad

Browse files
fix(BigQuery): null value record not returning null and causing a type mismatch on function call (#8963)
1 parent 2fb78d2 commit 2bb05ad

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

BigQuery/src/ValueMapper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public function fromBigQuery(array $value, array $schema)
121121
? $this->int64TimestampFromBigQuery($value)
122122
: $this->floatTimestampFromBigQuery($value);
123123
case self::TYPE_RECORD:
124+
if (is_null($value)) {
125+
return null;
126+
}
127+
124128
return $this->recordFromBigQuery($value, $schema['fields']);
125129
case self::TYPE_GEOGRAPHY:
126130
return new Geography((string) $value);

BigQuery/tests/Unit/ValueMapperTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,25 @@ public function bigQueryValueProvider()
223223
],
224224
['Say' => 'Hello', 'To the' => 'World']
225225
],
226+
[
227+
[
228+
'v' => null
229+
],
230+
[
231+
'type' => 'RECORD',
232+
'fields' => [
233+
[
234+
'name' => 'Say',
235+
'type' => 'STRING'
236+
],
237+
[
238+
'name' => 'To the',
239+
'type' => 'STRING'
240+
]
241+
]
242+
],
243+
null
244+
],
226245
[
227246
[
228247
'v' => [

0 commit comments

Comments
 (0)