private Optional<List<String>> loadPartitionNames(HiveTableName hiveTableName) throws Exception { try { return retry() .stopOn(NoSuchObjectException.class) .stopOnIllegalExceptions() .run( "getPartitionNames", stats .getGetPartitionNames() .wrap( () -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { return Optional.of( client.getPartitionNames( hiveTableName.getDatabaseName(), hiveTableName.getTableName())); } })); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }