Multi-row Functions
  # StreamSQL Multi-row Functions
Multi-row functions are used for handling multi-row data.
# UNNEST - Unnest Function
Syntax: unnest(array)
 Description: Expands an array into multiple rows.
 Incremental Calculation: Not Supported
Example 1 - Expand Simple Array:
SELECT unnest(tags) as tag FROM events
 1
Input Data:
{
  "id": 1,
  "tags": ["a", "b", "c"]
}
 1
2
3
4
2
3
4
Output Result:
{"tag": "a"}
{"tag": "b"}
{"tag": "c"}
 1
2
3
2
3
Example 2 - Expand Object Array:
SELECT unnest(items) FROM orders
 1
Input Data:
{
  "order_id": "O001",
  "items": [
    {"product": "apple", "price": 1.5},
    {"product": "banana", "price": 0.8}
  ]
}
 1
2
3
4
5
6
7
2
3
4
5
6
7
Output Result:
{"product": "apple", "price": 1.5}
{"product": "banana", "price": 0.8}
 1
2
2
# 📚 Related Documentation
- Conditional Functions - Learn detailed usage of conditional functions
 - Expression Functions - Learn detailed usage of expression functions
 - SQL Reference - View complete SQL syntax reference
 
Edit this page on GitHub  (opens new window)
  Last Updated: 2025/09/08, 10:41:28