code: public static Pair<Optional<Table>, Optional<List<Partition>>> getDestinationTableMeta(String dbName,
        String tableName, Properties props) {
  
      Optional<Table> table = Optional.<Table>absent();
      Optional<List<Partition>> partitions = Optional.<List<Partition>>absent();
  
      try {
        HiveMetastoreClientPool pool = HiveMetastoreClientPool.get(props,
            Optional.fromNullable(props.getProperty(HiveDatasetFinder.HIVE_METASTORE_URI_KEY)));
        try (AutoReturnableObject<IMetaStoreClient> client = pool.getClient()) {
          table = Optional.of(client.get().getTable(dbName, tableName));
          if (table.isPresent()) {
            org.apache.hadoop.hive.ql.metadata.Table qlTable = new org.apache.hadoop.hive.ql.metadata.Table(table.get());
            if (HiveUtils.isPartitioned(qlTable)) {
              partitions = Optional.of(HiveUtils.getPartitions(client.get(), qlTable, Optional.<String>absent()));
            }
          }
        }
      } catch (NoSuchObjectException e) {
        return ImmutablePair.of(table, partitions);
      } catch (IOException | TException e) {
        throw new RuntimeException("Could not fetch destination table metadata", e);
      }
  
      return ImmutablePair.of(table, partitions);
    }
docs: Returns a pair of Hive table and its partitions
  @param dbName db name
  @param tableName table name
  @param props properties
  @return a pair of Hive table and its partitions
  @throws DataConversionException