提交 98afcf54 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Treat EPOCH as SECOND in dateadd() and datediff()

上级 aa806abe
...@@ -1917,6 +1917,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1917,6 +1917,7 @@ public class Function extends Expression implements FunctionCall {
count *= 60_000_000_000L; count *= 60_000_000_000L;
break; break;
case SECOND: case SECOND:
case EPOCH:
count *= 1_000_000_000; count *= 1_000_000_000;
break; break;
case MILLISECOND: case MILLISECOND:
...@@ -1968,6 +1969,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1968,6 +1969,7 @@ public class Function extends Expression implements FunctionCall {
switch (field) { switch (field) {
case MILLISECOND: case MILLISECOND:
case SECOND: case SECOND:
case EPOCH:
case MINUTE: case MINUTE:
case HOUR: case HOUR:
long timeNanos1 = a1[1]; long timeNanos1 = a1[1];
...@@ -1977,6 +1979,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1977,6 +1979,7 @@ public class Function extends Expression implements FunctionCall {
return (absolute2 - absolute1) * DateTimeUtils.MILLIS_PER_DAY return (absolute2 - absolute1) * DateTimeUtils.MILLIS_PER_DAY
+ (timeNanos2 / 1_000_000 - timeNanos1 / 1_000_000); + (timeNanos2 / 1_000_000 - timeNanos1 / 1_000_000);
case SECOND: case SECOND:
case EPOCH:
return (absolute2 - absolute1) * 86_400 return (absolute2 - absolute1) * 86_400
+ (timeNanos2 / 1_000_000_000 - timeNanos1 / 1_000_000_000); + (timeNanos2 / 1_000_000_000 - timeNanos1 / 1_000_000_000);
case MINUTE: case MINUTE:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论