From cbaccc133a627e4db9d294ed674c33a43055db13 Mon Sep 17 00:00:00 2001 From: Alex-Monahan Date: Tue, 27 Jun 2023 08:36:14 -0700 Subject: [PATCH] Empty list example --- docs/sql/functions/nested.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/sql/functions/nested.md b/docs/sql/functions/nested.md index 02e12c866e5..47c59dc27d7 100644 --- a/docs/sql/functions/nested.md +++ b/docs/sql/functions/nested.md @@ -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); ----