Skip to content

Commit 4e61bf4

Browse files
committed
chore: Clean up
1 parent f6af797 commit 4e61bf4

File tree

2 files changed

+8
-87
lines changed

2 files changed

+8
-87
lines changed
-1.18 KB
Binary file not shown.

datafusion/sqllogictest/test_files/map.slt

Lines changed: 8 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ statement ok
856856
drop table tt;
857857

858858
# Test for issue with NULL map values
859-
859+
# Memory table tests
860860
statement ok
861861
CREATE TABLE test_null_map AS VALUES
862862
('1', MAP {'a': 'ab'}),
@@ -870,107 +870,34 @@ SELECT * FROM test_null_map ORDER BY column1;
870870
2 NULL
871871
3 {b: cd}
872872

873-
# Test with mixed NULL and non-NULL maps
874-
statement ok
875-
CREATE TABLE test_null_map2 AS VALUES
876-
('1', MAP {'a': 'ab'}),
877-
('2', NULL),
878-
('3', MAP {'c': 'ef'}),
879-
('4', NULL);
880-
881-
query T?
882-
SELECT * FROM test_null_map2 ORDER BY column1;
883-
----
884-
1 {a: ab}
885-
2 NULL
886-
3 {c: ef}
887-
4 NULL
888-
889-
statement ok
890-
DROP TABLE test_null_map;
891-
892-
statement ok
893-
DROP TABLE test_null_map2;
894-
895-
# Test processing map keys with NULL map values
896-
# This simulates the scenario from the issue where a UDF processes map keys
897-
statement ok
898-
CREATE TABLE test_map_keys AS VALUES
899-
('1', MAP {'a': 'ab'}),
900-
('2', NULL),
901-
('3', MAP {'c': 'cd'});
902-
903873
query ?
904-
SELECT map_keys(column2) FROM test_map_keys ORDER BY column1;
874+
SELECT map_keys(column2) FROM test_null_map ORDER BY column1;
905875
----
906876
[a]
907877
NULL
908-
[c]
878+
[b]
909879

910-
# Test processing map values with NULL map values
911880
query ?
912-
SELECT map_values(column2) FROM test_map_keys ORDER BY column1;
881+
SELECT map_values(column2) FROM test_null_map ORDER BY column1;
913882
----
914883
[ab]
915884
NULL
916885
[cd]
917886

918887
# Test with map_entries (this internally calls make_map)
919888
query ?
920-
SELECT map_entries(column2) FROM test_map_keys ORDER BY column1;
889+
SELECT map_entries(column2) FROM test_null_map ORDER BY column1;
921890
----
922891
[{key: a, value: ab}]
923892
NULL
924-
[{key: c, value: cd}]
893+
[{key: b, value: cd}]
925894

926895
statement ok
927-
DROP TABLE test_map_keys;
896+
DROP TABLE test_null_map;
928897

929-
# Test with Parquet storage
898+
# Parquet storage tests
930899
# This reproduces the issue where NULL map values cause "map key cannot be null" error
931900
statement ok
932-
CREATE TABLE test_map_parquet_temp AS VALUES
933-
('1', MAP {'a': 'ab'});
934-
935-
statement ok
936-
COPY test_map_parquet_temp TO 'test_files/scratch/test_map_parquet.parquet' STORED AS PARQUET;
937-
938-
statement ok
939-
DROP TABLE test_map_parquet_temp;
940-
941-
statement ok
942-
CREATE EXTERNAL TABLE test_map_parquet
943-
STORED AS PARQUET
944-
LOCATION 'test_files/scratch/test_map_parquet.parquet';
945-
946-
query T?
947-
SELECT * FROM test_map_parquet;
948-
----
949-
1 {a: ab}
950-
951-
# Now create a table with NULL map
952-
statement ok
953-
CREATE TABLE test_map_parquet_null_temp AS VALUES
954-
('1', NULL);
955-
956-
statement ok
957-
COPY test_map_parquet_null_temp TO 'test_files/scratch/test_map_parquet_null.parquet' STORED AS PARQUET;
958-
959-
statement ok
960-
DROP TABLE test_map_parquet_null_temp;
961-
962-
statement ok
963-
CREATE EXTERNAL TABLE test_map_parquet_null
964-
STORED AS PARQUET
965-
LOCATION 'test_files/scratch/test_map_parquet_null.parquet';
966-
967-
query T?
968-
SELECT * FROM test_map_parquet_null;
969-
----
970-
1 NULL
971-
972-
# Create a table with mixed NULL and non-NULL maps
973-
statement ok
974901
CREATE TABLE test_map_parquet_mixed_temp AS VALUES
975902
('1', MAP {'a': 'ab'}),
976903
('2', NULL),
@@ -1009,12 +936,6 @@ SELECT map_values(column2) FROM test_map_parquet_mixed ORDER BY column1;
1009936
NULL
1010937
[cd]
1011938

1012-
statement ok
1013-
DROP TABLE test_map_parquet;
1014-
1015-
statement ok
1016-
DROP TABLE test_map_parquet_null;
1017-
1018939
statement ok
1019940
DROP TABLE test_map_parquet_mixed;
1020941

0 commit comments

Comments
 (0)