This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 7e7bfe03ba3 [fix](information-meta) fix information column_type and data_type missing for ip/variant (#41666) 7e7bfe03ba3 is described below commit 7e7bfe03ba3afaad92cd1de4354db6c61f3af82c Author: amory <wangqian...@selectdb.com> AuthorDate: Mon Oct 14 08:14:52 2024 +0800 [fix](information-meta) fix information column_type and data_type missing for ip/variant (#41666) --- .../exec/schema_scanner/schema_columns_scanner.cpp | 13 +++++- .../scalar_types/test_information_types.groovy | 53 ++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/be/src/exec/schema_scanner/schema_columns_scanner.cpp b/be/src/exec/schema_scanner/schema_columns_scanner.cpp index f4e15d2aef0..8325a7f5dc4 100644 --- a/be/src/exec/schema_scanner/schema_columns_scanner.cpp +++ b/be/src/exec/schema_scanner/schema_columns_scanner.cpp @@ -160,6 +160,12 @@ std::string SchemaColumnsScanner::_to_mysql_data_type_string(TColumnDesc& desc) case TPrimitiveType::STRUCT: { return "struct"; } + case TPrimitiveType::IPV4: + return "ipv4"; + case TPrimitiveType::IPV6: + return "ipv6"; + case TPrimitiveType::VARIANT: + return "variant"; default: return "unknown"; } @@ -272,7 +278,12 @@ std::string SchemaColumnsScanner::_type_to_string(TColumnDesc& desc) { ret += ">"; return ret; } - + case TPrimitiveType::IPV4: + return "ipv4"; + case TPrimitiveType::IPV6: + return "ipv6"; + case TPrimitiveType::VARIANT: + return "variant"; default: return "unknown"; } diff --git a/regression-test/suites/datatype_p0/scalar_types/test_information_types.groovy b/regression-test/suites/datatype_p0/scalar_types/test_information_types.groovy new file mode 100644 index 00000000000..699dad71b49 --- /dev/null +++ b/regression-test/suites/datatype_p0/scalar_types/test_information_types.groovy @@ -0,0 +1,53 @@ +// 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_information_types") { + + def tb_name = "test_information_schema_types" + + def datatype_arr = ["boolean", "tinyint(4)", "smallint(6)", "int(11)", "bigint(20)", "largeint(40)", "float", + "double", "decimal(20, 3)", "decimalv3(20, 3)", "date", "datetime", "datev2", "datetimev2(0)", + "char(15)", "varchar(100)", "text", "ipv4", "ipv6", "variant"] + def col_name_arr = ["c_bool", "c_tinyint", "c_smallint", "c_int", "c_bigint", "c_largeint", "c_float", + "c_double", "c_decimal", "c_decimalv3", "c_date", "c_datetime", "c_datev2", "c_datetimev2", + "c_char", "c_varchar", "c_string", "c_ipv4", "c_ipv6", "c_variant"] + + def stmt = "CREATE TABLE IF NOT EXISTS " + tb_name + "(\n" + + "`k1` bigint(11) NULL,\n" + + for (int i = 0; i < datatype_arr.size(); i++) { + String strTmp = "`" + col_name_arr[i] + "` " + datatype_arr[i] + " NULL,\n"; + stmt += strTmp + } + + stmt = stmt.substring(0, stmt.length()-2) + stmt += ") ENGINE=OLAP\n" + + "DUPLICATE KEY(`k1`)\n" + + "COMMENT 'OLAP'\n" + + "DISTRIBUTED BY HASH(`k1`) BUCKETS 10\n" + + "PROPERTIES(\"replication_num\" = \"1\");" + + // check column type and data type is "unknown" or not + sql stmt; + def res = sql "select COLUMN_TYPE, DATA_TYPE from information_schema.columns where table_name = '" + tb_name + "'"; + for (int i = 0; i < res.size(); i++) { + log.info("column_type: " + res[i][0] + ", data_type: " + res[i][1]); + assert(res[i][0] != "unknown"); + assert(res[i][1] != "unknown"); + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org