From 408c42e8a1d39b531081e0359b7f4a9e578222a0 Mon Sep 17 00:00:00 2001 From: wshwsh12 <793703860@qq.com> Date: Wed, 17 May 2023 15:43:17 +0800 Subject: [PATCH] fix --- expression/builtin_cast.go | 5 ----- planner/core/rule_aggregation_push_down.go | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/expression/builtin_cast.go b/expression/builtin_cast.go index 92e27b2458a36..a548c06fa342e 100644 --- a/expression/builtin_cast.go +++ b/expression/builtin_cast.go @@ -1971,11 +1971,6 @@ func WrapWithCastAsInt(ctx sessionctx.Context, expr Expression) Expression { tp.SetDecimal(0) types.SetBinChsClnFlag(tp) tp.AddFlag(expr.GetType().GetFlag() & mysql.UnsignedFlag) - - if expr.GetType().GetType() == mysql.TypeNull { - tp.SetType(mysql.TypeLong) - tp.AddFlag(mysql.UnsignedFlag) - } return BuildCastFunction(ctx, expr, tp) } diff --git a/planner/core/rule_aggregation_push_down.go b/planner/core/rule_aggregation_push_down.go index c9326929b550f..c91b0f2280e68 100644 --- a/planner/core/rule_aggregation_push_down.go +++ b/planner/core/rule_aggregation_push_down.go @@ -538,6 +538,13 @@ func (a *aggregationPushDownSolver) aggPushDown(p LogicalPlan, opt *logicalOptim newAggFuncsArgs = append(newAggFuncsArgs, newArgs) } } + for i, funcsArgs := range oldAggFuncsArgs { + for j := range funcsArgs { + if oldAggFuncsArgs[i][j].GetType().EvalType() != newAggFuncsArgs[i][j].GetType().EvalType() { + noSideEffects = false + } + } + } if noSideEffects { agg.GroupByItems = newGbyItems for i, aggFunc := range agg.AggFuncs {