Skip to content
Merged
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
66 changes: 66 additions & 0 deletions datafusion/sqllogictest/test_files/list_view.slt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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.

#############
## ListView Aggregation Tests
#############

### Setup: Create test tables with ListView arrays

statement ok
CREATE TABLE list_view_agg_test AS
SELECT
id,
group_col,
arrow_cast(make_array(val1, val2, val3), 'ListView(Int64)') as list_view_col,
arrow_cast(make_array(val1, val2, val3), 'LargeListView(Int64)') as large_list_view_col
FROM (VALUES
(1, 'A', 10, 20, 30),
(2, 'A', 40, 50, 60),
(3, 'B', 70, 80, 90),
(4, 'B', 100, 110, 120),
(5, 'C', 1, 2, 3)
) AS t(id, group_col, val1, val2, val3);

### Test: GROUP BY on ListView column

query ?I rowsort
SELECT list_view_col, COUNT(*)
FROM list_view_agg_test
GROUP BY list_view_col;
----
[1, 2, 3] 1
[10, 20, 30] 1
[100, 110, 120] 1
[40, 50, 60] 1
[70, 80, 90] 1

query ?I rowsort
SELECT large_list_view_col, COUNT(*)
FROM list_view_agg_test
GROUP BY large_list_view_col;
----
[1, 2, 3] 1
[10, 20, 30] 1
[100, 110, 120] 1
[40, 50, 60] 1
[70, 80, 90] 1

### Cleanup

statement ok
DROP TABLE list_view_agg_test;
Loading