This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit ceef048cc17a6ee49fd0c50adb9dcba7c1971664 Author: ChinaYiGuan <91529181+chinayig...@users.noreply.github.com> AuthorDate: Fri Sep 8 10:49:35 2023 +0800 [Fix](catalog) Doris datetime type conversion failed (#23906) 1. The catalog is connected to an old version of Doris, and an error is reported when using the datetime field type on the Doris surface . 2. error message [fe]: Caused by: java.lang.NumberFormatException: For input string: "DATETIM" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_291] at java.lang.Integer.parseInt(Integer.java:580) ~[?:1.8.0_291] at java.lang.Integer.parseInt(Integer.java:615) ~[?:1.8.0_291] at org.apache.doris.datasource.jdbc.client.JdbcMySQLClient.dorisTypeToDoris(JdbcMySQLClient.java:401) ~[doris-fe.jar:1.2- SNAPSHOT] --- .../java/org/apache/doris/datasource/jdbc/client/JdbcMySQLClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcMySQLClient.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcMySQLClient.java index 7004309d2d..a58ac1a350 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcMySQLClient.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/client/JdbcMySQLClient.java @@ -400,7 +400,8 @@ public class JdbcMySQLClient extends JdbcClient { return ScalarType.createDateV2Type(); case "DATETIME": case "DATETIMEV2": { - int scale = Integer.parseInt(upperType.substring(openParen + 1, upperType.length() - 1)); + int scale = (openParen == -1) ? 6 + : Integer.parseInt(upperType.substring(openParen + 1, upperType.length() - 1)); if (scale > 6) { scale = 6; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org