KurtYoung commented on a change in pull request #15374:
URL: https://github.com/apache/flink/pull/15374#discussion_r602693430
##########
File path:
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/data/DecimalDataUtils.java
##########
@@ -208,23 +205,8 @@ public static boolean castToBoolean(DecimalData dec) {
return dec.toBigDecimal().compareTo(BigDecimal.ZERO) != 0;
}
- public static TimestampData castToTimestamp(DecimalData dec) {
- BigDecimal bd = dec.toBigDecimal().multiply(new
BigDecimal(MILLS_PER_SECOND));
- long mills = bd.longValue();
- int nanos =
- bd.remainder(BigDecimal.ONE)
- .multiply(new BigDecimal(NANOS_PER_MILLISECOND))
- .intValue();
- return TimestampData.fromEpochMillis(mills, nanos);
- }
-
- public static DecimalData castFrom(TimestampData val, int precision, int
scale) {
- BigDecimal decimalSeconds =
- new BigDecimal(val.getMillisecond())
- .multiply(new BigDecimal(NANOS_PER_MILLISECOND))
- .add(new BigDecimal(val.getNanoOfMillisecond()))
- .divide(new BigDecimal(NANOS_PER_SECOND));
- return fromBigDecimal(decimalSeconds, precision, scale);
+ public static long castToTimestamp(DecimalData dec) {
Review comment:
why change this?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]