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

master
Yao Zongyou 5 years ago committed by Harshavardhana
parent 037319066f
commit 60831e3299
  1. 14
      pkg/s3select/sql/aggregation.go

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

Loading…
Cancel
Save