xtern commented on code in PR #3229:
URL: https://github.com/apache/ignite-3/pull/3229#discussion_r1499091401
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/TypeUtils.java:
##########
@@ -285,8 +285,7 @@ private static boolean hasConvertableFields(RelDataType
resultType) {
} else if (storageType == LocalTime.class && val instanceof Integer) {
return
LocalTime.ofNanoOfDay(TimeUnit.MILLISECONDS.toNanos(Long.valueOf((Integer)
val)));
} else if (storageType == LocalDateTime.class && (val instanceof
Long)) {
- return
LocalDateTime.ofEpochSecond(TimeUnit.MILLISECONDS.toSeconds((Long) val),
- (int) TimeUnit.MILLISECONDS.toNanos((Long) val % 1000),
ZoneOffset.UTC);
+ return LocalDateTime.ofInstant(Instant.ofEpochMilli((long) val),
ZoneOffset.UTC);
Review Comment:
Computation of nanoseconds was incorrect for negative `val`.
```
SELECT timestamp '1969-01-01 02:30:00.123'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]