mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(athena): real SQL execution via floci-duck DuckDB sidecar (#584)
* feat(athena): real SQL execution via floci-duck DuckDB sidecar
- Lazy-start floci/floci-duck:latest on first StartQueryExecution call;
reuse the running container for all subsequent queries
- Inject Glue tables as CREATE OR REPLACE VIEW statements via setup_sql
before the user SQL so DDL runs outside the COPY(...) wrapper
- SerDe-aware format inference: inferReadFunction now checks
SerdeInfo.SerializationLibrary in addition to InputFormat, so standard
AWS JSON tables (TextInputFormat + JsonSerDe) map to read_json_auto
- ImageCacheService: skip Docker Hub pull when image is already present
locally, preventing local builds from being overwritten
- Add AthenaIntegrationTest (5 unit integration tests)
- Add AthenaTest and DataLakeTest SDK compatibility tests
- Update docs: athena.md (full rewrite), glue.md, README, CHANGELOG
* fix: docker image check fix
This commit is contained in:
1 parent
5ad4c06d74
commit
1ddbec0efb
22 files changed
+1231
-81
No files matched your search
@@ -0,0 +1,106 @@
|
||||
package io.github.hectorvent.floci.services.athena;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@QuarkusTest
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
class AthenaIntegrationTest {
|
||||
|
||||
private static final String CONTENT_TYPE = "application/x-amz-json-1.1";
|
||||
|
||||
private static String queryExecutionId;
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void startQueryExecution() {
|
||||
String response = given()
|
||||
.header("X-Amz-Target", "AmazonAthena.StartQueryExecution")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"QueryString": "SELECT 1",
|
||||
"WorkGroup": "primary"
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("QueryExecutionId", notNullValue())
|
||||
.extract().path("QueryExecutionId");
|
||||
|
||||
queryExecutionId = response;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
void getQueryExecution() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.GetQueryExecution")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"QueryExecutionId\": \"" + queryExecutionId + "\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("QueryExecution.QueryExecutionId", equalTo(queryExecutionId))
|
||||
.body("QueryExecution.Status.State", equalTo("SUCCEEDED"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
void getQueryResults() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.GetQueryResults")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"QueryExecutionId\": \"" + queryExecutionId + "\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("ResultSet", notNullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
void listQueryExecutions() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.ListQueryExecutions")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{}")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("QueryExecutionIds", notNullValue())
|
||||
.body("QueryExecutionIds", hasItem(queryExecutionId));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(5)
|
||||
void getQueryExecutionNotFound() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonAthena.GetQueryExecution")
|
||||
.contentType(CONTENT_TYPE)
|
||||
.body("{ \"QueryExecutionId\": \"nonexistent-id\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("InvalidRequestException"));
|
||||
}
|
||||
}
|
||||
+7
@@ -1,6 +1,8 @@
|
||||
package io.github.hectorvent.floci.services.firehose;
|
||||
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -15,6 +17,11 @@ class FirehoseIntegrationTest {
|
||||
|
||||
private static final String STREAM_NAME = "test-delivery-stream";
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
void createDeliveryStream() {
|
||||
|
||||
Reference in new issue
Block a user