Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions datafusion/sqllogictest/src/test_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,17 @@ impl Ord for TestFile {
/// 3. 3.336s imdb.slt
/// 4. 3.085s push_down_filter_regression.slt
/// 5. 2.926s aggregate_skip_partial.slt
/// 6. 2.453s array.slt
/// 7. 2.399s window.slt
/// 8. 2.198s group_by.slt
/// 9. 1.281s clickbench.slt
/// 10. 1.058s datetime/timestamps.slt
/// 6. 2.399s window.slt
/// 7. 2.198s group_by.slt
/// 8. 1.281s clickbench.slt
/// 9. 1.058s datetime/timestamps.slt
/// ```
const TEST_PRIORITY_ENTRIES: &[&str] = &[
"aggregate.slt", // longest-running files go first
"joins.slt",
"imdb.slt",
"push_down_filter_regression.slt",
"aggregate_skip_partial.slt",
"array.slt",
"window.slt",
"group_by.slt",
"clickbench.slt",
Expand Down
10,038 changes: 0 additions & 10,038 deletions datafusion/sqllogictest/test_files/array.slt

This file was deleted.

174 changes: 174 additions & 0 deletions datafusion/sqllogictest/test_files/array/array_any_value.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

include ./init_data.slt.part

## array_any_value (aliases: list_any_value)

# Testing with empty arguments should result in an error
query error
select array_any_value();

# Testing with non-array arguments should result in an error
query error
select array_any_value(1), array_any_value('a'), array_any_value(NULL);

# array_any_value scalar function #1 (with null and non-null elements)

query IT?I
select array_any_value(make_array(NULL, 1, 2, 3, 4, 5)), array_any_value(make_array(NULL, 'h', 'e', 'l', 'l', 'o')), array_any_value(make_array(NULL, NULL)), array_any_value(make_array(NULL, NULL, 1, 2, 3));
----
1 h NULL 1

query ITITI
select array_any_value(arrow_cast(make_array(NULL, 1, 2, 3, 4, 5), 'LargeList(Int64)')), array_any_value(arrow_cast(make_array(NULL, 'h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)')), array_any_value(arrow_cast(make_array(NULL, NULL), 'LargeList(Int64)')), array_any_value(arrow_cast(make_array(NULL, NULL), 'LargeList(Utf8)')), array_any_value(arrow_cast(make_array(NULL, NULL, 1, 2, 3), 'LargeList(Int64)'));;
----
1 h NULL NULL 1

query ITITI
select array_any_value(arrow_cast(make_array(NULL, 1, 2, 3, 4, 5), 'FixedSizeList(6, Int64)')), array_any_value(arrow_cast(make_array(NULL, 'h', 'e', 'l', 'l', 'o'), 'FixedSizeList(6, Utf8)')), array_any_value(arrow_cast(make_array(NULL, NULL), 'FixedSizeList(2, Int64)')), array_any_value(arrow_cast(make_array(NULL, NULL), 'FixedSizeList(2, Utf8)')), array_any_value(arrow_cast(make_array(NULL, NULL, 1, 2, 3, 4), 'FixedSizeList(6, Int64)'));
----
1 h NULL NULL 1

# array_any_value scalar function #2 (with nested array)

query ?
select array_any_value(make_array(NULL, make_array(NULL, 1, 2, 3, 4, 5), make_array(NULL, 6, 7, 8, 9, 10)));
----
[NULL, 1, 2, 3, 4, 5]

query ?
select array_any_value(arrow_cast(make_array(NULL, make_array(NULL, 1, 2, 3, 4, 5), make_array(NULL, 6, 7, 8, 9, 10)), 'LargeList(List(Int64))'));
----
[NULL, 1, 2, 3, 4, 5]

query ?
select array_any_value(arrow_cast(make_array(NULL, make_array(NULL, 1, 2, 3, 4, 5), make_array(NULL, 6, 7, 8, 9, 10)), 'FixedSizeList(3, List(Int64))'));
----
[NULL, 1, 2, 3, 4, 5]

# array_any_value scalar function #3 (using function alias `list_any_value`)
query IT
select list_any_value(make_array(NULL, 1, 2, 3, 4, 5)), list_any_value(make_array(NULL, 'h', 'e', 'l', 'l', 'o'));
----
1 h

query IT
select list_any_value(arrow_cast(make_array(NULL, 1, 2, 3, 4, 5), 'LargeList(Int64)')), list_any_value(arrow_cast(make_array(NULL, 'h', 'e', 'l', 'l', 'o'), 'LargeList(Utf8)'));
----
1 h

query IT
select list_any_value(arrow_cast(make_array(NULL, 1, 2, 3, 4, 5), 'FixedSizeList(6, Int64)')), list_any_value(arrow_cast(make_array(NULL, 'h', 'e', 'l', 'l', 'o'), 'FixedSizeList(6, Utf8)'));
----
1 h

# array_any_value with columns

query I
select array_any_value(column1) from slices;
----
2
11
21
31
NULL
41
51

query I
select array_any_value(arrow_cast(column1, 'LargeList(Int64)')) from slices;
----
2
11
21
31
NULL
41
51

query I
select array_any_value(column1) from fixed_slices;
----
2
11
21
31
41
51

# array_any_value with columns and scalars

query II
select array_any_value(make_array(NULL, 1, 2, 3, 4, 5)), array_any_value(column1) from slices;
----
1 2
1 11
1 21
1 31
1 NULL
1 41
1 51

query II
select array_any_value(arrow_cast(make_array(NULL, 1, 2, 3, 4, 5), 'LargeList(Int64)')), array_any_value(arrow_cast(column1, 'LargeList(Int64)')) from slices;
----
1 2
1 11
1 21
1 31
1 NULL
1 41
1 51

query II
select array_any_value(make_array(NULL, 1, 2, 3, 4, 5)), array_any_value(column1) from fixed_slices;
----
1 2
1 11
1 21
1 31
1 41
1 51

# make_array with nulls
query ???????
select make_array(make_array('a','b'), null),
make_array(make_array('a','b'), null, make_array('c','d')),
make_array(null, make_array('a','b'), null),
make_array(null, make_array('a','b'), null, null, make_array('c','d')),
make_array(['a', 'bc', 'def'], null, make_array('rust')),
make_array([1,2,3], null, make_array(4,5,6,7)),
make_array(null, 1, null, 2, null, 3, null, null, 4, 5);
----
[[a, b], NULL] [[a, b], NULL, [c, d]] [NULL, [a, b], NULL] [NULL, [a, b], NULL, NULL, [c, d]] [[a, bc, def], NULL, [rust]] [[1, 2, 3], NULL, [4, 5, 6, 7]] [NULL, 1, NULL, 2, NULL, 3, NULL, NULL, 4, 5]

query ?
select make_array(column5, null, column5) from arrays_values_without_nulls;
----
[[2, 3], NULL, [2, 3]]
[[4, 5], NULL, [4, 5]]
[[6, 7], NULL, [6, 7]]
[[8, 9], NULL, [8, 9]]

query ?
select make_array(['a','b'], null);
----
[[a, b], NULL]


include ./cleanup.slt.part
Loading
Loading