Files
impala/testdata/workloads/functional-query/queries/QueryTest/top-n-complex.test
Csaba Ringhofer 843de44788 IMPALA-13125: Fix pairwise test vector generation
Replaced allpairspy with a homemade pair finder that
seems to find a somewhat less optimal (larger) covering
vector set but works reliably with filters. For details
see tests/common/test_vector.py

Also fixes a few test issues uncovered. Some fixes are
copied from https://gerrit.cloudera.org/#/c/23319/

Added the possibility of shuffling vectors to get a
different test set (env var IMPALA_TEST_VECTOR_SEED).
By default the algorithm is deterministic so the test
set won't change between runs (similarly to allpairspy).

Added a new constraint to test only a single compression
per file format in some tests to reduce the number of
new vectors.

EE + custom_cluster test count in exhaustive runs:
before patch:                   ~11000
after patch:                    ~16000
without compression constraint: ~17000

Change-Id: I419c24659a08d8d6592fadbbd5b764ff73cbba3e
Reviewed-on: http://gerrit.cloudera.org:8080/23342
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2025-08-28 15:27:02 +00:00

241 lines
11 KiB
Plaintext

====
---- QUERY
# Sort collections with limit.
select id, arr_int_1d, arr_string_3d, map_1d, map_3d from collection_tbl order by id desc limit 2
---- RESULTS
3,'[null,4679,null,49,null]','[[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]],[["four even-toed ungulate"]]]','{645:"fourth even-toed ungulate",5:"fifth"}','{1:{10:{100:"hundred",200:"two hundred even-toed ungulates"},20:{300:"three hundred even-toed ungulates",400:"four hundred"}},2:{30:{500:"five hundred even-toed ungulates",600:"six hundred"},40:{700:"seven hundred even-toed ungulates",800:"eight hundred"}}}'
2,'[1,null,3]','[[["second dinosaur bone",null,null],["three dinosaur bones"]],[["one",null,"four dinosaur bones"]]]','{1:"first dinosaur bone",2:"second",3:null}','{1:{10:{100:"hundred",200:"two hundred dinosaur bones"},20:{300:"three hundred dinosaur bones",400:"four hundred"}},2:{30:{500:"five hundred dinosaur bones",600:"six hundred"},40:{700:"seven hundred dinosaur bones",800:"eight hundred"}}}'
---- TYPES
int,string,string,string,string
====
---- QUERY
# Sort collections from HMS view.
select id, int_array, int_array_array from complextypes_arrays_only_view order by id desc limit 4
---- RESULTS
8,'[-1]','[[-1,-2],[]]'
7,'NULL','[null,[5,6]]'
6,'NULL','NULL'
5,'NULL','NULL'
---- TYPES
bigint,string,string
====
---- QUERY
# Sort collection from WITH-clause inline view.
with v as (
select id, arr_int_1d, arr_string_3d, map_1d, map_3d from collection_tbl
)
select id, arr_int_1d, arr_string_3d, map_1d, map_3d from collection_tbl order by id desc limit 2;
---- RESULTS
3,'[null,4679,null,49,null]','[[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]],[["four even-toed ungulate"]]]','{645:"fourth even-toed ungulate",5:"fifth"}','{1:{10:{100:"hundred",200:"two hundred even-toed ungulates"},20:{300:"three hundred even-toed ungulates",400:"four hundred"}},2:{30:{500:"five hundred even-toed ungulates",600:"six hundred"},40:{700:"seven hundred even-toed ungulates",800:"eight hundred"}}}'
2,'[1,null,3]','[[["second dinosaur bone",null,null],["three dinosaur bones"]],[["one",null,"four dinosaur bones"]]]','{1:"first dinosaur bone",2:"second",3:null}','{1:{10:{100:"hundred",200:"two hundred dinosaur bones"},20:{300:"three hundred dinosaur bones",400:"four hundred"}},2:{30:{500:"five hundred dinosaur bones",600:"six hundred"},40:{700:"seven hundred dinosaur bones",800:"eight hundred"}}}'
---- TYPES
int,string,string,string,string
====
---- QUERY
# Sort collections from nested query inline view with limit.
select id, arr_int_1d, arr_string_3d, map_1d, map_3d
from (select id, arr_int_1d, arr_string_3d, map_1d, map_3d from collection_tbl) v
order by id desc limit 2
---- RESULTS
3,'[null,4679,null,49,null]','[[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]],[["four even-toed ungulate"]]]','{645:"fourth even-toed ungulate",5:"fifth"}','{1:{10:{100:"hundred",200:"two hundred even-toed ungulates"},20:{300:"three hundred even-toed ungulates",400:"four hundred"}},2:{30:{500:"five hundred even-toed ungulates",600:"six hundred"},40:{700:"seven hundred even-toed ungulates",800:"eight hundred"}}}'
2,'[1,null,3]','[[["second dinosaur bone",null,null],["three dinosaur bones"]],[["one",null,"four dinosaur bones"]]]','{1:"first dinosaur bone",2:"second",3:null}','{1:{10:{100:"hundred",200:"two hundred dinosaur bones"},20:{300:"three hundred dinosaur bones",400:"four hundred"}},2:{30:{500:"five hundred dinosaur bones",600:"six hundred"},40:{700:"seven hundred dinosaur bones",800:"eight hundred"}}}'
---- TYPES
int,string,string,string,string
====
---- QUERY
# Sort a collection that is join-unnested.
select id, a.item
from collection_tbl t, t.arr_string_3d a
where id != 2
order by id desc limit 3
# Adding VERIFY_IS_EQUAL_SORTED because collections cannot be sorted and the order of the
# rows with the same 'id' is different for different files.
---- RESULTS: VERIFY_IS_EQUAL_SORTED
3,'[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]]'
3,'[["four even-toed ungulate"]]'
1,'[["1","second harmonic",null],["three cities"]]'
---- TYPES
int,string
====
---- QUERY
# Sort a collection that is join-unnested in a WITH-clause inline view.
with v as (
select id, a.item m
from complextypestbl t, t.int_map_array a
where id != 8 and id != 2
)
select id, m from v order by id desc limit 3;
with v as (
select id, a.item arr
from collection_tbl t, t.arr_string_3d a
where id != 2
)
select id, arr from v order by id desc limit 3
# Adding VERIFY_IS_EQUAL_SORTED because collections cannot be sorted and the order of the
# rows with the same 'id' is different for different files.
---- RESULTS: VERIFY_IS_EQUAL_SORTED
3,'[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]]'
3,'[["four even-toed ungulate"]]'
1,'[["1","second harmonic",null],["three cities"]]'
---- TYPES
int,string
====
---- QUERY
# Sort a collection that is join-unnested in a nested query inline view with limit.
select id, arr
from (
select id, a.item arr
from collection_tbl t, t.arr_string_3d a
) v
where id != 2
order by id desc limit 3
# Adding VERIFY_IS_EQUAL_SORTED because collections cannot be sorted and the order of the
# rows with the same 'id' is different for different files.
---- RESULTS: VERIFY_IS_EQUAL_SORTED
3,'[["1","-1","second even-toed ungulate",null],["three even-toed ungulates"]]'
3,'[["four even-toed ungulate"]]'
1,'[["1","second harmonic",null],["three cities"]]'
---- TYPES
int,string
====
---- QUERY
# Sorting a collection of strings.
select id, arr_string_1d from collection_tbl order by id desc limit 2
---- RESULTS
3,'["1",null,"three even-toed ungulates"]'
2,'["one dinosaur bone",null,"2",null]'
---- TYPES
int,string
====
---- QUERY
# Sort maps containing only fixed length types.
select id, map_int_int, map_char3_char5 from map_non_varlen order by id desc limit 7
---- RESULTS
10,'{100:1000,101:1010,102:1020}','{"aaj":"aaaaj"}'
9,'{90:900,91:910,92:920}','{"aai":"aaaai"}'
8,'{80:800,81:810,82:820}','{"aah":"aaaah"}'
7,'{70:700,71:710,72:720}','{"aag":"aaaag"}'
6,'{60:600,61:610,62:620}','{"aaf":"aaaaf"}'
5,'{50:500,51:510,52:520}','{"aae":"aaaae"}'
4,'{40:400,41:410,42:420}','{"aad":"aaaad"}'
---- TYPES
int,string,string
====
---- QUERY
# Sort collections selected from within a struct.
select id, struct_contains_arr.arr, struct_contains_nested_arr.arr from collection_struct_mix order by id desc limit 1;
---- RESULTS
2,'NULL','[["2022-12-10","2022-12-11",null,"2022-12-12"],null]'
---- TYPES
INT,STRING,STRING
====
---- QUERY
# Sort collections containing structs, also containing var-len data.
select id, arr_contains_struct, arr_contains_nested_struct from collection_struct_mix order by id desc limit 1;
---- RESULTS
2,'[{"i":100},{"i":8},{"i":35},{"i":45},null,{"i":193},{"i":null}]','[{"inner_struct1":null,"inner_struct2":{"str":"very few distilleries","l":128},"small":104},{"inner_struct1":{"str":"a few soju distilleries","l":28},"inner_struct2":{"str":"lots of soju distilleries","l":228},"small":105},null]'
---- TYPES
INT,STRING,STRING
====
---- QUERY
# Sorting a var-len struct nested in a collection. Regression test for IMPALA-12781.
select id, arr_contains_nested_struct from collection_struct_mix order by id limit 2;
---- RESULTS
1,'[{"inner_struct1":{"str":"","l":0},"inner_struct2":{"str":"four spaceship captains","l":2},"small":2},null,{"inner_struct1":{"str":null,"l":5},"inner_struct2":{"str":"more spaceship captains","l":8},"small":20}]'
2,'[{"inner_struct1":null,"inner_struct2":{"str":"very few distilleries","l":128},"small":104},{"inner_struct1":{"str":"a few soju distilleries","l":28},"inner_struct2":{"str":"lots of soju distilleries","l":228},"small":105},null]'
---- TYPES
INT,STRING
====
---- QUERY
# Regression test for IMPALA-13272
select
row_no
from (
select
arr.small,
row_number() over (order by arr.inner_struct1.str) as row_no
from collection_struct_mix t, t.arr_contains_nested_struct arr
) res limit 4;
---- RESULTS
1
2
3
4
---- TYPES
BIGINT
====
---- QUERY
# Regression test for IMPALA-13272
select
row_no, str
from (
select
arr.small,
arr.inner_struct1.str str,
row_number() over (order by arr.inner_struct1.str) as row_no
from collection_struct_mix t, t.arr_contains_nested_struct arr
) res limit 4;
---- RESULTS
1,''
2,'a few soju distilleries'
3,'NULL'
4,'NULL'
---- TYPES
BIGINT,STRING
====
---- QUERY
# Regression test for IMPALA-13272
select
row_no, str, small
from (
select
arr.small,
arr.inner_struct2.str str,
row_number() over (order by arr.inner_struct2.str) as row_no
from collection_struct_mix t, t.arr_contains_nested_struct arr
) res limit 4;
---- RESULTS
1,'four spaceship captains',2
2,'lots of soju distilleries',105
3,'more spaceship captains',20
4,'very few distilleries',104
---- TYPES
BIGINT,STRING, SMALLINT
====
---- QUERY
# Regression test for IMPALA-13407
select id, str, alltypes, tiny_struct, small_struct from complextypes_structs order by str limit 4;
---- RESULTS
5,'fifth item','NULL','{"b":false}','{"i":98765,"s":"abcde f"}'
1,'first item','{"ti":100,"si":12348,"i":156789012,"bi":163234345342,"b":true,"f":1234.56005859375,"do":65323423.33,"da":"2021-05-30","ts":"2021-06-01 10:19:04","s1":"some string","s2":"another str","c1":"x","c2":"xyz","vc":"somevarcha","de1":12345,"de2":null}','{"b":true}','NULL'
4,'fourth item','{"ti":90,"si":30482,"i":1664336,"bi":23567459873,"b":true,"f":0.5600000023841858,"do":NaN,"da":"2000-12-31","ts":"2024-01-01 00:00:00.123400000","s1":"random string","s2":"","c1":"c","c2":"d ","vc":"addsdrr","de1":33357,"de2":null}','{"b":null}','{"i":null,"s":"str"}'
2,'second item','{"ti":123,"si":4567,"i":1562322212,"bi":334333345342,"b":false,"f":NaN,"do":23233423.099,"da":null,"ts":"2020-06-11 12:10:04","s1":null,"s2":"NULL","c1":"a","c2":"ab ","vc":"varchar","de1":11223,"de2":null}','{"b":false}','{"i":19191,"s":"small_struct_str"}'
---- TYPES
INT,STRING,STRING,STRING,STRING
====
---- QUERY
# Sorting is not supported yet for collections within structs: IMPALA-12160. Test with a
# struct that contains an array.
select id, struct_contains_arr from collection_struct_mix order by id limit 5
---- CATCH
AnalysisException: Sorting is not supported if the select list contains collection(s) nested in struct(s).
====
---- QUERY
# Sorting is not supported yet for collections within structs: IMPALA-12160. Test with a
# struct that contains a map.
select id, struct_contains_map from collection_struct_mix order by id limit 5
---- CATCH
AnalysisException: Sorting is not supported if the select list contains collection(s) nested in struct(s).
====
---- QUERY
# Sorting is not supported yet for collections within structs: IMPALA-12160. Test with an
# array that contains a struct that contains an array.
select id, maps.key, maps.value.big.arr from collection_struct_mix t, t.all_mix maps order by id limit 7
---- CATCH
AnalysisException: Sorting is not supported if the select list contains collection(s) nested in struct(s).
====