morrySnow commented on code in PR #24854:
URL: https://github.com/apache/doris/pull/24854#discussion_r1336529163
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java:
##########
@@ -48,9 +51,30 @@ public DateTimeV2Literal(long year, long month, long day,
long hour, long minute
super(DateTimeV2Type.SYSTEM_DEFAULT, year, month, day, hour, minute,
second, microSecond);
}
- public DateTimeV2Literal(DateTimeV2Type dataType,
+ public DateTimeV2Literal(DateTimeV2Type dateType,
long year, long month, long day, long hour, long minute, long
second, long microSecond) {
- super(dataType, year, month, day, hour, minute, second, microSecond);
+ super(dateType, year, month, day, hour, minute, second, microSecond);
+ roundMicroSecond(dateType.getScale());
+ }
+
+ private void roundMicroSecond(int scale) {
+ Preconditions.checkArgument(scale >= 0 && scale <=
DateTimeV2Type.MAX_SCALE,
+ "invalid datetime v2 scale: " + scale);
Review Comment:
it is better to use msg format template
```suggestion
Preconditions.checkArgument(scale >= 0 && scale <=
DateTimeV2Type.MAX_SCALE,
"invalid datetime v2 scale: %s", scale);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]