适用范围: NoSQL
返回指定数组表达式中元素的平均值。
Syntax
ARRAY_AVG(<array_expr>)  
Arguments
| Description | |
|---|---|
array_expr | 
数组表达式。 | 
返回类型
返回数值表达式。
例子
以下示例显示了对具有数值的数组使用此函数的结果。
SELECT VALUE {
    "case1": ARRAY_AVG([1, 2, 3, 4]),
    "case2": ARRAY_AVG([1.0, 2.0, 3.3, 4.7]),
    "case3": ARRAY_AVG([1, -2.7, 3, -4, undefined]),
    "case4": ARRAY_AVG(['abc', 'ABC', 'aBc', 'AbC']),
    "case5": ARRAY_AVG([12, 'abc', true, false, null, undefined])
}
[
    {
        "case1": 2.5,
        "case2": 2.75,
        "case3": -0.675
    }
]
注解
- 数组中的元素只能是数字。
 - 将忽略任何未定义值。
 - 此函数执行完全扫描。