Skip to content

Apache DataFusion SQL Query Engine

chore: add tests for out of bounds for NullArray (#16802)

Oleks V8484c96ed74c
diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt
index a3d9c3e1d9..8cbc427250 100644
--- a/datafusion/sqllogictest/test_files/array.slt
+++ b/datafusion/sqllogictest/test_files/array.slt
@@ -8065,6 +8065,13 @@ FixedSizeList(Field { name: "item", data_type: Int32, nullable: true, dict_id: 0
statement error
create table varying_fixed_size_col_table (a int[3]) as values ([1,2,3]), ([4,5]);
+# https://github.com/apache/datafusion/issues/16187
+# should be NULL in case of out of bounds for Null Type
+query ?
+select [named_struct('a', 1, 'b', null)][-2];
+----
+NULL
+
### Delete tables
statement ok
diff --git a/datafusion/sqllogictest/test_files/map.slt b/datafusion/sqllogictest/test_files/map.slt
index 56481936e7..4f1e5ef39a 100644
--- a/datafusion/sqllogictest/test_files/map.slt
+++ b/datafusion/sqllogictest/test_files/map.slt
@@ -833,5 +833,12 @@ select column3[true] from tt;
----
3
+# https://github.com/apache/datafusion/issues/16187
+# should be NULL in case of out of bounds for Null Type
+query ?
+select map_values(map([named_struct('a', 1, 'b', null)], [named_struct('a', 1, 'b', null)]))[0] as a;
+----
+NULL
+
statement ok
drop table tt;