Example usage for com.amazonaws.services.glue.model GetPartitionsResult getPartitions

List of usage examples for com.amazonaws.services.glue.model GetPartitionsResult getPartitions

Introduction

In this page you can find the example usage for com.amazonaws.services.glue.model GetPartitionsResult getPartitions.

Prototype


public java.util.List<Partition> getPartitions() 

Source Link

Document

A list of requested partitions.

Usage

From source file:com.facebook.presto.hive.metastore.glue.GlueHiveMetastore.java

License:Apache License

private List<Partition> getPartitions(String databaseName, String tableName, String expression) {
    try {//w  w w  . j  a  v a2s.co  m
        List<Partition> partitions = new ArrayList<>();
        String nextToken = null;

        do {
            GetPartitionsResult result = glueClient
                    .getPartitions(new GetPartitionsRequest().withDatabaseName(databaseName)
                            .withTableName(tableName).withExpression(expression).withNextToken(nextToken));
            result.getPartitions()
                    .forEach(partition -> partitions.add(GlueToPrestoConverter.convertPartition(partition)));
            nextToken = result.getNextToken();
        } while (nextToken != null);

        return partitions;
    } catch (AmazonServiceException e) {
        throw new PrestoException(HIVE_METASTORE_ERROR, e);
    }
}