github-actions[bot] commented on code in PR #65319:
URL: https://github.com/apache/doris/pull/65319#discussion_r3557141669
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java:
##########
@@ -558,7 +558,7 @@ private static int compareFloatLiteral(FloatLiteral first,
FloatLiteral... secon
float firstValue = first.getValue();
for (int i = 0; i < second.length; i++) {
float secondValue = second[i].getValue();
- if (secondValue == firstValue) {
+ if (Float.compare(firstValue, secondValue) == 0) {
return i + 1;
Review Comment:
`Float.compare`/`Double.compare` also changes signed-zero equality. Java
treats `-0.0` and `0.0` as different here, so FE folding makes `field(cast('-0'
as float), cast('0' as float))` return 0. BE execution still routes
FLOAT/DOUBLE `field` through `FunctionFieldImpl::insert_result_data` ->
`EqualsOp<PType>::apply` -> `Compare::equal`, and that uses normal `left ==
right` semantics except for the explicit NaN case, so signed zeros match and BE
returns 1. Please preserve the BE signed-zero behavior while keeping the
intended NaN handling, and add a fold-consistency case for the float and double
signed-zero variants.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/StrToDate.java:
##########
@@ -107,6 +110,25 @@ public FunctionSignature
computeSignature(FunctionSignature signature) {
return signature.withReturnType(returnType);
}
+ private StringLikeLiteral getConstantFormatLiteral() {
+ Expression format = getArgument(1);
+ if (!format.isConstant()) {
+ return null;
+ }
+ if (!format.getDataType().isStringLikeType()) {
+ format = new Cast(format, StringType.INSTANCE);
+ }
+ if (format instanceof StringLikeLiteral) {
+ return (StringLikeLiteral) format;
+ }
+ Expression evaluated = ExpressionEvaluator.INSTANCE.eval(format);
+ if (evaluated instanceof StringLikeLiteral) {
+ return (StringLikeLiteral) evaluated;
+ }
+ return null;
+ }
+
+
/**
Review Comment:
FE checkstyle disallows multiple empty lines inside class members:
`EmptyLineSeparator` has `allowMultipleEmptyLines=false` and
`allowMultipleEmptyLinesInsideClassMembers=false`. This adds two blank
separators before the `withChildren` javadoc, so the FE style gate should fail
here. Please remove one of the empty lines.
--
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]