From e28dcd2372619771101299049833626594440d1c Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 16 Jul 2026 20:58:09 +0200 Subject: [PATCH] fix(rust): align LoadFlags constants with the C ABI The Rust `LoadFlags` constants were shifted one bit too high, leaving bit 0 unused and diverging from the canonical ADBC C ABI defined in `c/include/arrow-adbc/adbc_driver_manager.h`. Anyone passing a C-documented flag value into the Rust API therefore got wrong behavior. Old (Rust) vs new (matching the C header): SEARCH_ENV: 2 -> 1 (ADBC_LOAD_FLAG_SEARCH_ENV 1) SEARCH_USER: 4 -> 2 (ADBC_LOAD_FLAG_SEARCH_USER 2) SEARCH_SYSTEM: 8 -> 4 (ADBC_LOAD_FLAG_SEARCH_SYSTEM 4) ALLOW_RELATIVE_PATHS: 16 -> 8 (ADBC_LOAD_FLAG_ALLOW_RELATIVE_PATHS 8) DEFAULT: 30 -> 15 (OR of the four) The shifts now start at `1 << 0`; `LOAD_FLAG_DEFAULT` remains the OR of the four and naturally becomes 15. All existing uses are symbolic (bitwise AND between the constants), so no other code changed. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01XNCrC87g9MkppGpL4MDgh5 --- rust/core/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/core/src/lib.rs b/rust/core/src/lib.rs index 80485c9c26..bf1726c776 100644 --- a/rust/core/src/lib.rs +++ b/rust/core/src/lib.rs @@ -51,10 +51,10 @@ use arrow_schema::Schema; pub type LoadFlags = u32; -pub const LOAD_FLAG_SEARCH_ENV: LoadFlags = 1 << 1; -pub const LOAD_FLAG_SEARCH_USER: LoadFlags = 1 << 2; -pub const LOAD_FLAG_SEARCH_SYSTEM: LoadFlags = 1 << 3; -pub const LOAD_FLAG_ALLOW_RELATIVE_PATHS: LoadFlags = 1 << 4; +pub const LOAD_FLAG_SEARCH_ENV: LoadFlags = 1 << 0; +pub const LOAD_FLAG_SEARCH_USER: LoadFlags = 1 << 1; +pub const LOAD_FLAG_SEARCH_SYSTEM: LoadFlags = 1 << 2; +pub const LOAD_FLAG_ALLOW_RELATIVE_PATHS: LoadFlags = 1 << 3; pub const LOAD_FLAG_DEFAULT: LoadFlags = LOAD_FLAG_SEARCH_ENV | LOAD_FLAG_SEARCH_USER | LOAD_FLAG_SEARCH_SYSTEM