我需要将WHERE子句中的主机数量作为偏移量传递给"Neighbor"语句,但当我运行以下语句时:
WITH (
SELECT COUNT(distinct hostname)
FROM data.table
WHERE timestamp >= (NOW() - INTERVAL 1 HOUR)
AND hostname IN ('host1', 'host2')
) AS req_hosts
SELECT NEIGHBOR(current_val, req_hosts) AS prev_val,
(100 - ((current_val - prev_val)/ 60)* 100)
FROM data.table
WHERE hostname IN ('host1', 'host2');
我收到错误:
代码:43.DB::异常:函数Neighbor的第二个参数的非法类型Null(UInt64)-应为整数:处理(Neighbor(Current_val,_cast(163980,‘Nullable(UInt64)’)as Req_Hosts)as prev_val)!=0.(非法参数类型)
我try 使用toUnIt64()/toInt64(),它仍然显示Nullable(Int64)是非法的.请帮帮忙.
先谢谢你.