Skip to content

Commit 4f1fa4b

Browse files
minor: map_from_entries sql tests (#3394)
1 parent 4cab60d commit 4f1fa4b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
-- ConfigMatrix: parquet.enable.dictionary=false,true
19+
20+
statement
21+
CREATE TABLE test_map_from_entries(entries array<struct<key:string, value:int>>) USING parquet
22+
23+
statement
24+
INSERT INTO test_map_from_entries VALUES (array(struct('a', 1), struct('b', 2), struct('c', 3))), (array()), (NULL)
25+
26+
query
27+
SELECT map_from_entries(entries) FROM test_map_from_entries
28+
29+
query expect_fallback(Using BinaryType as Map keys is not allowed in map_from_entries)
30+
SELECT map_from_entries(array(struct(cast('x' as binary), 10)))
31+
32+
query expect_fallback(Using BinaryType as Map values is not allowed in map_from_entries)
33+
SELECT map_from_entries(array(struct(10, cast('x' as binary))))
34+
35+
-- literal arguments
36+
query spark_answer_only
37+
SELECT map_from_entries(array(struct('x', 10), struct('y', 20), struct('z', 30)))

0 commit comments

Comments
 (0)