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

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

Introduction

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

Prototype


public String getNextToken() 

Source Link

Document

A continuation token, if the returned list of partitions does not include the last one.

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 {/*from  ww w.jav a  2s  . 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);
    }
}