[.NET] Add Databricks Zerobus Ingest SDK for .NET#532
Open
nalyd2 wants to merge 3 commits into
Open
Conversation
Initial implementation of the .NET SDK wrapping the Rust C FFI (rust/ffi/) via P/Invoke. - JSON, Protocol Buffers, and Arrow Flight ingestion streams - Fluent StreamBuilder API with typed sub-builders - Thread-safe streams with ReaderWriterLockSlim - IAsyncDisposable support (.NET 8+) - HeadersProviderBridge for custom authentication callbacks - ProtoSchema for Unity Catalog schema generation - Integration tests with real gRPC mock server (zerobus_service.proto) - 51 tests: 30 unit + 21 integration (4 self-test, 4 smoke, 17 end-to-end) - CI/CD workflows integrated into push.yml and release-dotnet.yml - Cross-platform NuGet package (win-x64, linux-x64, linux-arm64, osx-x64, osx-arm64) Signed-off-by: Efrain Robles Gonzalez <efrain.robles@serviciosexternos.com.mx>
Set RecordType in native options struct (1=Proto, 2=Json) so stream creation stops rejecting JSON/Proto streams with 'Record type is not specified'. Also rework integration tests to avoid IAsyncLifetime, which triggers a .NET 8.0.28 JIT bug causing InvalidProgramException when combined with DllImport. Signed-off-by: Efrain Robles Gonzalez <efrain.robles@serviciosexternos.com.mx>
Three discrepancies found by comparing C# hardcoded defaults against zerobus_get_default_config() / zerobus_arrow_get_default_config(): 1. CallbackMaxWaitTimeMs was null (wait forever), native default is 5000ms 2. MaxInflightBatches was 10000, native default is 1000 3. Arrow StreamPausedMaxWaitTimeMs was ulong (0), native expects int64_t with -1 meaning 'wait full server duration' Also adds Defaults_MatchNativeConfig and ArrowDefaults_MatchNativeConfig smoke tests to detect future drift. Signed-off-by: Efrain Robles Gonzalez <efrain.robles@serviciosexternos.com.mx>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
WHAT: Adds the .NET SDK (
dotnet/) as a new wrapper language for the Zerobus Ingest SDK, alongside the existing Rust, Java, Python, Go, TypeScript, and C++ SDKs.The SDK wraps the Rust C FFI (
rust/ffi/) via P/Invoke with the following major components:Native/): P/Invoke declarations for all FFI functions, C struct marshaling,SafeHandlesubclasses, cross-platform native library resolverZerobusSdk,StreamBuilder): Fluent builder API with typed sub-builders for JSON, Protobuf, and Arrow Flight streamsZerobusJsonStream,ZerobusProtoStream<T>,ZerobusArrowStream(Beta), all thread-safe withReaderWriterLockSlimStreamConfigurationOptionsandArrowStreamConfigurationOptionswith builder patterns matching the Java SDKpush.yml,release-dotnet.ymlfor NuGet publishingCLAUDE.md,README.md,CONTRIBUTING.md,CHANGELOG.mdWHY: .NET developers lacked a native SDK for high-throughput streaming ingestion into Databricks Delta tables. The C FFI (
rust/ffi/) already supported C# as a target consumer. This implementation mirrors the Java SDK's API design while following .NET idioms (IDisposable,Task<T>,SafeHandle, delegates).How is this tested?
builder_new/free,get_default_config,builder_buildwithout crashdotnet build && dotnet testpasses on Windows (51/51 passing)