aggregation functions' argument may already has been cast to numeric (#7876)

This commit is contained in:
Yao Zongyou 2019-07-06 01:38:38 +08:00 committed by Harshavardhana
parent 037319066f
commit 60831e3299

View File

@ -103,12 +103,14 @@ func (e *FuncExpr) evalAggregationNode(r Record) error {
// Here, we diverge from Amazon S3 behavior by // Here, we diverge from Amazon S3 behavior by
// inferring untyped values are numbers. // inferring untyped values are numbers.
if i, ok := argVal.bytesToInt(); ok { if !argVal.isNumeric() {
argVal.setInt(i) if i, ok := argVal.bytesToInt(); ok {
} else if f, ok := argVal.bytesToFloat(); ok { argVal.setInt(i)
argVal.setFloat(f) } else if f, ok := argVal.bytesToFloat(); ok {
} else { argVal.setFloat(f)
return errNonNumericArg(funcName) } else {
return errNonNumericArg(funcName)
}
} }
} }