fix(athena): serialize timestamps as epoch seconds in GetWorkGroup and GetTableMetadata responses (#1524)

This commit is contained in:
Maciej authored and GitHub committed 2026-06-24 22:10:17 -05:00
1 parent a6c6cf6de9
commit 72146eeb02
4 files changed
+156 -12

No files matched your search

@@ -3,10 +3,13 @@ package com.floci.test;
import org.junit.jupiter.api.*;
import software.amazon.awssdk.services.athena.AthenaClient;
import software.amazon.awssdk.services.athena.model.*;
import software.amazon.awssdk.services.glue.GlueClient;
import java.time.Duration;
import java.time.Instant;
import java.util.UUID;
import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@DisplayName("Athena Query Execution")
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@@ -106,4 +109,72 @@ class AthenaTest {
.build()))
.isInstanceOf(InvalidRequestException.class);
}
/**
* Reproduces issue #1498: the AthenaClient fails to unmarshal the {@code CreationTime} field returned by Floci's
* {@code GetWorkGroup} response.
*/
@Test
@Order(6)
@DisplayName("getWorkGroup must unmarshal creationTime successfully")
void getWorkGroupCreationTimeCanBeUnmarshalledBySdk() {
String groupName = UUID.randomUUID().toString();
athena.createWorkGroup(
CreateWorkGroupRequest.builder()
.name(groupName)
.build()
);
GetWorkGroupResponse response = athena.getWorkGroup(
GetWorkGroupRequest.builder()
.workGroup(groupName)
.build()
);
Instant creationTime = response.workGroup().creationTime();
assertThat(creationTime)
.as("creationTime must be parseable by the AWS SDK")
.isNotNull();
}
@Test
@Order(7)
@DisplayName("getTableMetadata must unmarshal timestamps successfully")
void getTableMetadataTimestampsCanBeUnmarshalledBySdk() {
GlueClient glue = TestFixtures.glueClient();
String dbName = "athena_ts_test_" + UUID.randomUUID().toString().replace("-", "").substring(0, 8);
String tableName = "orders";
glue.createDatabase(r -> r.databaseInput(i -> i.name(dbName)));
glue.createTable(r -> r
.databaseName(dbName)
.tableInput(t -> t
.name(tableName)
.tableType("EXTERNAL_TABLE")
.storageDescriptor(
sd -> sd
.location("s3://test-bucket/" + dbName + "/")
.columns(c -> c.name("id").type("string"))
)
)
);
GetTableMetadataResponse response = athena.getTableMetadata(
GetTableMetadataRequest.builder()
.catalogName("AwsDataCatalog")
.databaseName(dbName)
.tableName(tableName)
.build()
);
assertThat(response.tableMetadata().createTime())
.as("createTime must be parseable by the AWS SDK")
.isNotNull();
assertThat(response.tableMetadata().lastAccessTime())
.as("lastAccessTime must be parseable by the AWS SDK")
.isNotNull();
glue.close();
}
}