简体   繁体   中英

Unnest in BigQuery leading to “Array” error

I am taking over the work of a former colleague and try to build on top of it. His work led to unnesting a parent categories, and I am trying to achieve the same for another category. My additional Unnesting is, however, leading to an error due to Array structure - which is why I want to unnest in the first play right? :(

Please see attached image图片

(the Error code is: "Cannot access field refund_line_items on a value with type ARRAY>, id INT64, processed_at TIMESTAMP, ...>> at [19:16]")

Any help will be much appreciated!

If I understand your table schema correctly. refunds is an array, so you need to unnest the array field then access its struct field inside, like

SELECT refund.refund_line_items
FROM orders
JOIN UNNEST(refunds) refund

See more on: Querying STRUCT elements in an ARRAY

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM