Datasets:
metadata
id: offline-compute_PrestoSQL_prestosql_005
name: Hot Table Governance Metadata Wide Table Aggregation
category: offline-compute/PrestoSQL
timeout_seconds: 900
modality: pure-text
engine: prestosql
Prompt
Task Objective: From the hot table governance metadata detail table, filter valid hot table records (heat > 0, excluding temporary/test tables), aggregate by database name and table name to take the maximum of each metric, and write the results to the output table.
Input Table:
internal_platform_db.ads_gov_cost_table_govern_detail_df_prestosql_005(hot table governance metadata detail table)imp_dateBIGINT — date partitiondb_nameSTRING — database nametable_nameSTRING — table nameheatBIGINT — heatownerSTRING — ownerstorage_detailDOUBLE — storage detailtask_cntBIGINT — task counttable_typeSTRING — table typegovern_statusSTRING — governance statuslast_access_timeSTRING — last access timetable_commentSTRING — table commentpartition_cntBIGINT — partition countfile_formatSTRING — file formattable_sizeDOUBLE — table sizeavg_file_sizeDOUBLE — average file sizeis_partitionedINT — whether partitionedlifecycle_daysINT — lifecycle dayscreate_timeSTRING — creation timemodify_timeSTRING — modification timeproject_nameSTRING — project name
Filter Conditions:
imp_date = 20260507heat > 0table_name NOT LIKE '%temp%'db_name NOT LIKE '%test%'
Output Requirements:
- Target table:
internal_platform_db.dwd_hot_metadata_table_cand_prestosql_005 - Output fields and order:
dtSTRING,db_nameSTRING,table_nameSTRING,ownerSTRING,storage_detailDOUBLE,heatBIGINT,task_cntBIGINT,table_typeSTRING,govern_statusSTRING,last_access_timeSTRING,table_commentSTRING,partition_cntBIGINT,file_formatSTRING,table_sizeDOUBLE,avg_file_sizeDOUBLE,is_partitionedINT,lifecycle_daysINT,create_timeSTRING,modify_timeSTRING,project_nameSTRING dt: Fixed value'20260507'- Group by
db_name,table_name, applyMAX()to all other fields - If the target table does not exist, first create the table, then write the data
- Use Presto/Trino SQL syntax; do not use Hive/Spark SQL dialects
Environment and Execution Notes:
- Presto is running, connected via the Hive catalog
- Execute SQL:
presto-cli --catalog hive --schema internal_platform_db -f /tmp_workspace/result.sql - After writing
result.sql, you must execute it yourself to verify that it runs successfully and produces correct data