Skip to content

feat(rust): add GetInfo/GetObjects/GetStatistics result builders - #5

Open
fornwall wants to merge 1 commit into
mainfrom
rust-result-builders
Open

feat(rust): add GetInfo/GetObjects/GetStatistics result builders#5
fornwall wants to merge 1 commit into
mainfrom
rust-result-builders

Conversation

@fornwall

@fornwall fornwall commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What

Adds public GetInfoBuilder, GetObjectsBuilder, and GetStatisticsBuilder to adbc_core::schemas::builder with typed append_* / finish() -> RecordBatch APIs that own the union type-ids, list offsets, and null handling for the nested get_info / get_objects / get_statistics result shapes.

Previously drivers hand-rolled the nested union/list/struct assembly inline. Go's driverbase and the C++ driver framework already absorb exactly this for their drivers.

Note: this branch was rebased after the DataFusion driver was removed upstream (apache#4455). The original version also rewrote that driver; this PR now only refactors the dummy driver. The builders remain useful for the dummy driver and any future Rust driver.

Changes

  • New module rust/core/src/schemas/builder.rs:
    • GetInfoBuilderappend_string / append_bool / append_int64 / append_int32_bitmask / append_string_list / append_int32_to_int32_list_map (all six union variants).
    • GetObjectsBuilder — hierarchical append_catalogappend_db_schemaappend_tableappend_column / append_constraint, with helper structs ColumnSchema, TableConstraint, ConstraintUsage. Respects ObjectDepth, emitting null lists for levels below the requested depth.
    • GetStatisticsBuilderappend_catalogappend_db_schemaappend_statistic, with a StatisticValue enum for the value union.
    • Field definitions are pulled directly from the schemas::* constants, so array and schema types cannot drift apart.
  • Rewrote the dummy driver to use the builders (get_info, get_objects, get_statistics), producing byte-identical output. Removed the now-unused arrow-buffer dependency; added it to adbc_core.

Testing

  • cargo test -p adbc_core -p adbc_dummy — all pass, including the dummy driver's exported-vs-native FFI round-trip equality tests (confirming output is unchanged) and 4 new unit tests + a doctest in the builder module.
  • cargo build --workspace — clean.

🤖 Generated with Claude Code

Add public GetInfoBuilder, GetObjectsBuilder, and GetStatisticsBuilder to
adbc_core::schemas::builder with typed append_* / finish() -> RecordBatch
APIs that own the union type-ids, list offsets, and null handling for the
nested get_info / get_objects / get_statistics result shapes.

Rewrite the dummy driver to use them, deleting ~440 lines of hand-rolled
union/list/struct assembly and the now-unused arrow-buffer dependency.
Field definitions are pulled from the schemas::* constants so array and
schema types cannot drift apart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fornwall
fornwall force-pushed the rust-result-builders branch from 442a71d to f0f8423 Compare July 7, 2026 22:42
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