This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 16269afb9 fix(c/driver_manager): use Driver.entrypoint as per docs 
(#3242)
16269afb9 is described below

commit 16269afb944bbc6a53f2af8251b915a496703abc
Author: Matt Topol <[email protected]>
AuthorDate: Wed Aug 6 19:28:40 2025 -0400

    fix(c/driver_manager): use Driver.entrypoint as per docs (#3242)
    
    As per the
    
[docs](https://arrow.apache.org/adbc/main/format/driver_manifests.html#manifest-structure)
    the Driver manifest allows overriding the `entrypoint` via the
    `Driver.entrypoint` key. Rust follows this properly, but C++ checks for
    a top-level key named `entrypoint` instead of following the docs. This
    PR fixes this so that the C++ driver manager correctly looks for
    `Driver.entrypoint`.
---
 c/driver_manager/adbc_driver_manager.cc            |  2 +-
 c/driver_manager/adbc_driver_manager_test.cc       | 26 ++++++++++++++++++++++
 go/adbc/drivermgr/adbc_driver_manager.cc           |  2 +-
 .../tests/testthat/test-driver_void.R              |  3 ++-
 4 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/c/driver_manager/adbc_driver_manager.cc 
b/c/driver_manager/adbc_driver_manager.cc
index b880209bf..aed7f8319 100644
--- a/c/driver_manager/adbc_driver_manager.cc
+++ b/c/driver_manager/adbc_driver_manager.cc
@@ -253,7 +253,7 @@ AdbcStatusCode LoadDriverManifest(const 
std::filesystem::path& driver_manifest,
 
   info.manifest_file = driver_manifest.string();
   info.driver_name = config["name"].value_or(""s);
-  info.entrypoint = config["entrypoint"].value_or(""s);
+  info.entrypoint = config.at_path("Driver.entrypoint").value_or(""s);
   info.version = config["version"].value_or(""s);
   info.source = config["source"].value_or(""s);
 
diff --git a/c/driver_manager/adbc_driver_manager_test.cc 
b/c/driver_manager/adbc_driver_manager_test.cc
index 3e53a1b6e..afe296a4c 100644
--- a/c/driver_manager/adbc_driver_manager_test.cc
+++ b/c/driver_manager/adbc_driver_manager_test.cc
@@ -526,6 +526,32 @@ TEST_F(DriverManifest, DisallowEnvConfig) {
   UnsetConfigPath();
 }
 
+TEST_F(DriverManifest, ConfigEntrypoint) {
+  auto manifest_with_bad_entrypoint = simple_manifest;
+  // Override the entrypoint in the manifest
+  manifest_with_bad_entrypoint.erase("Driver");
+  manifest_with_bad_entrypoint.insert(
+      "Driver", toml::table{
+                    {"entrypoint", "BadEntrypointSymbolName"},
+                    {"shared",
+                     toml::table{
+                         {adbc::CurrentArch(), driver_path.string()},
+                     }},
+                });
+
+  auto filepath = temp_dir / "sqlite.toml";
+  std::ofstream test_manifest_file(filepath);
+  ASSERT_TRUE(test_manifest_file.is_open());
+  test_manifest_file << manifest_with_bad_entrypoint;
+  test_manifest_file.close();
+
+  ASSERT_THAT(AdbcFindLoadDriver(filepath.string().data(), nullptr, 
ADBC_VERSION_1_1_0,
+                                 ADBC_LOAD_FLAG_DEFAULT, &driver, &error),
+              Not(IsOkStatus(&error)));
+
+  ASSERT_TRUE(std::filesystem::remove(filepath));
+}
+
 TEST_F(DriverManifest, LoadAbsolutePath) {
   auto filepath = temp_dir / "sqlite.toml";
   std::ofstream test_manifest_file(filepath);
diff --git a/go/adbc/drivermgr/adbc_driver_manager.cc 
b/go/adbc/drivermgr/adbc_driver_manager.cc
index b880209bf..aed7f8319 100644
--- a/go/adbc/drivermgr/adbc_driver_manager.cc
+++ b/go/adbc/drivermgr/adbc_driver_manager.cc
@@ -253,7 +253,7 @@ AdbcStatusCode LoadDriverManifest(const 
std::filesystem::path& driver_manifest,
 
   info.manifest_file = driver_manifest.string();
   info.driver_name = config["name"].value_or(""s);
-  info.entrypoint = config["entrypoint"].value_or(""s);
+  info.entrypoint = config.at_path("Driver.entrypoint").value_or(""s);
   info.version = config["version"].value_or(""s);
   info.source = config["source"].value_or(""s);
 
diff --git a/r/adbcdrivermanager/tests/testthat/test-driver_void.R 
b/r/adbcdrivermanager/tests/testthat/test-driver_void.R
index 4387e9e25..1ec8ff33b 100644
--- a/r/adbcdrivermanager/tests/testthat/test-driver_void.R
+++ b/r/adbcdrivermanager/tests/testthat/test-driver_void.R
@@ -62,12 +62,13 @@ test_that("drivers are loaded using load_flags", {
 test_that("drivers can be loaded by manifest path", {
   toml_content <- sprintf("
 name = 'Void Driver'
-entrypoint = 'AdbcTestVoidDriverInit'
 
 [ADBC]
 version = 'v1.1.0'
 
 [Driver]
+entrypoint = 'AdbcTestVoidDriverInit'
+
 [Driver.shared]
 %s = '%s'
 

Reply via email to