In Google bigquery, I'm trying to do an update on a repeated field.
For comparison, this works (or at least is flagged as valid), but of course isn't actually updating the field.
UPDATE my.table t
SET my_field = ARRAY(
SELECT AS STRUCT g.foo, g.bar, g.struct_to_set_null
FROM unnest(t.groups) as g
), ... FROM ... etc
Setting struct_to_set_null
to null gives an error:
UPDATE my.table t
SET my_field = ARRAY(
SELECT AS STRUCT g.foo, g.bar, null as struct_to_set_null
FROM unnest(t.groups) as g
), ... FROM ... etc
Value of type ARRAY<STRUCT<... (really long and cut off) cannot be assigned to groups, which has type <ARRAY,STRUCT<... (same, really long, cut off)
I can see that the field in question is of type RECORD
and NULLABLE
, so I would think setting it to null
is allowed. Is there a trick to getting this to work?