0
votes

I have some tables on BigQuery that the schema looks like below.

enter image description here

enter image description here When I execute the below query I got some exceptions

select * from `test.test.test_partitioned` WHERE DATE(_PARTITIONTIME) = "2020-03-01"  and account.final_balance_sum >1

Cannot access field final_balance_sum on a value with type ARRAY<STRUCT<account_name STRING, final_balance_sum FLOAT64>> at [16:141]

enter image description here

I have tried the solution from here, seems it doesn't work to me at all.

Cannot access field in Big Query with type ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, ...>>

1
can you share the schema of your table? seems like your table has nested fields.Priya Agarwal
Yes, it nested fields, I have attached my schemas on the ticket nowSharpLu
I don't see final_balance_sum to be part of account record column. Did you try running - select * from test.test.test_partitioned WHERE DATE(_PARTITIONTIME) = "2020-03-01" and final_balance_sum >1Priya Agarwal
Yes, tried, doesn't workSharpLu

1 Answers

2
votes
select * EXCEPT(acc)
from `test.test.test_partitioned`,
UNNEST(account) acc
WHERE DATE(_PARTITIONTIME) = "2020-03-01"  
and acc.final_balance_sum >1