[vectorized](bug) fix some case in enable fold constant (#17997)

fix some case in enable fold constant
This commit is contained in:
zhangstar333
2023-03-31 11:41:31 +08:00
committed by GitHub
parent f800ba8f4c
commit 1b2aaab2f2
19 changed files with 58 additions and 70 deletions

View File

@ -46,6 +46,7 @@ import org.apache.doris.thrift.TFoldConstantParams;
import org.apache.doris.thrift.TNetworkAddress;
import org.apache.doris.thrift.TPrimitiveType;
import org.apache.doris.thrift.TQueryGlobals;
import org.apache.doris.thrift.TQueryOptions;
import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager;
@ -167,8 +168,13 @@ public class FoldConstantRuleOnBE extends AbstractExpressionRewriteRule {
queryGlobals.setTimeZone(context.getSessionVariable().getTimeZone());
}
TQueryOptions tQueryOptions = new TQueryOptions();
tQueryOptions.setRepeatMaxNum(context.getSessionVariable().repeatMaxNum);
TFoldConstantParams tParams = new TFoldConstantParams(paramMap, queryGlobals);
tParams.setVecExec(VectorizedUtil.isVectorized());
tParams.setQueryOptions(tQueryOptions);
tParams.setQueryId(context.queryId());
Future<PConstantExprResult> future =
BackendServiceProxy.getInstance().foldConstantExpr(brpcAddress, tParams);

View File

@ -237,7 +237,7 @@ public abstract class Literal extends Expression implements LeafExpression, Comp
} else if (targetType.isIntegerType()) {
return Literal.of(Double.valueOf(desc).intValue());
} else if (targetType.isBigIntType()) {
return Literal.of(Double.valueOf(desc).longValue());
return Literal.of(Long.valueOf(desc));
} else if (targetType.isLargeIntType()) {
return Literal.of(new BigDecimal(desc).toBigInteger());
} else if (targetType.isFloatType()) {

View File

@ -36,6 +36,7 @@ import org.apache.doris.catalog.ScalarType;
import org.apache.doris.catalog.Type;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.LoadException;
import org.apache.doris.common.util.DebugUtil;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.common.util.VectorizedUtil;
import org.apache.doris.proto.InternalService;
@ -420,9 +421,11 @@ public class FoldConstantsRule implements ExprRewriteRule {
}
} else {
LOG.warn("failed_fold_context.queryId(): " + DebugUtil.printId(context.queryId()));
LOG.warn("failed to get const expr value from be: {}", result.getStatus().getErrorMsgsList());
}
} catch (Exception e) {
LOG.warn("failed_fold_context.queryId(): " + DebugUtil.printId(context.queryId()));
LOG.warn("failed to get const expr value from be: {}", e.getMessage());
}
return resultMap;