Datasets:
File size: 918 Bytes
e8c001c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | INSERT OVERWRITE TABLE internal_platform_db.t_app_breaking_ti_mttd_metric_prestosql_010
WITH api_metrics AS (
SELECT
get_json_object(request, '$.entity_value') AS ioc_value,
MIN(`timestamp`) AS earliest_timestamp
FROM internal_platform_db.t_app_ti_entity_api_metrics_prod_hi_prestosql_010
WHERE ds = 20260608
GROUP BY get_json_object(request, '$.entity_value')
),
filtered_main AS (
SELECT *
FROM internal_platform_db.t_sh_threat_intel_lab_breakingti_soc_endpoint_security_format_output_prod_prestosql_010
WHERE ioctype = 'DOMAIN' AND bdelete = 0 AND ds = 20260608
)
SELECT
f.ioc AS IOC,
f.ioctype AS IOCTYPE,
f.port AS PORT,
f.first_occur_time,
a.earliest_timestamp,
f.family,
f.match_subdomains,
GREATEST(0, (unix_timestamp(f.first_occur_time) - a.earliest_timestamp) / 86400.0) AS time_diff_days,
20260608 AS ds
FROM filtered_main f
JOIN api_metrics a ON f.ioc = a.ioc_value
|