From 1659cec792392c848efdb3f30812e315566bf115 Mon Sep 17 00:00:00 2001 From: Tiewei Fang Date: Mon, 14 Apr 2025 09:10:14 +0800 Subject: [PATCH] [Fix](TrinoConnector) it will return error when query `information_schema.tables` within `trino-connector` catalog (#49912) Fix that it will return error when query `information_schema.tables` within `trino-connector` catalog --- .../org/apache/doris/catalog/TableIf.java | 1 + ...t_trinoconnector_information_schema.groovy | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 regression-test/suites/external_table_p0/trino_connector/test_trinoconnector_information_schema.groovy diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java index 32d4bf79a7a17c..c185284744e468 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java @@ -461,6 +461,7 @@ public String toMysqlType() { case ICEBERG_EXTERNAL_TABLE: case PAIMON_EXTERNAL_TABLE: case MATERIALIZED_VIEW: + case TRINO_CONNECTOR_EXTERNAL_TABLE: return "BASE TABLE"; default: return null; diff --git a/regression-test/suites/external_table_p0/trino_connector/test_trinoconnector_information_schema.groovy b/regression-test/suites/external_table_p0/trino_connector/test_trinoconnector_information_schema.groovy new file mode 100644 index 00000000000000..76465e4cd78394 --- /dev/null +++ b/regression-test/suites/external_table_p0/trino_connector/test_trinoconnector_information_schema.groovy @@ -0,0 +1,44 @@ +// 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_trinoconnector_information_schema", "p0,external,hive,external_docker,external_docker_hive") { + String enabled = context.config.otherConfigs.get("enableHiveTest") + if (enabled != null && enabled.equalsIgnoreCase("true")) { + def host_ips = new ArrayList() + String[][] backends = sql """ show backends """ + for (def b in backends) { + host_ips.add(b[1]) + } + String [][] frontends = sql """ show frontends """ + for (def f in frontends) { + host_ips.add(f[1]) + } + dispatchTrinoConnectors(host_ips.unique()) + String hms_port = context.config.otherConfigs.get("hive2HmsPort") + String catalog_name = "test_trinoconnector_information_schema" + String externalEnvIp = context.config.otherConfigs.get("externalEnvIp") + + sql """drop catalog if exists ${catalog_name}""" + sql """create catalog if not exists ${catalog_name} properties ( + "type"="trino-connector", + "trino.connector.name"="hive", + 'trino.hive.metastore.uri' = 'thrift://${externalEnvIp}:${hms_port}' + );""" + + sql """ select * from ${catalog_name}.information_schema.tables limit 10"""; + } +} \ No newline at end of file