wuchong commented on code in PR #2277:
URL: https://github.com/apache/fluss/pull/2277#discussion_r2659720253
##########
fluss-common/src/main/java/org/apache/fluss/row/TimestampNtz.java:
##########
@@ -70,6 +71,18 @@ public int getNanoOfMillisecond() {
return nanoOfMillisecond;
}
+ /**
+ * Creates an instance of {@link TimestampNtz} from microseconds.
+ *
+ * <p>The nanos-of-millisecond field will be set to zero.
+ *
+ * @param microseconds the number of microseconds since {@code 1970-01-01
00:00:00}; a negative
+ * number is the number of microseconds before {@code 1970-01-01
00:00:00}
+ */
+ public static TimestampNtz fromMicros(long microseconds) {
+ return new TimestampNtz(Math.floorDiv(microseconds,
MICROS_PER_MILLIS), 0);
Review Comment:
Why not convert the microsecond component to nanoseconds? From my
perspective, using zero would actually lose precision. The method
`org.apache.fluss.row.TimestampLtz#fromEpochMicros` intentionally preserves the
full microsecond resolution, maybe we can use the same implementation here?
--
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]