Skip to content

[Go] Add Avro record format (avro build tag) - #831

Draft
irinatomic-db wants to merge 5 commits into
mainfrom
irina-tomic_data/avro/go
Draft

[Go] Add Avro record format (avro build tag)#831
irinatomic-db wants to merge 5 commits into
mainfrom
irina-tomic_data/avro/go

Conversation

@irinatomic-db

@irinatomic-db irinatomic-db commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR stack

What changes are proposed in this pull request?

Adds the Avro record format to the Go (cgo) SDK, behind the //go:build avro build tag. Default builds are unchanged. Ephemeral streams only; server support is pending.

Declare the writer schema at stream creation with CreateAvroStream(...), then ingest either form:

  • pre-encoded datums (bytes): IngestAvroBytesOffset([]byte) / IngestAvroBytesBatchOffset([][]byte) (+ Nowait).
  • record objects: IngestAvroRecordOffset(any) / IngestAvroRecordsOffset([]any) (+ Nowait) - json.Marshaled and encoded by the shared Rust core against the writer schema. Go carries no Avro encoder.

How is this tested?

cd go

# Default (feature off) — unchanged
make build
make test
make lint
make fmt

# Avro (requires the FFI built with --features avro)
ZEROBUS_BUILD_FEATURES=avro make build-avro-rust
go build -tags avro ./...
go vet   -tags avro ./...
go test  -tags avro ./...

irinatomic-db and others added 4 commits September 4, 2026 11:58
Signed-off-by: Irina Tomic <irina.tomic@databricks.com>
Signed-off-by: Irina Tomic <irina.tomic@databricks.com>
Add object-based Avro record ingestion with automatic JSON encoding by the Rust core.
Rename pre-encoded bytes methods (AvroRecord* → AvroBytes*) for API clarity.

New methods:
- IngestAvroRecordOffset(record any) - marshal object to JSON, encode via FFI
- IngestAvroRecordsOffset(records []any) - batch object ingestion
- IngestAvroRecordNowait(record any) - fire-and-forget object
- IngestAvroRecordsNowait(records []any) - batch fire-and-forget

Renamed methods:
- IngestAvroRecordOffset → IngestAvroBytesOffset
- IngestAvroRecordsOffset → IngestAvroBytesBatchOffset
- IngestAvroRecordNowait → IngestAvroBytesNowait
- IngestAvroRecordsNowait → IngestAvroBytesBatchNowait

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Irina Tomic <irina.tomic@databricks.com>
@irinatomic-db
irinatomic-db force-pushed the irina-tomic_data/avro/go branch from 991cc7c to 8cddcca Compare September 7, 2026 10:24
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