Repository navigation
Description
Goal — v0.8 Spark processing (parallel track)
Decision 2026-11-19 — ephemeral compute per run, no persistent Spark service. Spark follows the Floe model: a pipeline run launches a Kubernetes Job sized from
processing.gold.size, runsdbt build, and every Spark pod is gone when the run ends. No always-on driver, Thrift Server or stage-scoped SQL service, so cluster capacity returns to the other services between runs. Rationale: a long-lived SQL server (Trino today) is built to stay up and does not add executors per run; heavy Gold builds then compete with interactive queries.
- First choice —
dbt-sparkmethod: session: the Job's pod runsdbt buildand is itself the Spark driver (Spark-on-Kubernetes client mode). The driver creates executor pods;spark.kubernetes.driver.pod.namegives them an OwnerReference to the driver pod, so Kubernetes deletes them when the Job ends. Needs a headless service so executors reach the driver (spark.driver.host/spark.driver.port) and a stage ServiceAccount allowed to create pods in the stage namespace. Risk: dbt documentssessionas for advanced users / experimental and not supported by dbt — the feat(dbt): make Gold dbt adapters portable across Trino and Spark with Iceberg conformance #887 conformance gate decides whether it holds.- Phasing (decided 2026-11-19):
- Phase 1 — Spark local mode, one pod. The per-run Job runs a single pod:
dbt buildwithmethod: sessionandspark.master=local[*], sized from the profile like a Floe Job (Floe runs Polars/DuckDB in its own pod the same way). Goal: prove the dbt-spark ↔ Iceberg/Polaris connection, the profile template, the per-run lifecycle and the feat(dbt): make Gold dbt adapters portable across Trino and Spark with Iceberg conformance #887 conformance tests. No executors, so no headless service and no pod-creation RBAC yet. This is also the long-termsize: small(dev, small volumes).- Phase 2 — distributed executors for
medium/large: the same Job pod becomes the client-mode driver and creates executor pods (OwnerReference, headless service, pod-creation ServiceAccount as below). Same image and same dbt profile as phase 1; only Spark settings change. Add scheduling protection before production use:PriorityClassso platform services win over runs, per-stageResourceQuota, and evaluate all-or-nothing admission (e.g. Kueue) so concurrent runs cannot deadlock with drivers up and executors pending.- Fallback —
method: thrift, per-run Thrift Server: the run starts a Spark Thrift Server with its executors, waits for readiness, runsdbt build, then deletes everything (including on failure/cancel). Officially supported transport, more moving parts.
Implement the Kubernetes compute runtime through which dbt-spark actually executes SQL. This is a prerequisite for #880, but independent of DuckDB query work (#547). Spark is used for dbt Gold transformations only, with no standalone non-dbt Gold writer.
Technical decision gate (prototype before choosing topology)
- Evaluate the pinned
dbt-sparksupported transports (Spark Thrift Server, Livy if compatible, and any supported session mode). Document connection semantics, versions, health/readiness, driver placement, server lifetime, cancellation and concurrency. - Prove a real
dbt buildcan connect, issue SQL and materialize Iceberg on Spark-on-Kubernetes. A Spark OperatorSparkApplicationby itself does not provide dbt-spark SQL connectivity. Don't assume Spark Thrift Server runs in Spark cluster submission mode. - Lifecycle is decided: per-run and ephemeral (see decision above). Prototype
sessionfirst, fall back to a per-run Thrift Server only ifsessionfails feat(dbt): make Gold dbt adapters portable across Trino and Spark with Iceberg conformance #887 conformance. Measure and document cold start (JVM + executor scheduling) instead of trading it for an always-on service. - Use version-pinned Spark, Java, Iceberg runtime and adapter artifacts; bake dependencies into images (no uncontrolled runtime downloads).
Implementation boundaries
- Dedicated
infra/terraform/modules/processing/spark/(or equivalent) driven byprocessing.goldcontracts,release/size templates and stage/provider runtime bindings. - Isolated driver/executors with service accounts, per-stage Polaris OAuth/REST, S3 credentials, endpoint/path-style for SeaweedFS, Secret refs and namespace/network policies.
- Resource caps for executor count (including dynamic allocation if supported), CPU/RAM, query/runtime timeout, retries, pod labels (stage, product, run), logs and cleanup after crashes.
- Dagster launches the per-run Spark Job (same pattern as Floe Jobs: one Job per run,
dagster/run-idlabel, size from the profile), runs dbt build, captures command failures/cancellation and tears down every driver/executor/service resource at the end of the run, including on failure and cancel. - For Trino-free combination the runtime must not call any Trino service. Multi-node K3s test on test(onprem): real multi-node K3s qualification and RKE2 smoke #804 environment; local kind smoke first.
Acceptance
- Working connection mode with reproducible
dbt buildSELECT + Iceberg table write; ADR explains why other transports were rejected. - Zero Spark pods or services exist between runs; after success, failure and cancel, no driver, executor or Thrift Server is left in the stage namespace.
- Phase 1: one-pod Spark local mode runs
dbt buildend to end on local kind, sized from the profile, and the pod is gone after the run. - Phase 2: two or more Spark executor pods distributed on K3s nodes during dbt execution; quotas, priorities and retry/cancel work.
- Stage namespace and temporary credentials isolate DEV/UAT/PROD; no public SQL endpoint.
- No runtime artifact downloads or secrets in image, manifest, log or ProjectRevision.
- Baseline
dbt-trino/Trino topology unchanged when Spark is not selected.
Related: #879 #880 #546 #802 #804. P1 optional processing backend in v0.8; not an on-prem P0 gate.
Activity
malon64 commentedon Nov 19, 2026
Moved from v0.8-beta to v0.9-beta (2026-11-19): v0.8 qualifies the current stack (Trino + dbt-trino) on cloud and on-premises; separating the compute and query engines follows in v0.9, which already targets scale-to-zero and burst capacity for batch and query.