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,6 +103,7 @@ 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 !argVal.isNumeric() {
if i, ok := argVal.bytesToInt(); ok { if i, ok := argVal.bytesToInt(); ok {
argVal.setInt(i) argVal.setInt(i)
} else if f, ok := argVal.bytesToFloat(); ok { } else if f, ok := argVal.bytesToFloat(); ok {
@ -111,6 +112,7 @@ func (e *FuncExpr) evalAggregationNode(r Record) error {
return errNonNumericArg(funcName) return errNonNumericArg(funcName)
} }
} }
}
// Mark that we have seen one non-null value. // Mark that we have seen one non-null value.
isFirstRow := false isFirstRow := false