Files
impala/testdata/workloads/functional-query/queries/QueryTest/map_null_keys.test
Daniel Becker 2d47306987 IMPALA-9551: Allow mixed complex types in select list
Currently collections and structs are supported in the select list, also
when they are nested (structs in structs and collections in
collections), but mixing different kinds of complex types, i.e. having
structs in collections or vice versa, is not supported.

This patch adds support for mixed complex types in the select list.

Limitation: zipping unnest is not supported for mixed complex types, for
example the following query:

  use functional_parquet;
  select unnest(struct_contains_nested_arr.arr) from
  collection_struct_mix;

Testing:
 - Created a new test table, 'collection_struct_mix', that contains
   mixed complex types.
 - Added tests in mixed-collections-and-structs.test that test having
   mixed complex types in the select list. These tests are called from
   test_nested_types.py::TestMixedCollectionsAndStructsInSelectList.
 - Ran existing tests that test collections and structs in the select
   list; test queries that expected a failure in case of mixed complex
   types have been moved to mixed-collections-and-structs.test and now
   expect success.

Change-Id: I476d98884b5fd192dfcd4feeec7947526aebe993
Reviewed-on: http://gerrit.cloudera.org:8080/19322
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2023-03-07 13:22:33 +00:00

51 lines
1.8 KiB
Plaintext

=====
---- QUERY
-- Test that NULL map keys are printed correctly.
set CONVERT_LEGACY_HIVE_PARQUET_UTC_TIMESTAMPS=1;
select
id,
map_bool_key,
map_tinyint_key,
map_smallint_key,
map_bigint_key,
map_float_key,
map_double_key,
map_decimal_key,
map_string_key,
map_char_key,
map_varchar_key,
map_timestamp_key,
map_date_key,
struct_contains_map
from map_null_keys;
---- RESULTS
1,'{true:"true",null:"null"}','{-1:"one",null:"null"}','{-1:"one",null:"null"}','{-1:"one",null:"null"}','{-1.75:"a",null:"null"}','{-1.75:"a",null:"null"}','{-1.8:"a",null:"null"}','{"one":1,null:null}','{"Mon":1,null:null}','{"a":"A",null:null}','{"2022-12-10 08:15:12":"Saturday morning",null:"null"}','{"2022-12-10":"Saturday",null:"null"}','{"m":{1:"one",null:"null"},"s":"some_string"}'
---- TYPES
INT,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
=====
---- QUERY
-- Test that NULL map keys are printed correctly with STRINGIFY_MAP_KEYS=true.
set CONVERT_LEGACY_HIVE_PARQUET_UTC_TIMESTAMPS=1;
set STRINGIFY_MAP_KEYS=1;
select
id,
map_bool_key,
map_tinyint_key,
map_smallint_key,
map_bigint_key,
map_float_key,
map_double_key,
map_decimal_key,
map_string_key,
map_char_key,
map_varchar_key,
map_timestamp_key,
map_date_key,
struct_contains_map
from map_null_keys;
---- RESULTS
1,'{"true":"true","null":"null"}','{"-1":"one","null":"null"}','{"-1":"one","null":"null"}','{"-1":"one","null":"null"}','{"-1.75":"a","null":"null"}','{"-1.75":"a","null":"null"}','{"-1.8":"a","null":"null"}','{"one":1,"null":null}','{"Mon":1,"null":null}','{"a":"A","null":null}','{"2022-12-10 08:15:12":"Saturday morning","null":"null"}','{"2022-12-10":"Saturday","null":"null"}','{"m":{"1":"one","null":"null"},"s":"some_string"}'
---- TYPES
INT,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
=====