diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp b/be/src/vec/exec/format/orc/vorc_reader.cpp index 9a467a4064a4be..bc1d1322c1e9f8 100644 --- a/be/src/vec/exec/format/orc/vorc_reader.cpp +++ b/be/src/vec/exec/format/orc/vorc_reader.cpp @@ -1117,7 +1117,7 @@ Status OrcReader::set_fill_columns( } } - if (!_has_complex_type && _enable_lazy_mat && !_lazy_read_ctx.predicate_columns.first.empty() && + if (_enable_lazy_mat && !_lazy_read_ctx.predicate_columns.first.empty() && !_lazy_read_ctx.lazy_read_columns.empty()) { _lazy_read_ctx.can_lazy_read = true; } diff --git a/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/create_table.hql b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/create_table.hql new file mode 100644 index 00000000000000..a1a35827909824 --- /dev/null +++ b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/create_table.hql @@ -0,0 +1,32 @@ +CREATE DATABASE IF NOT EXISTS multi_catalog; +USE multi_catalog; + +CREATE TABLE `nested_types1_orc` ( + `id` INT, + `array_col` ARRAY, + `nested_array_col` ARRAY>, + `map_col` MAP, + `nested_map_col` MAP>, + `struct_col` STRUCT<`name`: STRING, `age`: INT>, + `array_struct_col` ARRAY>, + `map_struct_col` MAP>, + `complex_struct_col` STRUCT< + `a`: ARRAY, + `b`: MAP>, + `c`: STRUCT< + `x`: ARRAY, + `y`: STRING + > + > +) +ROW FORMAT SERDE + 'org.apache.hadoop.hive.ql.io.orc.OrcSerde' +STORED AS INPUTFORMAT + 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' +OUTPUTFORMAT + 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat' +LOCATION + '/user/doris/suites/multi_catalog/nested_types1_orc'; + +msck repair table nested_types1_orc; + diff --git a/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/data.tar.gz b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/data.tar.gz new file mode 100644 index 00000000000000..d7be782267486e Binary files /dev/null and b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/data.tar.gz differ diff --git a/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/run.sh b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/run.sh new file mode 100644 index 00000000000000..f3136eaa20094a --- /dev/null +++ b/docker/thirdparties/docker-compose/hive/scripts/data/multi_catalog/orc_nested_types/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -x + +CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +## mkdir and put data to hdfs +cd "${CUR_DIR}" && rm -rf data/ && tar xzf data.tar.gz +hadoop fs -mkdir -p /user/doris/suites/multi_catalog/ +hadoop fs -put "${CUR_DIR}"/data/* /user/doris/suites/multi_catalog/ + +# create table +hive -f "${CUR_DIR}/create_table.hql" diff --git a/regression-test/data/external_table_p0/hive/test_orc_nested_types.out b/regression-test/data/external_table_p0/hive/test_orc_nested_types.out new file mode 100644 index 00000000000000..6ee3da7b26dd20 --- /dev/null +++ b/regression-test/data/external_table_p0/hive/test_orc_nested_types.out @@ -0,0 +1,365 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !nested_types1_q1 -- +1 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} + +-- !nested_types1_q2 -- +[4, 5] + +-- !nested_types1_q3 -- +[[1, 2]] + +-- !nested_types1_q4 -- +1 3 +10 2 +11 3 +12 2 +13 \N +14 3 +15 2 +16 3 +17 2 +18 \N +19 3 +2 2 +20 2 +3 \N +4 3 +5 2 +6 3 +7 2 +8 \N +9 3 + +-- !nested_types1_q5 -- +1 \N 2 +10 \N 5 +11 \N 2 +12 \N 5 +13 \N \N +14 \N 2 +15 \N 5 +16 \N 2 +17 \N 5 +18 \N \N +19 \N 2 +2 \N 5 +20 \N 5 +3 \N \N +4 \N 2 +5 \N 5 +6 \N 2 +7 \N 5 +8 \N \N +9 \N 2 + +-- !nested_types1_q6 -- +1 [1, 2, 3] +11 [1, 2, 3] +14 [1, 2, 3] +16 [1, 2, 3] +19 [1, 2, 3] +4 [1, 2, 3] +6 [1, 2, 3] +9 [1, 2, 3] + +-- !nested_types1_q7 -- +1 1 3 +10 4 5 +11 1 3 +12 4 5 +13 \N \N +14 1 3 +15 4 5 +16 1 3 +17 4 5 +18 \N \N +19 1 3 +2 4 5 +20 4 5 +3 \N \N +4 1 3 +5 4 5 +6 1 3 +7 4 5 +8 \N \N +9 1 3 + +-- !nested_types1_q8 -- +1 [[1, 2], [3, 4]] 2 + +-- !nested_types1_q9 -- +2 [[5], [6, 7]] \N + +-- !nested_types1_q10 -- +3 \N + +-- !nested_types1_q11 -- +1 {"a":1, "b":2} 2 + +-- !nested_types1_q12 -- +2 \N + +-- !nested_types1_q13 -- +3 \N + +-- !nested_types1_q14 -- +1 Alice 25 + +-- !nested_types1_q15 -- +2 [{"name":"Frank", "age":32}] 1 + +-- !nested_types1_q16 -- +1 Charlie 35 + +-- !nested_types1_q17 -- +2 \N \N + +-- !nested_types1_q18 -- +1 [1, 2] + +-- !nested_types1_q19 -- +2 {"y":[6, 7]} + +-- !nested_types1_q20 -- +3 {"x":[5, 6], "y":"Hello"} + +-- !nested_types1_q21 -- +1 [5, 6] + +-- !nested_types1_q22 -- +2 World + +-- !nested_types1_q23 -- +1 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +10 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +11 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +12 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +13 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +14 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +15 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +16 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +17 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +18 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +19 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +2 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +20 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +3 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +4 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +5 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +6 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +7 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +8 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +9 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} + +-- !nested_types1_q24 -- +1 [1, 2, 3] +11 [1, 2, 3] +14 [1, 2, 3] +16 [1, 2, 3] +19 [1, 2, 3] +4 [1, 2, 3] +6 [1, 2, 3] +9 [1, 2, 3] + +-- !nested_types1_q25 -- +1 25 +11 25 +13 25 +16 25 +18 25 +3 25 +6 25 +8 25 + +-- !nested_types1_q26 -- +1 25 +11 25 +13 25 +16 25 +18 25 +3 25 +6 25 +8 25 + +-- !nested_types1_q1 -- +1 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} + +-- !nested_types1_q2 -- +[4, 5] + +-- !nested_types1_q3 -- +[[1, 2]] + +-- !nested_types1_q4 -- +1 3 +10 2 +11 3 +12 2 +13 \N +14 3 +15 2 +16 3 +17 2 +18 \N +19 3 +2 2 +20 2 +3 \N +4 3 +5 2 +6 3 +7 2 +8 \N +9 3 + +-- !nested_types1_q5 -- +1 \N 2 +10 \N 5 +11 \N 2 +12 \N 5 +13 \N \N +14 \N 2 +15 \N 5 +16 \N 2 +17 \N 5 +18 \N \N +19 \N 2 +2 \N 5 +20 \N 5 +3 \N \N +4 \N 2 +5 \N 5 +6 \N 2 +7 \N 5 +8 \N \N +9 \N 2 + +-- !nested_types1_q6 -- +1 [1, 2, 3] +11 [1, 2, 3] +14 [1, 2, 3] +16 [1, 2, 3] +19 [1, 2, 3] +4 [1, 2, 3] +6 [1, 2, 3] +9 [1, 2, 3] + +-- !nested_types1_q7 -- +1 1 3 +10 4 5 +11 1 3 +12 4 5 +13 \N \N +14 1 3 +15 4 5 +16 1 3 +17 4 5 +18 \N \N +19 1 3 +2 4 5 +20 4 5 +3 \N \N +4 1 3 +5 4 5 +6 1 3 +7 4 5 +8 \N \N +9 1 3 + +-- !nested_types1_q8 -- +1 [[1, 2], [3, 4]] 2 + +-- !nested_types1_q9 -- +2 [[5], [6, 7]] \N + +-- !nested_types1_q10 -- +3 \N + +-- !nested_types1_q11 -- +1 {"a":1, "b":2} 2 + +-- !nested_types1_q12 -- +2 \N + +-- !nested_types1_q13 -- +3 \N + +-- !nested_types1_q14 -- +1 Alice 25 + +-- !nested_types1_q15 -- +2 [{"name":"Frank", "age":32}] 1 + +-- !nested_types1_q16 -- +1 Charlie 35 + +-- !nested_types1_q17 -- +2 \N \N + +-- !nested_types1_q18 -- +1 [1, 2] + +-- !nested_types1_q19 -- +2 {"y":[6, 7]} + +-- !nested_types1_q20 -- +3 {"x":[5, 6], "y":"Hello"} + +-- !nested_types1_q21 -- +1 [5, 6] + +-- !nested_types1_q22 -- +2 World + +-- !nested_types1_q23 -- +1 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +10 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +11 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +12 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +13 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +14 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +15 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +16 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +17 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +18 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +19 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +2 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +20 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +3 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +4 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} +5 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} \N {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":null} +6 [1, 2, 3] [[1, 2], [3, 4]] {"a":1, "b":2} {"a":[1, 2], "b":[3]} {"name":"Alice", "age":25} [{"name":"Bob", "age":30}, {"name":"Charlie", "age":35}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +7 [4, 5] [[5], [6, 7]] {"c":3} {"c":[4, 5]} {"name":"Eve", "age":28} [{"name":"Frank", "age":32}] {"b":{"name":"Grace", "age":22}} {"a":[3], "b":{"y":[6, 7]}, "c":{"x":[8], "y":"World"}} +8 \N [[1, 2]] {"a":1} \N {"name":"Alice", "age":25} [{"name":"Bob", "age":30}] \N {"a":[1, 2], "b":{"x":[3, 4]}, "c":{"x":[5, 6], "y":"Hello"}} +9 [1, 2, 3] \N \N {"a":[1, 2]} \N [{"name":"Bob", "age":30}] {"a":{"name":"Dave", "age":40}} {"a":[1, 2], "b":null, "c":{"x":[5, 6], "y":"Hello"}} + +-- !nested_types1_q24 -- +1 [1, 2, 3] +11 [1, 2, 3] +14 [1, 2, 3] +16 [1, 2, 3] +19 [1, 2, 3] +4 [1, 2, 3] +6 [1, 2, 3] +9 [1, 2, 3] + +-- !nested_types1_q25 -- +1 25 +11 25 +13 25 +16 25 +18 25 +3 25 +6 25 +8 25 + +-- !nested_types1_q26 -- +1 25 +11 25 +13 25 +16 25 +18 25 +3 25 +6 25 +8 25 + diff --git a/regression-test/suites/external_table_p0/hive/test_orc_nested_types.groovy b/regression-test/suites/external_table_p0/hive/test_orc_nested_types.groovy new file mode 100644 index 00000000000000..f3d9af89e7e808 --- /dev/null +++ b/regression-test/suites/external_table_p0/hive/test_orc_nested_types.groovy @@ -0,0 +1,236 @@ +// 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. + +suite("test_orc_nested_types", "p0,external,hive,external_docker,external_docker_hive") { + String enabled = context.config.otherConfigs.get("enableHiveTest") + if (enabled == null || !enabled.equalsIgnoreCase("true")) { + logger.info("disable Hive test.") + return; + } + + for (String hivePrefix : ["hive2", "hive3"]) { + String hms_port = context.config.otherConfigs.get(hivePrefix + "HmsPort") + String catalog_name = "${hivePrefix}_test_orc_nested_types" + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") + + sql """drop catalog if exists ${catalog_name}""" + sql """create catalog if not exists ${catalog_name} properties ( + "type"="hms", + 'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}' + );""" + logger.info("catalog " + catalog_name + " created") + sql """switch ${catalog_name};""" + logger.info("switched to catalog " + catalog_name) + + sql """ use multi_catalog """ + + order_qt_nested_types1_q1 """select * from nested_types1_orc where id = 1""" + + order_qt_nested_types1_q2 """select array_col from nested_types1_orc where id = 2""" + + order_qt_nested_types1_q3 """select nested_array_col from nested_types1_orc where id = 3""" + + + order_qt_nested_types1_q4 """ + SELECT id, size(array_col) as arr_size + FROM nested_types1_orc + ORDER BY id + """ + + order_qt_nested_types1_q5 """ + SELECT id, array_col[0] as first_elem, array_col[2] as third_elem + FROM nested_types1_orc + ORDER BY id + """ + + order_qt_nested_types1_q6 """ + SELECT id, array_col + FROM nested_types1_orc + WHERE array_contains(array_col, 1) + ORDER BY id + """ + + order_qt_nested_types1_q7 """ + SELECT + id, + array_min(array_col) as min_val, + array_max(array_col) as max_val + FROM nested_types1_orc + ORDER BY id + """ + + order_qt_nested_types1_q8 """ + SELECT + id, + nested_array_col, + size(nested_array_col) as outer_size + FROM nested_types1_orc + WHERE id = 1 + """ + + order_qt_nested_types1_q9 """ + SELECT + id, + nested_array_col, + size(nested_array_col[0]) as inner_size + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q10 """ + SELECT + id, + nested_array_col[0] as first_inner_array + FROM nested_types1_orc + WHERE id = 3 + """ + + order_qt_nested_types1_q11 """ + SELECT + id, + map_col, + size(map_col) as map_size + FROM nested_types1_orc + WHERE id = 1 + """ + + order_qt_nested_types1_q12 """ + SELECT + id, + map_col['a'] as a_value + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q13 """ + SELECT + id, + nested_map_col['b'] as b_value + FROM nested_types1_orc + WHERE id = 3 + """ + + order_qt_nested_types1_q14 """ + SELECT + id, + struct_element(struct_col, 'name') as name, + struct_element(struct_col, 'age') as age + FROM nested_types1_orc + WHERE id = 1 + """ + + order_qt_nested_types1_q15 """ + SELECT + id, + array_struct_col, + size(array_struct_col) as struct_arr_size + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q16 """ + SELECT + id, + struct_element(item, 'name') as name, + struct_element(item, 'age') as age + FROM nested_types1_orc + LATERAL VIEW EXPLODE(array_struct_col) tmp AS item + WHERE id = 1 AND struct_element(item, 'age') > 30 + """ + + order_qt_nested_types1_q17 """ + SELECT + id, + struct_element(map_struct_col['a'], 'name') as name, + struct_element(map_struct_col['a'], 'age') as age + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q18 """ + SELECT + id, + struct_element(complex_struct_col, 'a') as array_a + FROM nested_types1_orc + WHERE id = 1 + """ + + order_qt_nested_types1_q19 """ + SELECT + id, + struct_element(complex_struct_col, 'b') as map_b + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q20 """ + SELECT + id, + struct_element(complex_struct_col, 'c') as struct_c + FROM nested_types1_orc + WHERE id = 3 + """ + + order_qt_nested_types1_q21 """ + SELECT + id, + struct_element(struct_element(complex_struct_col, 'c'), 'x') as array_x + FROM nested_types1_orc + WHERE id = 1 + """ + + order_qt_nested_types1_q22 """ + SELECT + id, + struct_element(struct_element(complex_struct_col, 'c'), 'y') as y_value + FROM nested_types1_orc + WHERE id = 2 + """ + + order_qt_nested_types1_q23 """ + SELECT * + FROM nested_types1_orc + ORDER BY id + """ + + order_qt_nested_types1_q24 """ + SELECT id, array_col + FROM nested_types1_orc + WHERE array_contains(array_col, 1) + ORDER BY id + """ + + order_qt_nested_types1_q25 """ + SELECT + id, + struct_element(struct_col, 'age') as age + FROM nested_types1_orc + WHERE struct_element(struct_col, 'name') = 'Alice' + """ + + order_qt_nested_types1_q26 """ + SELECT + id, + struct_element(struct_col, 'age') as age + FROM nested_types1_orc + WHERE struct_element(struct_col, 'name') LIKE '%A%' + """ + + sql """drop catalog ${catalog_name};""" + } +} +