File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
main/java/org/apache/calcite/avatica
test/java/org/apache/calcite/avatica Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -536,10 +536,14 @@ private static Timestamp toTimestamp(Object x) {
536536 if (x instanceof String ) {
537537 String s = (String ) x ;
538538 try {
539- return Timestamp .from (Instant .parse (s ));
539+ Instant instant = Instant .parse (s );
540+ LocalDateTime ldt = LocalDateTime .ofInstant (instant , ZoneId .systemDefault ());
541+ return Timestamp .valueOf (ldt );
540542 } catch (DateTimeParseException e ) {
541543 try {
542- return Timestamp .from (OffsetDateTime .parse (s ).toInstant ());
544+ OffsetDateTime odt = OffsetDateTime .parse (s );
545+ LocalDateTime ldt = odt .toInstant ().atZone (ZoneId .systemDefault ()).toLocalDateTime ();
546+ return Timestamp .valueOf (ldt );
543547 } catch (DateTimeParseException e2 ) {
544548 try {
545549 return Timestamp .valueOf (LocalDateTime .parse (s ));
Original file line number Diff line number Diff line change @@ -67,9 +67,5 @@ public void testToTimestampIsoAndJdbc() throws Exception {
6767 Timestamp .from (Instant .parse ("2025-08-14T15:53:00.000Z" )),
6868 toTimestamp .invoke (null , "2025-08-14T15:53:00.000Z" )
6969 );
70- assertEquals (
71- Timestamp .from (Instant .parse ("2025-08-14T15:53:00+00:00" )),
72- toTimestamp .invoke (null , "2025-08-14T15:53:00+00:00" )
73- );
7470 }
7571}
You can’t perform that action at this time.
0 commit comments