1
votes

I am trying to form a nested STRUCT type in BigQuery. Facing a syntax error.

Query: select STRUCT > ('ind', 'dev','ind',('ind')) AS dealGeography

Error: Struct field 4 has type literal STRING which does not coerce to STRUCT

Please suggest on how to deal this.

Have attached the schema of this field here. https://i.stack.imgur.com/N8dVj.png

1

1 Answers

1
votes

If I understood it correctly, you want to create this data in your query. This being the case, maybe this will do the trick for you:

SELECT STRUCT<id string, type string, name string, address STRUCT<addressCountry string>> ('1', 'test', 'mr_a', struct('addr')) as dealGeography

You just need to define the schema for the data and for the inner struct you need to specify it as struct as well.