我有以下Spark sql查询
SELECT count(*),
channel
FROM channelusage a
WHERE a.starttime>= windowstarttime
AND a.endtime <= windowendtime
GROUP BY channel
我必须为10个窗口生成这些计数。目前,我使用while循环来生成windowstarttime和windowendtime。
我想做的是-我想在sql查询本身中生成窗口,类似于类似于此的嵌套sql-
SELECT count(*),
channel
FROM channelusage a
WHERE (nested query logic)
GROUP BY channel
这样我得到的输出与此类似
windowstarttime | windowentime | channel | count
11:00:01 | 11:00:10 | ABC |2
11:00:11 | 11:00:20 | ABC |4
11:00:21 | 11:00:30 | NBC |10
11:00:31 | 11:00:40 | CNN |5