你好, 我有一个sql, select marketCode as market_code, CURRENT_TIMESTAMP as process_time, sum((CASE WHEN msgType = 'FUTURE' THEN matchedPrice WHEN msgType = 'SPOT' THEN matchedPrice ELSE 0.5 * (leg1Price + leg2Price) END) * matchedQty) as volume, sum(matchedQty) as currency_volume, first_value(matchedPrice) over (partition by marketCode ORDER BY transTime) as vopen, max(matchedPrice) as vhigh, min(matchedPrice) as vlow, last_value(matchedPrice) over (partition by marketCode ORDER BY transTime) as vclose from TickData where action = 'OrderMatched' and side = 'BUY' group by marketCode, HOP(transTime, INTERVAL '1' SECOND, INTERVAL '24' hour)
执行的时候报, matchedPrice not being grouped, 我的理解matchedPrice也是group function里的, 为什么还要在group里, 如果加了这个group column,我的结果会不对。 还是说我用的first/last 聚合函数错了? 我想要的是这个窗口的最早和最晚的那个值。 谢谢! -- Sent from: http://apache-flink.147419.n8.nabble.com/