Skip to content

Apache DataFusion SQL Query Engine

docs: Update `map_extract` examples (#21360)

Nuno Fariadbe3395ea53d
diff --git a/datafusion/functions-nested/src/map_extract.rs b/datafusion/functions-nested/src/map_extract.rs
index 1c46bf5e81..aab0d013a4 100644
--- a/datafusion/functions-nested/src/map_extract.rs
+++ b/datafusion/functions-nested/src/map_extract.rs
@@ -57,6 +57,11 @@ SELECT map_extract(MAP {1: 'one', 2: 'two'}, 2);
SELECT map_extract(MAP {'x': 10, 'y': NULL, 'z': 30}, 'y');
----
+[NULL]
+
+-- non-existing key
+SELECT map_extract(MAP {'x': 10, 'y': NULL, 'z': 30}, 'a');
+----
[]
```"#,
argument(
diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md
index 9f5814447b..bd7fb22e00 100644
--- a/docs/source/user-guide/sql/scalar_functions.md
+++ b/docs/source/user-guide/sql/scalar_functions.md
@@ -5039,6 +5039,11 @@ SELECT map_extract(MAP {1: 'one', 2: 'two'}, 2);
SELECT map_extract(MAP {'x': 10, 'y': NULL, 'z': 30}, 'y');
----
+[NULL]
+
+-- non-existing key
+SELECT map_extract(MAP {'x': 10, 'y': NULL, 'z': 30}, 'a');
+----
[]
```