Ниже для BigQuery Standard SQL
#standardSQL
SELECT ISSUEID, user, SUM(timespent) timespent
FROM (
SELECT ISSUEID, user, TIMESTAMP_DIFF(MAX(time), MIN(time), SECOND) timespent
FROM (
SELECT *, COUNTIF(start) OVER(ORDER BY time) grp
FROM (
SELECT *, IFNULL(LAG(User) OVER(ORDER BY time), '') != User AS start
FROM `project.dataset.table`
)
)
GROUP BY ISSUEID, user, grp
)
GROUP BY ISSUEID, user