You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "davidhcoe (via GitHub)" <gi...@apache.org> on 2026/03/11 20:37:30 UTC
[PR] feat(csharp): Add driver manager [arrow-adbc]
davidhcoe opened a new pull request, #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075
Implements C# driver manager matching [adbc_driver_manager.h](https://github.com/apache/arrow-adbc/blob/main/c/include/arrow-adbc/adbc_driver_manager.h) spec:
Core APIs:
• LoadDriver() / FindLoadDriver() - Load native/managed drivers
• OpenDatabaseFromProfile() - TOML profile support
• AdbcLoadFlags - Search control (env/user/system paths)
Features:
• Native + managed (.NET) driver loading
• TOML manifests with env_var() expansion
• Uses a custom TOML parser vs Tomlyn because a strong name is required for dependencies
• Cross-platform driver discovery
• Option merging (profile + explicit)
• Co-located manifest detection
Tests: 40+ unit tests + sample BigQuery/Snowflake implementations (attached, not checked in)
[BigQueryDriverManagerTests.txt](https://github.com/user-attachments/files/25918821/BigQueryDriverManagerTests.txt)
[SnowflakeDriverManagerTests.txt](https://github.com/user-attachments/files/25918824/SnowflakeDriverManagerTests.txt)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on code in PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#discussion_r3260660244
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/ManagedDriverLoader.cs:
##########
@@ -69,27 +70,92 @@ namespace Apache.Arrow.Adbc.DriverManager
/// </item>
/// <item>
/// <description>
- /// Drivers should be published with their <c>.deps.json</c> file alongside the
- /// assembly (the default when building with the .NET SDK). Native dependencies
- /// should follow the standard <c>runtimes/<rid>/native</c> layout.
+ /// Drivers <b>must</b> be published with their <c>.deps.json</c> file alongside
+ /// the assembly (the default when building with the .NET SDK). Without it the
+ /// loader cannot construct an <see cref="AssemblyDependencyResolver"/>, the
+ /// host's TPA list is the only thing that gets consulted, and any driver
+ /// dependency the host does not already have will fail to load at the first
+ /// call site that touches it. Native dependencies should follow the standard
+ /// <c>runtimes/<rid>/native</c> layout.
/// </description>
/// </item>
/// <item>
/// <description>
- /// If a driver does not ship a <c>.deps.json</c>, the loader still works but
- /// falls back to whatever the host can resolve plus the driver's directory.
- /// Callers needing strong isolation should load the driver into a custom
- /// <see cref="AssemblyLoadContext"/> themselves.
+ /// A driver whose only dependencies are already present in the host's TPA list
+ /// can technically load without a <c>.deps.json</c>, but this is fragile and
+ /// not a supported configuration. Callers needing strong isolation should
+ /// load the driver into a custom <see cref="AssemblyLoadContext"/> themselves.
/// </description>
/// </item>
/// </list>
+ /// <para>
+ /// <b>Shared public contract assemblies and version skew:</b> a small set of
+ /// assemblies form the public contract between the driver manager and any managed
+ /// driver and must have <i>exactly one identity</i> per process. In particular:
+ /// </para>
+ /// <list type="bullet">
+ /// <item><description><c>Apache.Arrow.Adbc</c> (defines <see cref="AdbcDriver"/>, <c>AdbcDatabase</c>, etc.)</description></item>
+ /// <item><description><c>Apache.Arrow</c> (Arrow types crossing the API boundary)</description></item>
+ /// <item><description><c>System.Diagnostics.DiagnosticSource</c> (telemetry / Activity)</description></item>
+ /// </list>
+ /// <para>
+ /// Because the driver is loaded into the default <see cref="AssemblyLoadContext"/>,
+ /// the runtime always returns the copy already loaded by the host for these
+ /// assemblies; any version shipped next to the driver and listed in the driver's
+ /// <c>.deps.json</c> is ignored. This is the desired behavior (type identity is
+ /// preserved across the boundary) but it has an operational consequence:
+ /// <b>the host must ship versions of these contract assemblies that meet or exceed
+ /// the minimum versions the driver was compiled against.</b> If the host pins an
+ /// older version, the driver may throw <see cref="MissingMethodException"/> or
+ /// <see cref="TypeLoadException"/> the first time it touches a newer API.
+ /// </para>
+ /// <para>
+ /// Private driver dependencies (i.e. assemblies the host does <i>not</i> reference)
+ /// go through the per-driver <see cref="AssemblyDependencyResolver"/> and load from
+ /// the driver's directory using its <c>.deps.json</c>. They are isolated from host
+ /// versions of the same files only insofar as the host has not already loaded them.
+ /// </para>
+ /// <para>
+ /// <b>Order-dependent resolution across multiple drivers:</b> if two drivers ship
+ /// different versions of the same private dependency (for example
+ /// <c>Newtonsoft.Json</c> 12 in one driver and 13 in another), the first driver
+ /// whose resolver satisfies that simple name "wins" for the lifetime of the
+ /// process; the runtime will return the already-loaded copy for every subsequent
+ /// request. When a later driver's resolver could also have satisfied the same
+ /// simple name, the loader emits a warning via the
+ /// <c>Apache.Arrow.Adbc.DriverManager.ManagedDriverLoader</c>
+ /// <see cref="TraceSource"/> so the collision is debuggable instead of silent.
+ /// Callers that need version isolation between drivers should load conflicting
+ /// drivers into their own <see cref="AssemblyLoadContext"/> instances.
+ /// </para>
+ /// <para>
+ /// <b>Failed-load cleanup:</b> the per-driver <see cref="AssemblyDependencyResolver"/>
+ /// is only published to the process-wide resolver cache (and the global
+ /// <see cref="AssemblyLoadContext.Resolving"/> hook is only armed) after
+ /// <see cref="Assembly.LoadFrom(string)"/> succeeds. If the driver assembly itself
+ /// fails to load, no resolver is left behind to influence later assembly
+ /// resolutions. Once a driver loads successfully its resolver remains for the
+ /// lifetime of the process; the default <see cref="AssemblyLoadContext"/> is not
+ /// unloadable, so there is no safe point at which to remove it.
+ /// </para>
/// </remarks>
internal static class ManagedDriverLoader
{
#if NET6_0_OR_GREATER
private static readonly ConcurrentDictionary<string, AssemblyDependencyResolver> resolvers
= new ConcurrentDictionary<string, AssemblyDependencyResolver>(StringComparer.OrdinalIgnoreCase);
+ // Tracks which driver path "won" the very first contested resolution for a
+ // given simple assembly name (e.g. "Newtonsoft.Json"). Used purely to emit a
+ // diagnostic when a later resolver could also satisfy that name -- the runtime
+ // always returns the assembly already loaded by the first winner, so any later
+ // candidate is silently shadowed.
Review Comment:
I'm not sure to what extent this is true under .NET Core. Two assemblies with different load contexts can definitely resolve the same assembly to two different files/versions. Is this code path always used or only if there's no .deps file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4056644752
> Note we noticed various inconsistencies in profiles that we're working on correcting (#4082 / #4085)
I added some items to address #4082. For #4085 , based on your table, this implementation currently does:
Feature -> How It Works
- init_func (entrypoint) priority -> LoadDriver(path, entrypoint) - if provided, uses it directly
- Load driver from explicit path -> LoadDriver(driverPath)
- Load driver by name (search) -> FindLoadDriver(driverName, ...) with directory search
- Load from profile object -> OpenDatabaseFromProfile(profile, ...)
- Profile from TOML file -> TomlConnectionProfile.FromFile(path)
- Explicit options override profile -> OpenDatabaseFromProfile(profile, explicitOptions, ...)
- Managed (.NET) drivers -> LoadManagedDriver(assemblyPath, typeName)
- Native drivers -> Via CAdbcDriverImporter.Load(...)
- Co-located manifests (.toml next to .dll) -> Auto-detected in LoadDriver
- Profile/manifest version fields -> profile_version (new) and version (legacy)
- Options section naming -> [Options] (new) and [options] (legacy, case-insensitive)
❌ Not Yet Implemented
- URI parsing -> No parsing of snowflake://..., postgresql://... URIs
- Profile URI scheme -> No profile:///path/to/file.toml support
- Driver URI scheme -> No URI that embeds both driver and connection string
- Profile in options -> No automatic detection of profile key in options dict
- Multiple profile detection -> No error if profile specified in multiple ways
- Driver/profile consistency -> No validation that driver arg matches profile's driver
- URI extraction from driver -> No parsing driver argument as potential URI
- Non-driver URI detection -> No distinguishing connection URIs from driver URIs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4385082234
Anything else needed for this one @lidavidm @CurtHagenlocher ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4052158769
I debated whether to put this in its own assembly or as a subfolder under the shared Adbc project. I decided on a subfolder approach to reduce the number of dependencies required (especially since the AdbcDrivers are still using submodules and any tests there would require an additional submodule to be managed).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4052920837
Note we noticed various inconsistencies in profiles that we're working on correcting (https://github.com/apache/arrow-adbc/issues/4082 / https://github.com/apache/arrow-adbc/issues/4085)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4055811715
To what extent have you tried this with .NET 8.0? I'm discovering that dynamic loading of assemblies is fairly different in that environment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4482441442
> On the whole this looks good to me in its current state. The tests need to pass, of course, and I'm not super certain about the managed driver loading code for .NET 8+. But I think the latter can be worked out as people run into problems.
>
> I'll take one last pass over the changes once the test issues are worked out.
Everything passes now except a strange Databricks test. Maybe it needs to be re-run?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher merged PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4480076130
On the whole this looks good to me in its current state. The tests need to pass, of course, and I'm not super certain about the managed driver loading code for .NET 8+. But I think the latter can be worked out as people run into problems.
I'll take one last pass over the changes once the test issues are worked out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4483106450
> Everything passes now except a strange Databricks test. Maybe it needs to be re-run?
That test has always been flaky and I was never able to figure out why.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4483261112
@davidhcoe. the CI tests seem to be flaky after this checkin :(. See https://github.com/apache/arrow-adbc/actions/runs/26067113103/job/76641108349 for example.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4441579506
My main concern is being explicit about how dependency resolution is expected to work for .NET 8+, as I think there is trickiness and subtlety there based on my experiences in our own code base. I'll try to find time this week to take a closer look and run a few experiments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4056619539
> To what extent have you tried this with .NET 8.0? I'm discovering that dynamic loading of assemblies is fairly different in that environment.
It has .NET 8 tests that all pass but I added some more items in the recent push.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "davidhcoe (via GitHub)" <gi...@apache.org>.
davidhcoe commented on PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#issuecomment-4441333033
We have more users asking for the ability to edit configuration files for their drivers. Is there anything else needed for this @lidavidm or @CurtHagenlocher ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(csharp): Add driver manager [arrow-adbc]
Posted by "CurtHagenlocher (via GitHub)" <gi...@apache.org>.
CurtHagenlocher commented on code in PR #4075:
URL: https://github.com/apache/arrow-adbc/pull/4075#discussion_r3249482111
##########
csharp/test/Apache.Arrow.Adbc.Tests/Apache.Arrow.Adbc.Testing.csproj:
##########
@@ -1,12 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks Condition="'$(IsWindows)'=='true'">net8.0;net472</TargetFrameworks>
- <TargetFrameworks Condition="'$(TargetFrameworks)'==''">net8.0</TargetFrameworks>
+ <TargetFrameworks Condition="'$(IsWindows)'=='true'">net8.0;net10.0;net472</TargetFrameworks>
+ <TargetFrameworks Condition="'$(TargetFrameworks)'==''">net8.0;net10.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<IsTestProject>true</IsTestProject>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProcessArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</ProcessArchitecture>
+ <!--
+ net10's NuGet audit elevates known vulnerabilities of transitive packages to errors.
+ The OpenTelemetry.Api 1.12.0 advisory (GHSA-g94r-2vxg-569j) is pulled in transitively
Review Comment:
o.0
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/ManagedDriverLoader.cs:
##########
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Concurrent;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Loader;
+#endif
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides cross-platform assembly loading functionality for managed ADBC drivers.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This type abstracts the differences in assembly loading between .NET Framework
+ /// (which uses Fusion / <c>LoadFrom</c> probing) and modern .NET (which uses
+ /// <c>AssemblyLoadContext</c> and <c>.deps.json</c>-driven resolution).
+ /// </para>
+ /// <para>
+ /// <b>Dependency resolution on .NET Framework (net472, netstandard2.0 build):</b>
+ /// <see cref="Assembly.LoadFrom(string)"/> probes the assembly's directory for
+ /// dependencies. Drop the driver assembly and all of its dependencies in the same
+ /// directory and they will be found.
+ /// </para>
+ /// <para>
+ /// <b>Dependency resolution on .NET 6 / .NET 8 / .NET 10:</b>
+ /// </para>
+ /// <list type="bullet">
+ /// <item>
+ /// <description>
+ /// The driver assembly is loaded with <see cref="Assembly.LoadFrom(string)"/>
+ /// into <see cref="AssemblyLoadContext.Default"/>. This is intentional: it keeps
+ /// a single identity for <c>Apache.Arrow.Adbc.AdbcDriver</c> across the host
+ /// and the driver so that <c>IsAssignableFrom</c> checks work correctly.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// Loading into the default context means the <b>host's</b> <c>.deps.json</c>
+ /// drives resolution, not the driver's. Dependencies that are not already known
+ /// to the host will not be found by default. To bridge that gap, this loader
+ /// registers an <see cref="AssemblyDependencyResolver"/> for each driver
+ /// assembly and attaches a single
+ /// <see cref="AssemblyLoadContext.Resolving"/> handler to
+ /// <see cref="AssemblyLoadContext.Default"/>. When the runtime fails to resolve
+ /// a dependency, the handler consults each registered driver's resolver, which
+ /// reads the driver's <c>.deps.json</c> next to it on disk.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// Drivers should be published with their <c>.deps.json</c> file alongside the
+ /// assembly (the default when building with the .NET SDK). Native dependencies
+ /// should follow the standard <c>runtimes/<rid>/native</c> layout.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// If a driver does not ship a <c>.deps.json</c>, the loader still works but
Review Comment:
In my experience, loading a driver without a `.deps.json` file did not generally work. Has it worked for you?
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/AdbcDriverManager.cs:
##########
@@ -0,0 +1,787 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
+using Apache.Arrow.Adbc.C;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides methods to locate and load ADBC drivers, optionally using TOML manifest
+ /// files and connection profiles.
+ /// Mirrors the free functions declared in <c>adbc_driver_manager.h</c>:
+ /// <c>AdbcLoadDriver</c> and <c>AdbcFindLoadDriver</c>.
+ /// </summary>
+ public static class AdbcDriverManager
+ {
+ /// <summary>
+ /// The environment variable that specifies additional driver search paths.
+ /// </summary>
+ public const string DriverPathEnvVar = "ADBC_DRIVER_PATH";
+
+ private static readonly string[] s_nativeExtensions = { ".so", ".dll", ".dylib" };
+
+ // -----------------------------------------------------------------------
+ // AdbcLoadDriver – load a driver directly from an absolute or relative path
+ // -----------------------------------------------------------------------
+
+ /// <summary>
+ /// Loads an ADBC driver from an explicit file path.
+ /// Mirrors <c>AdbcLoadDriver</c> in <c>adbc_driver_manager.h</c>.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// If a TOML manifest file with the same base name exists in the same directory
+ /// as the driver file, it will be automatically detected and used. For example,
+ /// loading <c>libadbc_driver_snowflake.dll</c> will automatically use
+ /// <c>libadbc_driver_snowflake.toml</c> if present.
+ /// </para>
+ /// <para>
+ /// The co-located manifest can specify default options, override the driver path,
+ /// or provide additional metadata. The <paramref name="entrypoint"/> parameter
+ /// always takes precedence over any entrypoint derived from the manifest or filename.
+ /// </para>
+ /// </remarks>
+ /// <param name="driverPath">
+ /// The absolute or relative path to the driver shared library.
+ /// </param>
+ /// <param name="entrypoint">
+ /// The symbol name of the driver initialisation function. When <c>null</c> the
Review Comment:
total nit: we have one instance of the American spelling `initialization` and two instances of the British spelling `initialisation`. My desire for consistency is warring with my desire for cultural inclusiveness, and my spell checker definitely has feelings.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/TomlConnectionProfile.cs:
##########
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// An <see cref="IConnectionProfile"/> loaded from a TOML file.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The expected file format for profiles is:
+ /// </para>
+ /// <code>
+ /// profile_version = 1
+ /// driver = "driver_name"
+ ///
+ /// [Options]
+ /// option1 = "value1"
+ /// option2 = 42
+ /// option3 = 3.14
+ /// </code>
+ /// <para>
+ /// For backward compatibility, the following legacy field names are also supported:
+ /// </para>
+ /// <list type="bullet">
+ /// <item><c>version</c> (use <c>profile_version</c> instead)</item>
+ /// <item><c>[options]</c> section (use <c>[Options]</c> instead)</item>
+ /// </list>
+ /// <para>
+ /// Boolean option values are converted to the string equivalents <c>"true"</c> or
+ /// <c>"false"</c> and placed in <see cref="StringOptions"/>.
+ /// Integer values are placed in <see cref="IntOptions"/> and double values in
+ /// <see cref="DoubleOptions"/>.
+ /// Values of the form <c>env_var(ENV_VAR_NAME)</c> are expanded from the named
+ /// environment variable when <see cref="ResolveEnvVars"/> is called.
+ /// </para>
+ /// </remarks>
+ public sealed class TomlConnectionProfile : IConnectionProfile
Review Comment:
To the point of my other comment, this is basically a data transfer object plus some static helpers which could live on the public `IConnectionProfileProvider` implementation.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/ManagedDriverLoader.cs:
##########
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Concurrent;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Loader;
+#endif
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides cross-platform assembly loading functionality for managed ADBC drivers.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// This type abstracts the differences in assembly loading between .NET Framework
+ /// (which uses Fusion / <c>LoadFrom</c> probing) and modern .NET (which uses
+ /// <c>AssemblyLoadContext</c> and <c>.deps.json</c>-driven resolution).
+ /// </para>
+ /// <para>
+ /// <b>Dependency resolution on .NET Framework (net472, netstandard2.0 build):</b>
+ /// <see cref="Assembly.LoadFrom(string)"/> probes the assembly's directory for
+ /// dependencies. Drop the driver assembly and all of its dependencies in the same
+ /// directory and they will be found.
+ /// </para>
+ /// <para>
+ /// <b>Dependency resolution on .NET 6 / .NET 8 / .NET 10:</b>
+ /// </para>
+ /// <list type="bullet">
+ /// <item>
+ /// <description>
+ /// The driver assembly is loaded with <see cref="Assembly.LoadFrom(string)"/>
+ /// into <see cref="AssemblyLoadContext.Default"/>. This is intentional: it keeps
+ /// a single identity for <c>Apache.Arrow.Adbc.AdbcDriver</c> across the host
+ /// and the driver so that <c>IsAssignableFrom</c> checks work correctly.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// Loading into the default context means the <b>host's</b> <c>.deps.json</c>
+ /// drives resolution, not the driver's. Dependencies that are not already known
+ /// to the host will not be found by default. To bridge that gap, this loader
+ /// registers an <see cref="AssemblyDependencyResolver"/> for each driver
+ /// assembly and attaches a single
+ /// <see cref="AssemblyLoadContext.Resolving"/> handler to
+ /// <see cref="AssemblyLoadContext.Default"/>. When the runtime fails to resolve
+ /// a dependency, the handler consults each registered driver's resolver, which
+ /// reads the driver's <c>.deps.json</c> next to it on disk.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// Drivers should be published with their <c>.deps.json</c> file alongside the
+ /// assembly (the default when building with the .NET SDK). Native dependencies
+ /// should follow the standard <c>runtimes/<rid>/native</c> layout.
+ /// </description>
+ /// </item>
+ /// <item>
+ /// <description>
+ /// If a driver does not ship a <c>.deps.json</c>, the loader still works but
+ /// falls back to whatever the host can resolve plus the driver's directory.
+ /// Callers needing strong isolation should load the driver into a custom
+ /// <see cref="AssemblyLoadContext"/> themselves.
+ /// </description>
+ /// </item>
+ /// </list>
+ /// </remarks>
+ internal static class ManagedDriverLoader
+ {
+#if NET6_0_OR_GREATER
+ private static readonly ConcurrentDictionary<string, AssemblyDependencyResolver> resolvers
+ = new ConcurrentDictionary<string, AssemblyDependencyResolver>(StringComparer.OrdinalIgnoreCase);
+
+ private static int s_resolveHookInstalled;
+
+ private static void EnsureResolveHookInstalled()
+ {
+ if (Interlocked.CompareExchange(ref s_resolveHookInstalled, 1, 0) == 0)
+ {
+ AssemblyLoadContext.Default.Resolving += OnDefaultContextResolving;
+ }
+ }
+
+ [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
+ Justification = "Dynamic driver loading is inherently incompatible with full trimming. " +
+ "Drivers must opt out of trimming or be preserved by the host.")]
+ private static Assembly? OnDefaultContextResolving(AssemblyLoadContext context, AssemblyName assemblyName)
+ {
+ foreach (AssemblyDependencyResolver resolver in resolvers.Values)
+ {
+ string? path = resolver.ResolveAssemblyToPath(assemblyName);
+ if (!string.IsNullOrEmpty(path) && File.Exists(path))
+ {
+ return context.LoadFromAssemblyPath(path!);
+ }
+ }
+ return null;
+ }
+#endif
+
+ /// <summary>
+ /// Loads a managed driver assembly from the specified path.
+ /// </summary>
+ /// <param name="assemblyPath">The path to the assembly to load.</param>
+ /// <returns>The loaded assembly.</returns>
+ /// <exception cref="FileNotFoundException">The assembly file was not found.</exception>
+ /// <exception cref="BadImageFormatException">The file is not a valid managed assembly.</exception>
+ /// <remarks>
+ /// See the documentation on <see cref="ManagedDriverLoader"/> for dependency
+ /// resolution semantics on .NET Framework versus modern .NET.
+ /// </remarks>
+#if NET6_0_OR_GREATER
+ [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
+ Justification = "Dynamic driver loading is inherently incompatible with full trimming. " +
+ "Drivers must opt out of trimming or be preserved by the host.")]
+#endif
+ internal static Assembly LoadAssembly(string assemblyPath)
+ {
+ string fullPath = Path.GetFullPath(assemblyPath);
+
+ if (!File.Exists(fullPath))
+ {
+ throw new FileNotFoundException($"Assembly not found: {fullPath}", fullPath);
+ }
+
+#if NET6_0_OR_GREATER
+ // Register an AssemblyDependencyResolver for this driver so that its own
+ // .deps.json is consulted when the default AssemblyLoadContext fails to
+ // resolve a dependency. AssemblyDependencyResolver throws if no .deps.json
+ // is present next to the assembly; in that case we silently fall back to
+ // the host's normal probing behavior.
Review Comment:
I found that it was necessary to *always* reference the host's version of the following three assemblies regardless of the driver's dependencies: `Apache.Arrow`, `Apache.Arrow.Adbc` and `System.Diagnostics.DiagnosticSource`. That's because these three assemblies contain types that are in the public ADBC contracts. If the driver resolves to a different version of these assemblies than the host, an attempt to use an API with one of these types will produce a `MethodMissingException`.
A test which covers this scenario would need to have the driver built against a different version of one or more of these than the test code is built against.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/AdbcDriverManager.cs:
##########
@@ -0,0 +1,787 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
+using Apache.Arrow.Adbc.C;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides methods to locate and load ADBC drivers, optionally using TOML manifest
+ /// files and connection profiles.
+ /// Mirrors the free functions declared in <c>adbc_driver_manager.h</c>:
+ /// <c>AdbcLoadDriver</c> and <c>AdbcFindLoadDriver</c>.
+ /// </summary>
+ public static class AdbcDriverManager
+ {
+ /// <summary>
+ /// The environment variable that specifies additional driver search paths.
+ /// </summary>
+ public const string DriverPathEnvVar = "ADBC_DRIVER_PATH";
+
+ private static readonly string[] s_nativeExtensions = { ".so", ".dll", ".dylib" };
+
+ // -----------------------------------------------------------------------
+ // AdbcLoadDriver – load a driver directly from an absolute or relative path
Review Comment:
Relative paths can be dangerous from a security perspective. What is the path relative to? At first glance it appears that (at least sometimes) it's relative to the current process directory, which I think is a very bad idea. If we really want support for relative loading, then I think the best combination of safety and usefulness is to make it relative to the location of the executing process. But I'd rather force it to be absolute here and leave the path resolution explicitly up to the host program.
I'd also be in favor of preventing a relative path from being applied to a search path if the relative path contains any directory separators -- especially if it also contains `".."` segments.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/AdbcDriverManager.cs:
##########
@@ -0,0 +1,787 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
+using Apache.Arrow.Adbc.C;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides methods to locate and load ADBC drivers, optionally using TOML manifest
+ /// files and connection profiles.
+ /// Mirrors the free functions declared in <c>adbc_driver_manager.h</c>:
+ /// <c>AdbcLoadDriver</c> and <c>AdbcFindLoadDriver</c>.
+ /// </summary>
+ public static class AdbcDriverManager
+ {
+ /// <summary>
+ /// The environment variable that specifies additional driver search paths.
+ /// </summary>
+ public const string DriverPathEnvVar = "ADBC_DRIVER_PATH";
+
+ private static readonly string[] s_nativeExtensions = { ".so", ".dll", ".dylib" };
Review Comment:
This appears to be unused.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/AdbcLoadFlags.cs:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Flags to control how the ADBC driver manager searches for and loads drivers.
+ /// Mirrors the <c>AdbcLoadFlags</c> type and <c>ADBC_LOAD_FLAG_*</c> constants
+ /// defined in <c>adbc_driver_manager.h</c>.
+ /// </summary>
+ [Flags]
+ public enum AdbcLoadFlags : uint
Review Comment:
Is there any specific reason to make this a `uint` enum rather than the default?
##########
csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj:
##########
@@ -20,6 +20,11 @@
<Compile Remove="C\NativeLibrary.cs" />
</ItemGroup>
<ItemGroup>
+ <Content Include="DriverManager\readme.md">
+ <PackagePath>\</PackagePath>
Review Comment:
Does this preserve the subdirectory `DriverManager` or might it override the other `readme.md`?
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/TomlParser.cs:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// A minimal TOML parser that handles the subset of TOML used by ADBC driver
+ /// manifests and connection profiles:
+ /// <list type="bullet">
+ /// <item><description>Root-level key = value assignments</description></item>
+ /// <item><description>Table section headers: <c>[section]</c></description></item>
+ /// <item><description>String values (double-quoted), integer values, floating-point
+ /// values, and boolean values (<c>true</c>/<c>false</c>)</description></item>
+ /// <item><description>Line comments beginning with <c>#</c></description></item>
+ /// </list>
+ /// This parser intentionally does not support the full TOML specification.
+ /// A full-featured TOML library (e.g. Tomlyn) was considered but cannot be used here
+ /// because the assembly is strongly-named and Tomlyn does not publish a strongly-named
+ /// package that is compatible with the project's pinned dependency versions.
+ /// </summary>
+ internal static class TomlParser
+ {
+ private const string RootSection = "";
+
+ /// <summary>
+ /// Parses <paramref name="content"/> and returns a dictionary keyed by section name.
+ /// Root-level keys are stored under the empty string key.
+ /// Values are typed as <see cref="string"/>, <see cref="long"/>, <see cref="double"/>,
+ /// or <see cref="bool"/>.
+ /// </summary>
+ internal static Dictionary<string, Dictionary<string, object>> Parse(string content)
+ {
+ if (content == null)
+ {
+ throw new ArgumentNullException(nameof(content));
+ }
+
+ Dictionary<string, Dictionary<string, object>> result = new Dictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase)
+ {
+ [RootSection] = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase),
+ };
+
+ string currentSection = RootSection;
+
+ foreach (string rawLine in content.Split('\n'))
+ {
+ string line = StripComment(rawLine).Trim();
+
+ if (line.Length == 0)
+ {
+ continue;
+ }
+
+ if (line.StartsWith("[", StringComparison.Ordinal) && line.EndsWith("]", StringComparison.Ordinal))
Review Comment:
Should this throw an exception if the section name contains anything other than `A-Za-z0-9_-`? I know we don't want or need a full-featured parser, but perhaps we should try to be overly strict in what we accept rather than reading something incorrectly.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/IConnectionProfile.cs:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Represents an ADBC connection profile, which specifies a driver and a set of
+ /// options to apply when initializing a database connection.
+ /// Mirrors the <c>AdbcConnectionProfile</c> struct defined in <c>adbc_driver_manager.h</c>.
+ /// </summary>
+ /// <remarks>
+ /// The profile specifies a driver (optionally) and key/value options of three types:
+ /// string, 64-bit integer, and double. String option values of the form
+ /// <c>env_var(ENV_VAR_NAME)</c> are expanded from the named environment variable
+ /// before being applied to the database.
+ /// </remarks>
+ public interface IConnectionProfile : IDisposable
Review Comment:
Is there any real benefit to this being an interface versus a simple data transfer object? It feels like the `IConnectionProfileProvider` ought to be sufficient as an extensibility point without needing to also implement this interface.
##########
csharp/src/Apache.Arrow.Adbc/DriverManager/AdbcDriverManager.cs:
##########
@@ -0,0 +1,787 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+#if NET6_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
+using Apache.Arrow.Adbc.C;
+
+namespace Apache.Arrow.Adbc.DriverManager
+{
+ /// <summary>
+ /// Provides methods to locate and load ADBC drivers, optionally using TOML manifest
+ /// files and connection profiles.
+ /// Mirrors the free functions declared in <c>adbc_driver_manager.h</c>:
+ /// <c>AdbcLoadDriver</c> and <c>AdbcFindLoadDriver</c>.
+ /// </summary>
+ public static class AdbcDriverManager
+ {
+ /// <summary>
+ /// The environment variable that specifies additional driver search paths.
+ /// </summary>
+ public const string DriverPathEnvVar = "ADBC_DRIVER_PATH";
+
+ private static readonly string[] s_nativeExtensions = { ".so", ".dll", ".dylib" };
+
+ // -----------------------------------------------------------------------
+ // AdbcLoadDriver – load a driver directly from an absolute or relative path
+ // -----------------------------------------------------------------------
+
+ /// <summary>
+ /// Loads an ADBC driver from an explicit file path.
+ /// Mirrors <c>AdbcLoadDriver</c> in <c>adbc_driver_manager.h</c>.
Review Comment:
It might be worth calling out that loading a managed driver always requires a manifest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org