Skip to content

Commit fcb54d3

Browse files
authored
Merge pull request #321 from databendlabs/fix/getTimestamp-default
fix: getTimestamp should return null
2 parents 7691fd0 + 283703b commit fcb54d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

databend-jdbc/src/main/java/com/databend/jdbc/AbstractDatabendResultSet.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,13 @@ public Timestamp getTimestamp(int columnIndex)
573573
private Timestamp getTimestamp(int columnIndex, DateTimeZone localTimeZone)
574574
throws SQLException {
575575
Object value = column(columnIndex);
576+
576577
if (value == null || value.toString().equalsIgnoreCase("null")) {
577-
return new Timestamp(0);
578+
return null;
579+
}
580+
581+
if (localTimeZone == null || localTimeZone.getID() == null) {
582+
return parseTimestampAsSqlTimestamp((String) value, ZoneId.systemDefault());
578583
}
579584

580585
return parseTimestampAsSqlTimestamp((String) value, ZoneId.of(localTimeZone.getID()));

0 commit comments

Comments
 (0)