CREATE DATABASE IF NOT EXISTS internal_platform_db; -- Input table 1: API指标表 CREATE TABLE IF NOT EXISTS internal_platform_db.t_app_ti_entity_api_metrics_prod_hi_prestosql_010 ( `timestamp` BIGINT, username STRING, appid BIGINT, path STRING, request STRING, response STRING, ds BIGINT ) STORED AS ORC; INSERT INTO TABLE internal_platform_db.t_app_ti_entity_api_metrics_prod_hi_prestosql_010 VALUES (1717920000, 'user1', 1001, '/api/query', '{"entity_value":"evil-domain.com","entity_type":"DOMAIN"}', '{"status":"ok"}', 20260608), (1717920100, 'user2', 1002, '/api/query', '{"entity_value":"malware-site.org","entity_type":"DOMAIN"}', '{"status":"ok"}', 20260608), (1717920200, 'user3', 1003, '/api/query', '{"entity_value":"clean-site.net","entity_type":"DOMAIN"}', '{"status":"ok"}', 20260608), (1717920300, 'user1', 1001, '/api/query', '{"entity_value":"evil-domain.com","entity_type":"DOMAIN"}', '{"status":"ok"}', 20260608); -- Input table 2: 威胁情报IOC表 CREATE TABLE IF NOT EXISTS internal_platform_db.t_sh_threat_intel_lab_breakingti_soc_endpoint_security_format_output_prod_prestosql_010 ( ioctype STRING, ioc STRING, port STRING, producer STRING, stamp STRING, category STRING, family STRING, apt_org STRING, weapon STRING, usefor STRING, ttps STRING, confidence INT, context STRING, intelligence_investigation STRING, match_subdomains INT, bdelete INT, deleted_time STRING, first_occur_time STRING, last_occur_time STRING, ds BIGINT ) STORED AS ORC; INSERT INTO TABLE internal_platform_db.t_sh_threat_intel_lab_breakingti_soc_endpoint_security_format_output_prod_prestosql_010 VALUES ('DOMAIN', 'evil-domain.com', '443', 'producer1', '2026-06-08', 'malware', 'Emotet', 'APT28', 'trojan', 'c2', 'T1071', 95, 'context1', 'invest1', 1, 0, '', '2026-06-07 12:00:00', '2026-06-08 12:00:00', 20260608), ('DOMAIN', 'malware-site.org', '80', 'producer2', '2026-06-08', 'phishing', 'Locky', 'APT29', 'ransomware', 'payload', 'T1566', 80, 'context2', 'invest2', 0, 0, '', '2026-06-06 08:00:00', '2026-06-08 08:00:00', 20260608), ('IP', '1.2.3.4', '22', 'producer3', '2026-06-08', 'scan', '', '', '', '', '', 50, 'context3', '', 0, 0, '', '2026-06-08 00:00:00', '2026-06-08 06:00:00', 20260608), ('DOMAIN', 'deleted-ioc.com', '443', 'producer4', '2026-06-07', 'malware', 'Zeus', '', '', '', '', 60, 'context4', '', 0, 1, '2026-06-08', '2026-06-05 00:00:00', '2026-06-07 00:00:00', 20260608); -- GT output table CREATE TABLE IF NOT EXISTS internal_platform_db.t_app_breaking_ti_mttd_metric_prestosql_010 ( IOC STRING, IOCTYPE STRING, PORT STRING, first_occur_time STRING, earliest_timestamp BIGINT, family STRING, match_subdomains INT, time_diff_days DOUBLE, ds BIGINT ) STORED AS ORC; -- Candidate output table CREATE TABLE IF NOT EXISTS internal_platform_db.t_app_breaking_ti_mttd_metric_cand_prestosql_010 ( IOC STRING, IOCTYPE STRING, PORT STRING, first_occur_time STRING, earliest_timestamp BIGINT, family STRING, match_subdomains INT, time_diff_days DOUBLE, ds BIGINT ) STORED AS ORC;