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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org