Gabriel39 commented on code in PR #21371: URL: https://github.com/apache/doris/pull/21371#discussion_r1251416094
########## fe/fe-core/src/main/java/org/apache/doris/nereids/types/TimeV2Type.java: ########## @@ -28,13 +29,26 @@ public class TimeV2Type extends PrimitiveType { public static final TimeV2Type INSTANCE = new TimeV2Type(); private static final int WIDTH = 8; + private final int scale; + + private TimeV2Type(int scale) { + this.scale = scale; + } private TimeV2Type() { + scale = 6; Review Comment: Why is 6? ########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TimeDiff.java: ########## @@ -46,8 +48,7 @@ public class TimeDiff extends ScalarFunction FunctionSignature.ret(TimeType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE), FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT), - FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE) - ); + FunctionSignature.ret(TimeType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)); Review Comment: ```suggestion FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)); ``` ########## fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java: ########## @@ -1559,6 +1559,13 @@ && collectChildReturnTypes()[0].isDecimalV3()) { } if (fn.getFunctionName().getFunction().equals("timediff")) { fn.getReturnType().getPrimitiveType().setTimeType(); + ScalarType left = (ScalarType) argTypes[0]; + ScalarType rigth = (ScalarType) argTypes[1]; + if (left.isDatetimeV2() || rigth.isDatetimeV2()) { Review Comment: also for datev2 ########## fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java: ########## @@ -432,7 +434,7 @@ public static ScalarType createTimeType() { if (!Config.enable_date_conversion) { return new ScalarType(PrimitiveType.TIME); } - ScalarType type = new ScalarType(PrimitiveType.TIMEV2); + ScalarType type = new ScalarType(PrimitiveType.TIME); Review Comment: Why make this change? -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org