CREATE DATABASE IF NOT EXISTS internal_platform_db; -- Input table CREATE TABLE IF NOT EXISTS internal_platform_db.ads_gov_cost_table_govern_detail_df_prestosql_005 ( imp_date BIGINT, db_name STRING, table_name STRING, heat BIGINT, owner STRING, storage_detail DOUBLE, task_cnt BIGINT, table_type STRING, govern_status STRING, last_access_time STRING, table_comment STRING, partition_cnt BIGINT, file_format STRING, table_size DOUBLE, avg_file_size DOUBLE, is_partitioned INT, lifecycle_days INT, create_time STRING, modify_time STRING, project_name STRING ) STORED AS ORC; INSERT INTO TABLE internal_platform_db.ads_gov_cost_table_govern_detail_df_prestosql_005 VALUES (20260507, 'db_production', 'user_profile', 1500, 'owner1', 1024.5, 10, 'MANAGED', 'GOVERNED', '2026-05-07', '用户画像表', 30, 'ORC', 500.0, 16.7, 1, 365, '2025-01-01', '2026-05-07', 'proj_a'), (20260507, 'db_production', 'user_profile', 1200, 'owner1', 1024.5, 8, 'MANAGED', 'GOVERNED', '2026-05-06', '用户画像表', 30, 'ORC', 500.0, 16.7, 1, 365, '2025-01-01', '2026-05-06', 'proj_a'), (20260507, 'db_production', 'order_detail', 800, 'owner2', 2048.0, 5, 'MANAGED', 'PENDING', '2026-05-07', '订单明细', 60, 'PARQUET', 1000.0, 16.7, 1, 180, '2025-03-01', '2026-05-07', 'proj_b'), (20260507, 'db_analytics', 'report_daily', 300, 'owner3', 512.0, 3, 'EXTERNAL', 'GOVERNED', '2026-05-06', '日报', 12, 'ORC', 256.0, 21.3, 1, 90, '2025-06-01', '2026-05-06', 'proj_c'), (20260507, 'db_analytics', 'metrics_agg', 200, 'owner3', 256.0, 2, 'EXTERNAL', 'GOVERNED', '2026-05-07', '指标聚合', 8, 'ORC', 128.0, 16.0, 0, 90, '2025-06-01', '2026-05-07', 'proj_c'), (20260507, 'db_test', 'test_table', 100, 'owner4', 64.0, 1, 'MANAGED', 'PENDING', '2026-05-07', '测试表', 2, 'ORC', 32.0, 16.0, 0, 30, '2026-04-01', '2026-05-07', 'proj_d'), (20260507, 'db_production', 'temp_import', 50, 'owner5', 128.0, 1, 'MANAGED', 'PENDING', '2026-05-07', '临时导入', 1, 'ORC', 64.0, 64.0, 0, 7, '2026-05-01', '2026-05-07', 'proj_e'), (20260507, 'db_production', 'log_archive', 0, 'owner6', 2048.0, 0, 'MANAGED', 'ARCHIVED', '2026-04-01', '日志归档', 100, 'ORC', 1024.0, 10.2, 1, 365, '2025-01-01', '2026-04-01', 'proj_f'), (20260506, 'db_production', 'user_profile', 1000, 'owner1', 1024.5, 9, 'MANAGED', 'GOVERNED', '2026-05-05', '用户画像表', 28, 'ORC', 480.0, 17.1, 1, 365, '2025-01-01', '2026-05-05', 'proj_a'); -- GT output table CREATE TABLE IF NOT EXISTS internal_platform_db.dwd_hot_metadata_table_prestosql_005 ( dt STRING, db_name STRING, table_name STRING, owner STRING, storage_detail DOUBLE, heat BIGINT, task_cnt BIGINT, table_type STRING, govern_status STRING, last_access_time STRING, table_comment STRING, partition_cnt BIGINT, file_format STRING, table_size DOUBLE, avg_file_size DOUBLE, is_partitioned INT, lifecycle_days INT, create_time STRING, modify_time STRING, project_name STRING ) STORED AS ORC; -- Candidate output table CREATE TABLE IF NOT EXISTS internal_platform_db.dwd_hot_metadata_table_cand_prestosql_005 ( dt STRING, db_name STRING, table_name STRING, owner STRING, storage_detail DOUBLE, heat BIGINT, task_cnt BIGINT, table_type STRING, govern_status STRING, last_access_time STRING, table_comment STRING, partition_cnt BIGINT, file_format STRING, table_size DOUBLE, avg_file_size DOUBLE, is_partitioned INT, lifecycle_days INT, create_time STRING, modify_time STRING, project_name STRING ) STORED AS ORC;