roryqi commented on code in PR #13942:
URL: https://github.com/apache/gravitino/pull/13942#discussion_r4313057802
##########
server/src/main/java/org/apache/gravitino/server/web/rest/CatalogOperations.java:
##########
@@ -168,7 +168,8 @@ public Response createCatalog(
request.getType(),
request.getProvider(),
request.getComment(),
- request.getProperties(),
+ JdbcDriverProperties.withDefaultDriver(
+ request.getProvider(), request.getProperties()),
Review Comment:
Fixed in 0401e819a6. Driver defaulting now runs in
CatalogManager.buildCatalogConf() after the provider configuration is merged,
so both create and testConnection preserve a jdbc-driver from the request or
provider config. Added a regression test for both precedence cases.
##########
server/src/main/java/org/apache/gravitino/server/web/rest/JdbcDriverProperties.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+package org.apache.gravitino.server.web.rest;
+
+import com.google.common.collect.ImmutableMap;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import javax.annotation.Nullable;
+
+/** Adds the known JDBC driver class to catalog properties when the caller
omits it. */
+public final class JdbcDriverProperties {
+
+ private static final String JDBC_DRIVER = "jdbc-driver";
+ private static final Map<String, String> PROVIDER_DRIVERS =
+ ImmutableMap.<String, String>builder()
+ .put("jdbc-clickhouse", "com.clickhouse.jdbc.ClickHouseDriver")
+ .put("jdbc-doris", "com.mysql.cj.jdbc.Driver")
+ .put("jdbc-hologres", "org.postgresql.Driver")
+ .put("jdbc-mysql", "com.mysql.cj.jdbc.Driver")
+ .put("jdbc-oceanbase", "com.mysql.cj.jdbc.Driver")
Review Comment:
Fixed in 0401e819a6. For jdbc-oceanbase, the default now follows jdbc-url:
jdbc:oceanbase: selects com.oceanbase.jdbc.Driver, while jdbc:mysql: selects
com.mysql.cj.jdbc.Driver. Added tests for both URL schemes and an unknown
scheme.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]