提交 d858442f authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Result of EXTRACT with MCS and NS arguments fits into int

上级 2f63fe27
......@@ -1501,17 +1501,9 @@ public class Function extends Expression implements FunctionCall {
break;
case EXTRACT: {
int field = getDatePart(v0.getString());
switch (field) {
default:
if (field != EPOCH) {
result = ValueInt.get(getIntDatePart(v1, field));
break;
case Function.MICROSECOND:
result = ValueLong.get(DateTimeUtils.dateAndTimeFromValue(v1)[1] / 1_000 % 1_000_000);
break;
case Function.NANOSECOND:
result = ValueLong.get(DateTimeUtils.dateAndTimeFromValue(v1)[1] % 1_000_000_000);
break;
case EPOCH: {
} else {
// Case where we retrieve the EPOCH time.
// First we retrieve the dateValue and his time in nanoseconds.
......@@ -1556,7 +1548,6 @@ public class Function extends Expression implements FunctionCall {
result = ValueDecimal.get(timeNanosBigDecimal.divide(nanosSeconds).add(numberOfDays.multiply(secondsPerDay)));
}
}
}
break;
}
case FORMATDATETIME: {
......@@ -2897,6 +2888,10 @@ public class Function extends Expression implements FunctionCall {
return (int) (timeNanos / 1_000_000_000 % 60);
case Function.MILLISECOND:
return (int) (timeNanos / 1_000_000 % 1_000);
case Function.MICROSECOND:
return (int) (timeNanos / 1_000 % 1_000_000);
case Function.NANOSECOND:
return (int) (timeNanos % 1_000_000_000);
case Function.DAY_OF_YEAR:
return DateTimeUtils.getDayOfYear(dateValue);
case Function.DAY_OF_WEEK:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论