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
// 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)
}
}
}