From a2179cc59952ad2fe3db02513e8b410c9bd26341 Mon Sep 17 00:00:00 2001 From: silencily Date: Sun, 4 Feb 2024 10:28:42 +0800 Subject: [PATCH] [KYUUBI #6037] Fix the JDBC engine provider name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes create Jdbc Engine error: ``` java.lang.IllegalArgumentException: Could not find a JDBC connection provider with name 'org.apache.kyuubi.engine.jdbc.mysql.MySQLConnectionProvider' that can handle the specified driver and options. Available providers are [org.apache.kyuubi.engine.jdbc.doris.DorisConnectionProvider57459491, org.apache.kyuubi.engine.jdbc.mysql.MySQLConnectionProviderdcfda20, org.apache.kyuubi.engine.jdbc.phoenix.PhoenixConnectionProvider5c87bfe2, org.apache.kyuubi.engine.jdbc.postgresql.PostgreSQLConnectionProvider51cd7ffc, org.apache.kyuubi.engine.jdbc.starrocks.StarRocksConnectionProvider40f1be1b] ``` ## Describe Your Solution ๐Ÿ”ง ``` val ENGINE_JDBC_CONNECTION_PROVIDER: OptionalConfigEntry[String] = buildConf("kyuubi.engine.jdbc.connection.provider") .doc("A JDBC connection provider plugin for the Kyuubi Server " + "to establish a connection to the JDBC URL." + " The configuration value should be a subclass of " + "`org.apache.kyuubi.engine.jdbc.connection.JdbcConnectionProvider`. " + "Kyuubi provides the following built-in implementations: " + "
  • doris: For establishing Doris connections.
  • " + "
  • mysql: For establishing MySQL connections.
  • " + "
  • phoenix: For establishing Phoenix connections.
  • " + "
  • postgresql: For establishing PostgreSQL connections.
  • " + "
  • starrocks: For establishing StarRocks connections.
  • ") .version("1.6.0") .stringConf .transform { case "Doris" | "doris" | "DorisConnectionProvider" => "org.apache.kyuubi.engine.jdbc.doris.DorisConnectionProvider" case "MySQL" | "mysql" | "MySQLConnectionProvider" => "org.apache.kyuubi.engine.jdbc.mysql.MySQLConnectionProvider" case "Phoenix" | "phoenix" | "PhoenixConnectionProvider" => "org.apache.kyuubi.engine.jdbc.phoenix.PhoenixConnectionProvider" case "PostgreSQL" | "postgresql" | "PostgreSQLConnectionProvider" => "org.apache.kyuubi.engine.jdbc.postgresql.PostgreSQLConnectionProvider" case "StarRocks" | "starrocks" | "StarRocksConnectionProvider" => "org.apache.kyuubi.engine.jdbc.starrocks.StarRocksConnectionProvider" case other => other } .createOptional ``` because the provider name transforms the fully qualified class name, but class simple name is compared ## Types of changes :bookmark: - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: I have passed this pull request at local integration testing #### Related Unit Tests --- # Checklist ๐Ÿ“ - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6037 from silencily/bugfix-jdbc-provider. Closes #6037 35b3dc7f3 [silencily] fix create Jdbc Engine error Authored-by: silencily Signed-off-by: Cheng Pan --- .../kyuubi/engine/jdbc/connection/JdbcConnectionProvider.scala | 2 +- .../kyuubi/engine/jdbc/doris/DorisConnectionProvider.scala | 2 +- .../kyuubi/engine/jdbc/mysql/MySQL8ConnectionProvider.scala | 2 +- .../kyuubi/engine/jdbc/mysql/MySQLConnectionProvider.scala | 2 +- .../kyuubi/engine/jdbc/phoenix/PhoenixConnectionProvider.scala | 2 +- .../engine/jdbc/postgresql/PostgreSQLConnectionProvider.scala | 2 +- .../engine/jdbc/starrocks/StarRocksConnectionProvider.scala | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/connection/JdbcConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/connection/JdbcConnectionProvider.scala index d6b2170be70..d6ff316ab6e 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/connection/JdbcConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/connection/JdbcConnectionProvider.scala @@ -26,7 +26,7 @@ import org.apache.kyuubi.engine.jdbc.util.SupportServiceLoader abstract class JdbcConnectionProvider extends SupportServiceLoader with Logging { - override def name(): String = classOf[JdbcConnectionProvider].getSimpleName + override def name(): String = classOf[JdbcConnectionProvider].getName val driverClass: String diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/doris/DorisConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/doris/DorisConnectionProvider.scala index c38bf784561..807eb6d8b74 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/doris/DorisConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/doris/DorisConnectionProvider.scala @@ -20,5 +20,5 @@ import org.apache.kyuubi.engine.jdbc.mysql.MySQL8ConnectionProvider class DorisConnectionProvider extends MySQL8ConnectionProvider { - override val name: String = classOf[DorisConnectionProvider].getSimpleName + override val name: String = classOf[DorisConnectionProvider].getName } diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQL8ConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQL8ConnectionProvider.scala index 563d5758bdc..f96dff10784 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQL8ConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQL8ConnectionProvider.scala @@ -20,7 +20,7 @@ import org.apache.kyuubi.engine.jdbc.connection.JdbcConnectionProvider class MySQL8ConnectionProvider extends JdbcConnectionProvider { - override val name: String = classOf[MySQL8ConnectionProvider].getSimpleName + override val name: String = classOf[MySQL8ConnectionProvider].getName override val driverClass: String = MySQL8ConnectionProvider.driverClass diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQLConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQLConnectionProvider.scala index bd57d1f53e5..921f7b62d1b 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQLConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/mysql/MySQLConnectionProvider.scala @@ -18,5 +18,5 @@ package org.apache.kyuubi.engine.jdbc.mysql class MySQLConnectionProvider extends MySQL8ConnectionProvider { - override val name: String = classOf[MySQLConnectionProvider].getSimpleName + override val name: String = classOf[MySQLConnectionProvider].getName } diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/phoenix/PhoenixConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/phoenix/PhoenixConnectionProvider.scala index 444e83d06ac..95c6f1c0040 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/phoenix/PhoenixConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/phoenix/PhoenixConnectionProvider.scala @@ -20,7 +20,7 @@ import org.apache.kyuubi.engine.jdbc.connection.JdbcConnectionProvider class PhoenixConnectionProvider extends JdbcConnectionProvider { - override val name: String = classOf[PhoenixConnectionProvider].getSimpleName + override val name: String = classOf[PhoenixConnectionProvider].getName override val driverClass: String = "org.apache.phoenix.queryserver.client.Driver" diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/postgresql/PostgreSQLConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/postgresql/PostgreSQLConnectionProvider.scala index 3fb392795d1..a11e5776828 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/postgresql/PostgreSQLConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/postgresql/PostgreSQLConnectionProvider.scala @@ -20,7 +20,7 @@ import org.apache.kyuubi.engine.jdbc.connection.JdbcConnectionProvider class PostgreSQLConnectionProvider extends JdbcConnectionProvider { - override val name: String = classOf[PostgreSQLConnectionProvider].getSimpleName + override val name: String = classOf[PostgreSQLConnectionProvider].getName override val driverClass: String = "org.postgresql.Driver" diff --git a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/starrocks/StarRocksConnectionProvider.scala b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/starrocks/StarRocksConnectionProvider.scala index 09b7efb3ff5..2712d3a1572 100644 --- a/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/starrocks/StarRocksConnectionProvider.scala +++ b/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/starrocks/StarRocksConnectionProvider.scala @@ -20,5 +20,5 @@ import org.apache.kyuubi.engine.jdbc.mysql.MySQL8ConnectionProvider class StarRocksConnectionProvider extends MySQL8ConnectionProvider { - override val name: String = classOf[StarRocksConnectionProvider].getSimpleName + override val name: String = classOf[StarRocksConnectionProvider].getName }