如图所示,由于百分位数确定的方式默认是通过线性拟合再代入0.8分位点得到的结果,因此通过S>quantile(S,0.8)筛选出来的数据数量并不确定。
select SecurityID,TradeDate,aggrTopN(func=abs, funcArgs=CLOSE, sortingCol=CLOSE, top=0.20, ascending=false) as res from data group by SecurityID
与
defg compute_part(CLOSE)
{
index = at(CLOSE>quantile(CLOSE,0.8))
return abs(CLOSE[index])
}
select SecurityID,TradeDate,computer(CLOSE) as res from data group by SecurityID
结果为什么会不一样?