Vladimir Prus created PHOENIX-4564:
--------------------------------------
Summary: AVG function always returns BigDecimal
Key: PHOENIX-4564
URL: https://issues.apache.org/jira/browse/PHOENIX-4564
Project: Phoenix
Issue Type: Bug
Reporter: Vladimir Prus
Per documentation for 'AVG' function:
The average (mean) value. If no rows are selected, the result is {{NULL}}.
Aggregates are only allowed in select statements. The returned value is of the
same data type as the parameter.
However, the code at
[https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/expression/function/AvgAggregateFunction.java]
actually returns BigDecimal, no matter what. That is inconsistent with
documentation, and user expectations, and I'm not sure what benefits it brings.
Say, in Hive 'avg' does return the same type as the expression, and it works
fine.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)