DBZ-8142 Clean-up casting to be type-safe

This commit is contained in:
Chris Cranford 2024-09-03 06:46:14 -04:00 committed by Jiri Pechanec
parent 421be19ffe
commit b15ce52021

View File

@ -115,7 +115,7 @@ protected Object convertTimestampWithZone(Column column, Field fieldDefn, Object
@Override
protected Object convertTimestampWithLocalZone(Column column, Field fieldDefn, Object value) {
if (value instanceof Number) {
final Instant instant = Instant.ofEpochSecond(0, (Long) value);
final Instant instant = Instant.ofEpochSecond(0, ((Number) value).longValue());
return getTimestampWithLocalTimeZoneFormatter(column).format(OffsetDateTime.ofInstant(instant, ZoneOffset.UTC));
}
return super.convertTimestampWithLocalZone(column, fieldDefn, value);
@ -160,12 +160,12 @@ private Object convertTimestampValue(Column column, Object value) {
value = ((BigInteger) value).divide(BigInteger.valueOf(1_000_000L)).longValue();
}
else {
value = ((Long) value) / 1_000_000L;
value = ((Number) value).longValue() / 1_000_000L;
}
}
else {
// TIMESTAMP(n)
value = Instant.ofEpochSecond(0, (Long) value);
value = Instant.ofEpochSecond(0, ((Number) value).longValue());
}
return value;
}