From 035e9663ea7e42016d4e5a3f21cbdea8c742e380 Mon Sep 17 00:00:00 2001 From: Zhi Qi Date: Fri, 13 Aug 2021 03:14:35 +0800 Subject: [PATCH 1/2] fix --- planner/core/logical_plan_builder.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index 7ce827d86ac79..cb5a38b2b3d8e 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -5189,7 +5189,7 @@ func (b *PlanBuilder) buildProjectionForWindow(ctx context.Context, p LogicalPla p = np switch newArg.(type) { case *expression.Column, *expression.Constant: - newArgList = append(newArgList, newArg) + newArgList = append(newArgList, newArg.Clone()) continue } proj.Exprs = append(proj.Exprs, newArg) From 6a2230c831dfb6e37199bb80c38d86ac58e8c392 Mon Sep 17 00:00:00 2001 From: Zhi Qi Date: Fri, 13 Aug 2021 04:00:46 +0800 Subject: [PATCH 2/2] fix --- expression/aggregation/base_func.go | 2 +- planner/core/logical_plan_builder.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/expression/aggregation/base_func.go b/expression/aggregation/base_func.go index eef2c144361ea..731bc265736c7 100644 --- a/expression/aggregation/base_func.go +++ b/expression/aggregation/base_func.go @@ -434,7 +434,7 @@ func (a *baseFuncDesc) WrapCastForAggArgs(ctx sessionctx.Context) { if col, ok := a.Args[i].(*expression.Column); ok { col.RetType = types.NewFieldType(col.RetType.Tp) } - // originTp is used when the the `Tp` of column is TypeFloat32 while + // originTp is used when the `Tp` of column is TypeFloat32 while // the type of the aggregation function is TypeFloat64. originTp := a.Args[i].GetType().Tp *(a.Args[i].GetType()) = *(a.RetTp) diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index cb5a38b2b3d8e..a9a3978329c2b 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -5221,7 +5221,7 @@ func (b *PlanBuilder) buildArgs4WindowFunc(ctx context.Context, p LogicalPlan, a p = np switch newArg.(type) { case *expression.Column, *expression.Constant: - newArgList = append(newArgList, newArg) + newArgList = append(newArgList, newArg.Clone()) continue } col := &expression.Column{