From 080bcf2ac5edbc6bffff4b847bb4e4c830a1f408 Mon Sep 17 00:00:00 2001 From: Feng Liyuan Date: Thu, 23 Apr 2020 11:13:33 +0800 Subject: [PATCH] planner: add commemt to explain why we need InjectProjBelowAgg (#16670) --- planner/core/rule_inject_extra_projection.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/planner/core/rule_inject_extra_projection.go b/planner/core/rule_inject_extra_projection.go index b13278750d..ec0dbd31c0 100644 --- a/planner/core/rule_inject_extra_projection.go +++ b/planner/core/rule_inject_extra_projection.go @@ -66,9 +66,10 @@ func wrapCastForAggFuncs(sctx sessionctx.Context, aggFuncs []*aggregation.AggFun } } -// InjectProjBelowAgg injects a ProjOperator below AggOperator. If all the args -// of `aggFuncs`, and all the item of `groupByItems` are columns or constants, -// we do not need to build the `proj`. +// InjectProjBelowAgg injects a ProjOperator below AggOperator. So that All +// scalar functions in aggregation may speed up by vectorized evaluation in +// the `proj`. If all the args of `aggFuncs`, and all the item of `groupByItems` +// are columns or constants, we do not need to build the `proj`. func InjectProjBelowAgg(aggPlan PhysicalPlan, aggFuncs []*aggregation.AggFuncDesc, groupByItems []expression.Expression) PhysicalPlan { hasScalarFunc := false