Skip to content

doc(ingest): sidecars as views over the ingested rows, staged locally and uploaded - #526

Open
tanejagagan wants to merge 1 commit into
dazzleduck-web:mainfrom
tanejagagan:doc/sidecar-views-spec
Open

tanejagagan wants to merge 1 commit into
dazzleduck-web:mainfrom
tanejagagan:doc/sidecar-views-spec

Conversation

@tanejagagan

Copy link
Copy Markdown
Collaborator

Summary

Design spec, doc/SIDECAR_VIEWS_SPEC.md, replacing the producer-side SidecarRows mechanism specified in doc/ATTRIBUTE_TYPE_REGISTRY_SPEC.md. Sidecars become configuration instead of producer code: each is a table plus a SQL transformation over the batch's base rows (__base), and a queue may declare any number of them.

Write path

  • With an uploader configured:
    1. The base is written as Parquet to a local staging directory, and its upload starts at once.
    2. Each sidecar is derived from that staged Parquet and uploaded as soon as it is written.
    3. One DuckLake transaction registers every file, so the base and all sidecars commit or roll back together.
  • Without one (the default): the base and every sidecar are written by parallel DuckDB COPYs straight to the destination, as the base is written today. A queue with no sidecars behaves exactly as it does now.

Decisions, all measured

  • Sidecars are derived from the staged base Parquet, not the raw Arrow input: faster or equal in every run. A sidecar also becomes a pure function of the registered files.
  • Reading the base back from S3 to derive sidecars is ruled out: the slowest strategy in every run.
  • Uploader library: AWS SDK v2 s3 + sts on its JDK-based HTTP client, without the transfer manager or Netty. That's 8.2 MB in 32 jars, against 13.7 MB with Netty and 22.9 MB for the MinIO SDK.
  • Authentication: DuckDB won't show secrets unredacted, so the uploader can't reuse them. DuckDB (PROVIDER credential_chain) and the uploader (the AWS default chain) read one identity from the environment instead, e.g. the pod's IAM role via IRSA or EKS Pod Identity.

Benchmark

tools/sidecar-bench is a standalone Maven project, not a module of the build. It writes one batch as a base table plus three sidecars, to MinIO behind a proxy adding about 40 ms per round trip. Median ms:

Strategy 100k rows, 1.5.6 100k rows, 2.0.0 1M rows, 1.5.6 1M rows, 2.0.0
B: parallel direct COPYs (the default) 253 432 1,186 916
G: staged, sidecars from local Parquet, upload overlapped 307 318 895 809

The spec has all seven strategies. In every run, all strategies wrote the same rows per output, and each output was read back from S3 and counted.

On DuckDB 2.0.0, direct writes are faster for large batches but about 2× slower for small ones: its HTTP log shows two extra HEAD requests per file. The staged path doesn't use DuckDB's S3 writer and is unaffected.

The numbers come from one machine with synthetic data, so treat them as directional until they're repeated against a real bucket. That and the other open questions are listed at the end of the spec.

🤖 Generated with Claude Code

… and uploaded

Design spec replacing the producer-side SidecarRows mechanism. A queue declares any
number of sidecars, each a table and a SQL transformation over the batch's base rows
(__base). With an uploader configured, the base is written to a local staging
directory and its upload starts at once; each sidecar is derived from that staged
Parquet and uploaded as it is written; one DuckLake transaction then registers every
file. By default no uploader is configured, and parallel DuckDB COPYs write the base
and every sidecar directly, as the base is written today.

Includes the benchmark behind the decisions (tools/sidecar-bench), run on DuckDB
1.5.6 and 2.0.0 against MinIO with ~40 ms of injected latency, and the uploader's
library, authentication and configuration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant