这是我写的公式↓
count(if(avg(timestamp_diff(broker_delivery_date,request_datetime,minute)),0) >= 30,id,NULL)
这是不断出现的错误↓
对于参数类型为FLOAT64,INT64。支持的签名:IF(BOOL,ANY,ANY)在[10:10]
假设您的问题是“为什么会这样?”]]
IF(BOOL, ANY, ANY)
需要三个参数。您只给它两个。它是这样处理的:
count(if( avg(timestamp_diff(broker_delivery_date,request_datetime,minute)), <-- This is not a BOOL 0 <-- This is the second parameter to if ) >= 30, <-- This is a BOOL as the first parameter to count id, <-- This is a second parameter to count NULL) <-- This is the third parameter to count
尝试一下(免责声明:未测试):
count(if(avg(timestamp_diff(broker_delivery_date,request_datetime,minute)) >= 30,
1,
NULL)
)
IF
语句需要一个boolean
表达式。您在错误的位置关闭了括号,如下所示,这导致IF参数为FLOAT
(AVG结果)而不是表达式AVG(...) >= 30
如您所料。