Athena

Athena Query Crate

What belongs in crates/athena-query and what still stays in athena_rs runtime adapters.

crates/athena-query is the reusable query-domain seam for Athena. The first slice focuses on portable query helpers that do not need Actix handlers or the full server runtime, while making SQL/CQL distinctions explicit for later driver and CDC extraction work.

What Lives Here Today

  • Core SQL WHERE-clause and insert-placeholder builders from src/parser/query_builder/*.
  • Postgres type and cast helpers used by query rendering and bind coercion.
  • Query optimization workflows and persistence helpers for the query_optimization_* tables.
  • Query dialect metadata for distinguishing SQL and CQL surfaces.

What Still Stays In athena_rs

  • Actix route handlers for /gateway/query, /query/sql, /query/count, and admin endpoints.
  • Runtime pool resolution and backend selection.
  • Driver execution, deferred queueing, and request logging.
  • Client-facing builder APIs that still depend on AthenaClient.

Current Extraction Rule

Use athena-query when code is about query structure, identifier safety, placeholder coercion, optimization heuristics, or portable query vocabulary.

Keep code in athena_rs when it needs:

  • HttpRequest and HttpResponse
  • AppState
  • backend selection and driver execution
  • full client runtime wiring

Near-Term Direction

The next query slices should keep building on the same crate:

  1. Move more portable raw-query helpers and compatibility parsing here.
  2. Add broader dialect coverage for SQL variants and CQL constraints.
  3. Fold the remaining query-builder/client surfaces into athena-query.