Skip to content

Commit

Permalink
Empty list example
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Monahan committed Jun 27, 2023
1 parent 9757524 commit cbaccc1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/sql/functions/nested.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,14 @@ SELECT
[[1, 2], [3, 4], [5, 6], [7, 8]]
```

The behavior of the flatten function also has specific behavior when handling `NULL` values:
In general, the input to the flatten function should be a list of lists (not a single level list).
However, the behavior of the flatten function has specific behavior when handling empty lists and `NULL` values.
```sql
-- If the input list is empty, return an empty list
SELECT flatten([]);
----
[]

-- If the entire input to flatten is NULL, return NULL
SELECT flatten(NULL);
----
Expand Down

0 comments on commit cbaccc1

Please sign in to comment.