[improvement](jdbc)Support for automatically obtaining the precision of the hana timestamp type (#21380)

This commit is contained in:
zy-kkk
2023-07-04 18:59:21 +08:00
committed by GitHub
parent b27fa70558
commit aec5bac498

View File

@ -58,9 +58,14 @@ public class JdbcSapHanaClient extends JdbcClient {
return Type.FLOAT;
case "DOUBLE":
return Type.DOUBLE;
case "TIMESTAMP":
// TIMESTAMP with 100 nanoseconds precision, will lose precision
return ScalarType.createDatetimeV2Type(6);
case "TIMESTAMP": {
// postgres can support microsecond
int scale = fieldSchema.getDecimalDigits();
if (scale > 6) {
scale = 6;
}
return ScalarType.createDatetimeV2Type(scale);
}
case "SECONDDATE":
// SECONDDATE with second precision
return ScalarType.createDatetimeV2Type(0);