I am trying to launch this sql with hql and it doesn't work due to '* interval' expression.
The sql calculates the avg in 5 mins intervals.
How could be changed the sql to make it works with hql?
SELECT date_trunc('hour', update_timestamp) + (( cast (date_part('minute', update_timestamp) as int) / 5) +1) * interval '5 min' AS minute
, sum(t.free_spaces) as orders_count
FROM myTable t
GROUP BY 1 ORDER BY 1 ASC
2条答案
按热度按时间kq0g1dla1#
Hql不支持
interval
。您必须使用between
。如果需要,您也可以使用本机查询。cbwuti442#
您可以使用make_interval函数。
我发现它可以与HQL查询一起工作,您可以像这样定义参数:
make_interval(年数)
make_interval(天=天数)
有关make_interval的更多信息,请参考以下网站:https://pgpedia.info/m/make_interval.html