提交 2d1d919c authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Make optimized type of Function.TRUNCATE consistent with its result

上级 fb146f24
......@@ -2324,20 +2324,24 @@ public class Function extends Expression implements FunctionCall {
d = displaySize;
break;
case TRUNCATE:
t = p0.getType();
s = p0.getScale();
p = p0.getPrecision();
d = p0.getDisplaySize();
if (t == Value.NULL) {
t = Value.INT;
p = ValueInt.PRECISION;
d = ValueInt.DISPLAY_SIZE;
switch (p0.getType()) {
case Value.STRING:
case Value.DATE:
case Value.TIMESTAMP:
t = Value.TIMESTAMP;
p = d = ValueTimestamp.DEFAULT_PRECISION;
s = 0;
break;
case Value.TIMESTAMP_TZ:
t = Value.TIMESTAMP;
p = d = ValueTimestampTimeZone.DEFAULT_PRECISION;
s = 0;
} else if (t == Value.TIMESTAMP) {
t = Value.DATE;
p = ValueDate.PRECISION;
break;
default:
t = Value.DOUBLE;
s = 0;
d = ValueDate.PRECISION;
p = ValueDouble.PRECISION;
d = ValueDouble.DISPLAY_SIZE;
}
break;
case ABS:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论