Complex types
R2 SQL supports querying struct, array, and map column types stored in Iceberg tables. This page covers access patterns, supported functions, and examples for each type.
Struct columns contain named fields. Access fields using bracket notation or the get_field() function.
SELECT pricing['price'] AS price, pricing['discount_percent'] AS discountFROM my_namespace.productsLIMIT 5SELECT get_field(pricing, 'price') AS price, get_field(pricing, 'discount_percent') AS discountFROM my_namespace.productsLIMIT 5SELECT customer_id, pricing['price'] AS priceFROM my_namespace.productsWHERE pricing['price'] > 50LIMIT 10SELECT customer_id, pricing['price'] AS priceFROM my_namespace.productsWHERE pricing['price'] IS NOT NULLORDER BY pricing['price'] DESC