morningman commented on code in PR #24746: URL: https://github.com/apache/doris/pull/24746#discussion_r1334376998
########## regression-test/suites/datatype_p0/nested_types/query/test_nested_types_insert_into_with_localtvf.groovy: ########## @@ -0,0 +1,287 @@ +// 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. + + +import com.google.common.collect.Lists +import org.apache.commons.lang3.StringUtils +import org.codehaus.groovy.runtime.IOGroovyMethods + +suite("test_nested_types_insert_into_with_localtvf", "p0") { + sql 'use regression_test_datatype_p0_nested_types' + sql 'set enable_nereids_planner=false' + sql """ADMIN SET FRONTEND CONFIG ('disable_nested_complex_type' = 'false')""" + + // prepare orc/parquet data for backends + List<List<Object>> backends = sql """ select * from backends(); """ + assertTrue(backends.size() > 0) + def be_id = backends[0][0] + def dataFilePath = context.config.dataPath + "/datatype_p0/nested_types/query" + + def outFilePath= dataFilePath + ArrayList<String> orcFiles = ["${dataFilePath}/as.orc", "${dataFilePath}/aa.orc", "${dataFilePath}/am.orc", "${dataFilePath}/map1.orc", + "${dataFilePath}/map_arr.orc"] + ArrayList<String> parquetFiles = ["${dataFilePath}/as.parquet", "${dataFilePath}/aa.parquet", "${dataFilePath}/am.parquet", + "${dataFilePath}/map1.parquet", "${dataFilePath}/map_arr.parquet"] + if (backends.size() > 1) { + // cluster mode need to make sure all be has this data + outFilePath="/" + for (List<Object> backend : backends) { + def be_host = backend[1] + for (int i = 0; i < orcFiles.size(); ++i) { + scpFiles("root", be_host, orcFiles[i], outFilePath, false) + orcFiles.set(i, StringUtils.replace(orcFiles[i], dataFilePath, outFilePath)) + } + for (int i = 0; i < parquetFiles.size(); ++i) { + scpFiles("root", be_host, parquetFiles[i], outFilePath, false) + parquetFiles.set(i, StringUtils.replace(parquetFiles[i], dataFilePath, outFilePath)) + } + } + } + + + // define dup key table with nested table types with one nested scala + List<String> table_names = new ArrayList<>() + def nested_table_dup = "tbl_array_nested_types_tvf" + sql "DROP TABLE IF EXISTS ${nested_table_dup}" + sql """ + CREATE TABLE IF NOT EXISTS ${nested_table_dup} ( + `k1` bigint(11) NULL, + `c_bool` array<boolean> NULL, + `c_tinyint` array<tinyint(4)> NULL, + `c_smallint` array<smallint(6)> NULL, + `c_int` array<int(11)> NULL, + `c_bigint` array<bigint(20)> NULL, + `c_largeint` array<largeint(40)> NULL, + `c_float` array<float> NULL, + `c_double` array<double> NULL, + `c_decimal` array<decimal(20, 3)> NULL, + `c_decimalv3` array<decimalv3(20, 3)> NULL, + `c_date` array<date> NULL, + `c_datetime` array<datetime> NULL, + `c_datev2` array<datev2> NULL, + `c_datetimev2` array<datetimev2(0)> NULL, + `c_char` array<char(15)> NULL, + `c_varchar` array<varchar(100)> NULL, + `c_string` array<text> NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + table_names.add(nested_table_dup) + // define dup key table with nested table types with two nested scala + def nested_table_dup2 = "tbl_array_nested_types_tvf2" + sql "DROP TABLE IF EXISTS ${nested_table_dup2}" + sql """ + CREATE TABLE IF NOT EXISTS ${nested_table_dup2} ( + `k1` bigint(11) NULL, + `c_bool` array<array<boolean>> NULL, + `c_tinyint` array<array<tinyint(4)>> NULL, + `c_smallint` array<array<smallint(6)>> NULL, + `c_int` array<array<int(11)>> NULL, + `c_bigint` array<array<bigint(20)>> NULL, + `c_largeint` array<array<largeint(40)>> NULL, + `c_float` array<array<float>> NULL, + `c_double` array<array<double>> NULL, + `c_decimal` array<array<decimal(20, 3)>> NULL, + `c_decimalv3` array<array<decimalv3(20, 3)>> NULL, + `c_date` array<array<date>> NULL, + `c_datetime` array<array<datetime>> NULL, + `c_datev2` array<array<datev2>> NULL, + `c_datetimev2` array<array<datetimev2(0)>> NULL, + `c_char` array<array<char(15)>> NULL, + `c_varchar` array<array<varchar(100)>> NULL, + `c_string` array<array<text>> NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + table_names.add(nested_table_dup2) + + // define dup key table with array nested map table types with one nested scala + def nested_table_array_map_dup = "tbl_array_map_types_tvf" + sql "DROP TABLE IF EXISTS ${nested_table_array_map_dup}" + sql """ + CREATE TABLE IF NOT EXISTS ${nested_table_array_map_dup} ( + `k1` bigint(11) NULL, + `c_bool` array<map<boolean, boolean>> NULL, + `c_tinyint` array<map<tinyint(4), tinyint(4)>> NULL, + `c_smallint` array<map<smallint(6), smallint(6)>> NULL, + `c_int` array<map<int(11), int(11)>> NULL, + `c_bigint` array<map<bigint(20), bigint(20)>> NULL, + `c_largeint` array<map<largeint(40), largeint(40)>> NULL, + `c_float` array<map<float, float>> NULL, + `c_double` array<map<double, double>> NULL, + `c_decimal` array<map<decimal(20, 3), decimal(20, 3)>> NULL, + `c_decimalv3` array<map<decimalv3(20, 3), decimalv3(20, 3)>> NULL, + `c_date` array<map<date, date>> NULL, + `c_datetime` array<map<datetime, datetime>> NULL, + `c_datev2` array<map<datev2, datev2>> NULL, + `c_datetimev2` array<map<datetimev2(0), datetimev2(0)>> NULL, + `c_char` array<map<char(15), char(15)>> NULL, + `c_varchar` array<map<varchar(100), varchar(100)>> NULL, + `c_string` array<map<text, text>> NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + table_names.add(nested_table_array_map_dup) + + // define dup key table with map types with one nested scala + def nested_table_map_dup = "tbl_map_types_tvf" + sql "DROP TABLE IF EXISTS ${nested_table_map_dup}" + sql """ + CREATE TABLE IF NOT EXISTS ${nested_table_map_dup} ( + `k1` bigint(11) NULL, + `c_bool` map<boolean, boolean> NULL, + `c_tinyint` map<tinyint(4), tinyint(4)> NULL, + `c_smallint` map<smallint(6), smallint(6)> NULL, + `c_int` map<int(11), int(11)> NULL, + `c_bigint` map<bigint(20), bigint(20)> NULL, + `c_largeint` map<largeint(40), largeint(40)> NULL, + `c_float` map<float, float> NULL, + `c_double` map<double, double> NULL, + `c_decimal` map<decimal(20, 3), decimal(20, 3)> NULL, + `c_decimalv3` map<decimalv3(20, 3), decimalv3(20, 3)> NULL, + `c_date` map<date, date> NULL, + `c_datetime` map<datetime, datetime> NULL, + `c_datev2` map<datev2, datev2> NULL, + `c_datetimev2` map<datetimev2(0), datetimev2(0)> NULL, + `c_char` map<char(15), char(15)> NULL, + `c_varchar` map<varchar(100), varchar(100)> NULL, + `c_string` map<text, text> NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + table_names.add(nested_table_map_dup) + + // define dup key table with map nested value array table types with one nested scala + def nested_table_map_array_dup = "tbl_map_array_types_tvf" + sql "DROP TABLE IF EXISTS ${nested_table_map_array_dup}" + sql """ + CREATE TABLE IF NOT EXISTS ${nested_table_map_array_dup} ( + `k1` bigint(11) NULL, + `c_bool` map<boolean, array<boolean>> NULL, + `c_tinyint` map<tinyint(4), array<tinyint(4)>> NULL, + `c_smallint` map<smallint(6), array<smallint(6)>> NULL, + `c_int` map<int(11), array<int(11)>> NULL, + `c_bigint` map<bigint(20), array<bigint(20)>> NULL, + `c_largeint` map<largeint(40), array<largeint(40)>> NULL, + `c_float` map<float, array<float>> NULL, + `c_double` map<double, array<double>> NULL, + `c_decimal` map<decimal(20, 3), array<decimal(20, 3)>> NULL, + `c_decimalv3` map<decimalv3(20, 3), array<decimalv3(20, 3)>> NULL, + `c_date` map<date, array<date>> NULL, + `c_datetime` map<datetime, array<datetime>> NULL, + `c_datev2` map<datev2, array<datev2>> NULL, + `c_datetimev2` map<datetimev2(0), array<datetimev2(0)>> NULL, + `c_char` map<char(15), array<char(15)>> NULL, + `c_varchar` map<varchar(100), array<varchar(100)>> NULL, + `c_string` map<text, array<text>> NULL + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES("replication_num" = "1"); + """ + table_names.add(nested_table_map_array_dup) + + // step1. select * from local_tvf with 0-100 items + // step2. insert into doris table + // step2. query and check + + for (int i = 0; i < 2; ++i) { + qt_sql_arr_orc_tvf """ + select count() from local( Review Comment: better use `select *` instead of `select count(*)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org