Presto SQL release 304 contains new procedure system.sync_partition_metadata() developed by @luohao. This is similar to hive's MSCK REPAIR TABLE
Document about Hive Connector Procedures is https://prestosql.io/docs/current/connector/hive.html#procedures
The syntax is system.sync_partition_metadata(schema_name, table_name, mode)
. The supported mode are add, drop and full. Example query is
-- Mode DROP
hive> CREATE TABLE default.test_partition (c1 int) PARTITIONED BY (dt string);
hive> INSERT OVERWRITE TABLE default.test_partition PARTITION(dt = '20190101') VALUES (1);
hive> dfs -mv hdfs://hadoop-master:9000/user/hive/warehouse/test_partition/dt=20190101 /tmp/;
hive> SHOW PARTITIONS default.test_partition;
dt=20190101
presto> USE hive.default;
presto> CALL system.sync_partition_metadata('default', 'test_partition', 'drop');
hive> SHOW PARTITIONS default.test_partition;
→ Empty
-- Mode ADD
hive> dfs -mv /tmp/dt=20190101 hdfs://hadoop-master:9000/user/hive/warehouse/test_partition/;
presto> CALL system.sync_partition_metadata('default', 'test_partition', 'add');
hive> SHOW PARTITIONS default.test_partition;
dt=20190101
-- Mode FULL performs both DROP and ADD