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