fix(glue): return partitions in deterministic order from GetPartitions (#1335)

GlueService.getPartitions returned partitions in storage-scan order, which is
not stable across runs because partition keys embed the table name. Sort by
partition values so GetPartitions is deterministic, matching the existing
sorted-list convention in GlueService and the moto reference, which preserves a
stable partition order.

De-flakes the sdk-test-awscli "Glue catalog: table and partition lifecycle"
compatibility test, whose assertions assume a stable partition order.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-06-14 00:45:33 -05:00
1 parent f70709a70f
commit 08797954d9
2 files changed
+35

No files matched your search

@@ -386,6 +386,25 @@ class GlueServiceTest {
assertEquals("EntityNotFoundException", ex.getErrorCode());
}
@Test
void getPartitionsReturnsPartitionsSortedByValuesRegardlessOfCreationOrder() {
Table table = new Table();
table.setName("plain");
table.setPartitionKeys(List.of(new Column("year", "string")));
glueService.createTable("db1", table);
for (String value : List.of("2028", "2026", "2027")) {
Partition partition = new Partition();
partition.setValues(List.of(value));
glueService.createPartition("db1", "plain", partition);
}
// Deterministic ordering: returned in sorted order, not storage-scan order. No re-sort here.
assertEquals(List.of(List.of("2026"), List.of("2027"), List.of("2028")),
glueService.getPartitions("db1", "plain").stream()
.map(Partition::getValues)
.toList());
}
@Test
void partitionKeysDoNotCollideForCommaSeparatedValues() {
Table table = new Table();