This is an automated email from the ASF dual-hosted git repository.

zykkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f498beed07 [improvement](jdbc)Support for automatically obtaining the 
precision of the trino/presto timestamp type (#21386)
f498beed07 is described below

commit f498beed07129e5964e996f65cedfed6bb4edafc
Author: zy-kkk <[email protected]>
AuthorDate: Tue Jul 4 18:59:42 2023 +0800

    [improvement](jdbc)Support for automatically obtaining the precision of the 
trino/presto timestamp type (#21386)
---
 .../main/java/org/apache/doris/external/jdbc/JdbcTrinoClient.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/external/jdbc/JdbcTrinoClient.java 
b/fe/fe-core/src/main/java/org/apache/doris/external/jdbc/JdbcTrinoClient.java
index f971fc540c..cf3495709a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/external/jdbc/JdbcTrinoClient.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/external/jdbc/JdbcTrinoClient.java
@@ -79,8 +79,11 @@ public class JdbcTrinoClient extends JdbcClient {
         }
 
         if (trinoType.startsWith("timestamp")) {
-            // timestamp with picoseconds precision, will lose precision
-            return ScalarType.createDatetimeV2Type(JDBC_DATETIME_SCALE);
+            int scale = fieldSchema.getDecimalDigits();
+            if (scale > 6) {
+                scale = 6;
+            }
+            return ScalarType.createDatetimeV2Type(scale);
         }
 
         if (trinoType.startsWith("array")) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to