sql
SELECT
-- 成员id
distinct_id AS member_id,
-- 浏览时长
get_json_object(all_json, '$.properties.event_duration') AS brow_duration,
-- 浏览退出时间
from_unixtime(CAST(get_json_object(all_json, '$.time') AS DOUBLE) / 1000) AS out_time,
-- 内容编号
regexp_extract(get_json_object(all_json, '$.properties.$url_query'), 'id=([^&]*)', 1) AS number
FROM {args['TABLE_NAME']}
WHERE event = '$MPPageLeave' AND LENGTH(distinct_id)<30
AND get_json_object(all_json, '$.time') is not null
AND get_json_object(all_json, '$.properties.$url_query') is not null
AND regexp_extract(get_json_object(all_json, '$.properties.$url_query'), 'id=([^&]*)', 1) is not null
AND TRIM(regexp_extract(get_json_object(all_json, '$.properties.$url_query'), 'id=([^&]*)', 1)) != ''
AND created_at >= unix_timestamp('2026-01-20 00:00:00')
AND created_at < unix_timestamp('2026-01-21 00:00:00');