From 60831e32992b1e90eca65d35cf03d69f561c42cb Mon Sep 17 00:00:00 2001 From: Yao Zongyou Date: Sat, 6 Jul 2019 01:38:38 +0800 Subject: [PATCH] aggregation functions' argument may already has been cast to numeric (#7876) --- pkg/s3select/sql/aggregation.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/s3select/sql/aggregation.go b/pkg/s3select/sql/aggregation.go index 445eed567..930672096 100644 --- a/pkg/s3select/sql/aggregation.go +++ b/pkg/s3select/sql/aggregation.go @@ -103,12 +103,14 @@ func (e *FuncExpr) evalAggregationNode(r Record) error { // Here, we diverge from Amazon S3 behavior by // inferring untyped values are numbers. - if i, ok := argVal.bytesToInt(); ok { - argVal.setInt(i) - } else if f, ok := argVal.bytesToFloat(); ok { - argVal.setFloat(f) - } else { - return errNonNumericArg(funcName) + if !argVal.isNumeric() { + if i, ok := argVal.bytesToInt(); ok { + argVal.setInt(i) + } else if f, ok := argVal.bytesToFloat(); ok { + argVal.setFloat(f) + } else { + return errNonNumericArg(funcName) + } } }