Skip to content

Commit

Permalink
Add support for MaxResults on Glue Hive Metastore
Browse files Browse the repository at this point in the history
Cherry pick of trinodb/trino#3024 and
trinodb/trino#4938

Co-authored-by: Istvan <[email protected]>
Co-authored-by: Ashhar Hasan <[email protected]>
  • Loading branch information
3 people authored and pettyjamesm committed May 19, 2021
1 parent 8be15cf commit 8f4ef27
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public class GlueHiveMetastore
private static final String WILDCARD_EXPRESSION = "";
private static final int BATCH_GET_PARTITION_MAX_PAGE_SIZE = 1000;
private static final int BATCH_CREATE_PARTITION_MAX_PAGE_SIZE = 100;
private static final int AWS_GLUE_GET_PARTITIONS_MAX_RESULTS = 1000;
private static final Comparator<Partition> PARTITION_COMPARATOR = comparing(Partition::getValues, lexicographical(String.CASE_INSENSITIVE_ORDER));

private final GlueMetastoreStats stats = new GlueMetastoreStats();
Expand Down Expand Up @@ -750,7 +751,8 @@ private List<Partition> getPartitions(String databaseName, String tableName, Str
.withDatabaseName(databaseName)
.withTableName(tableName)
.withExpression(expression)
.withSegment(segment);
.withSegment(segment)
.withMaxResults(AWS_GLUE_GET_PARTITIONS_MAX_RESULTS);

do {
GetPartitionsResult result = stats.getGetPartitions().record(() -> glueClient.getPartitions(request));
Expand Down

0 comments on commit 8f4ef27

Please sign in to comment.