From 833aeb0218fc39b78d5f32b9bdcfccb6b930b558 Mon Sep 17 00:00:00 2001 From: rebelice Date: Fri, 7 Jan 2022 18:49:54 +0800 Subject: [PATCH] fix count(distinct) panic --- planner/core/common_plans.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/planner/core/common_plans.go b/planner/core/common_plans.go index 1ee885fc76e59..9df8879a6f84c 100644 --- a/planner/core/common_plans.go +++ b/planner/core/common_plans.go @@ -1738,7 +1738,7 @@ func BuildAWSQueryInfo(v *PhysicalTableReader, id int64) *RestoreData { info.GroupBy = buffer.String() if len(info.Col) == 0 { info.Col = info.GroupBy - } else { + } else if len(info.Agg) != 0 { info.Col = fmt.Sprintf("%v, %v", info.Col, info.GroupBy) } } @@ -1773,7 +1773,7 @@ func BuildAWSQueryInfo(v *PhysicalTableReader, id int64) *RestoreData { info.GroupBy = buffer.String() if len(info.Col) == 0 { info.Col = info.GroupBy - } else { + } else if len(info.Agg) != 0 { info.Col = fmt.Sprintf("%v, %v", info.Col, info.GroupBy) } }