You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/07 12:16:03 UTC

[GitHub] [doris] morningman commented on a diff in pull request #15692: [fix](multi-catalog) fix image loading failture when create catalog with resource

morningman commented on code in PR #15692:
URL: https://github.com/apache/doris/pull/15692#discussion_r1063997420


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java:
##########
@@ -189,29 +190,61 @@ private void computeObjectChecksum() throws DdlException {
                 }
                 digest.update(buf, 0, bytesRead);
             } while (true);
-            String checkSum = Hex.encodeHexString(digest.digest());
-            configs.put(CHECK_SUM, checkSum);
+            return Hex.encodeHexString(digest.digest());
         } catch (IOException e) {
-            throw new DdlException("compute driver checksum from url: " + getProperty(DRIVER_URL)
+            throw new DdlException("compute driver checksum from url: " + driverPath
                     + " meet an IOException: " + e.getMessage());
         } catch (NoSuchAlgorithmException e) {
-            throw new DdlException("compute driver checksum from url: " + getProperty(DRIVER_URL)
+            throw new DdlException("compute driver checksum from url: " + driverPath
                     + " could not find algorithm: " + e.getMessage());
         }
     }
 
-    private String getRealDriverPath() {
-        String path = getProperty(DRIVER_URL);
+    private static String getRealDriverPath(String driverUrl) {
         try {
-            URI uri = new URI(path);
+            URI uri = new URI(driverUrl);
             String schema = uri.getScheme();
-            if (schema == null && !path.startsWith("/")) {
-                return "file://" + Config.jdbc_drivers_dir + "/" + path;
+            if (schema == null && !driverUrl.startsWith("/")) {
+                return "file://" + Config.jdbc_drivers_dir + "/" + driverUrl;
             }
-            return path;
+            return driverUrl;
         } catch (URISyntaxException e) {
-            LOG.warn("invalid jdbc driver url: " + path);
-            return path;
+            LOG.warn("invalid jdbc driver url: " + driverUrl);
+            return driverUrl;
+        }
+    }
+
+
+    // 1. `yearIsDateType` is a parameter of JDBC, and the default is true.
+    // We force the use of `yearIsDateType=false`
+    // 2. `tinyInt1isBit` is a parameter of JDBC, and the default is true.
+    // We force the use of `tinyInt1isBit=false`, so that for mysql type tinyint,
+    // it will convert to Doris tinyint, not bit.
+    public static String handleJdbcUrl(String jdbcUrl) {
+        // delete all space in jdbcUrl
+        String newJdbcUrl = jdbcUrl.replaceAll(" ", "");
+        newJdbcUrl = checkJdbcUrlParam(newJdbcUrl, "yearIsDateType", "true", "false");
+        newJdbcUrl = checkJdbcUrlParam(newJdbcUrl, "tinyInt1isBit", "true", "false");
+        return newJdbcUrl;
+    }

Review Comment:
   Done



-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org