You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/11/29 13:59:20 UTC

[arrow-adbc] branch main updated: refactor(c): build Googletest if needed (#199)

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 8f43cb9  refactor(c): build Googletest if needed (#199)
8f43cb9 is described below

commit 8f43cb99161594c655a18e2a9ff5ab1d5eda0f3d
Author: David Li <li...@gmail.com>
AuthorDate: Tue Nov 29 08:59:14 2022 -0500

    refactor(c): build Googletest if needed (#199)
    
    Also removes the Flight SQL driver and some other things that still reference libarrow. The Flight SQL driver can be found at apache/arrow#14082.
    
    Fixes #198.
---
 c/cmake_modules/AdbcDefines.cmake            |  12 +
 c/driver/flight_sql/CMakeLists.txt           |  70 ---
 c/driver/flight_sql/README.md                |  55 ---
 c/driver/flight_sql/flight_sql.cc            | 683 ---------------------------
 c/driver/flight_sql/flight_sql_test.cc       | 155 ------
 c/driver/sqlite/CMakeLists.txt               |   1 +
 c/driver/test_util.h                         |  95 ----
 c/driver/util.h                              |  28 --
 c/driver_manager/adbc_driver_manager_test.cc |  31 +-
 9 files changed, 28 insertions(+), 1102 deletions(-)

diff --git a/c/cmake_modules/AdbcDefines.cmake b/c/cmake_modules/AdbcDefines.cmake
index ac8d7a6..a28cb8f 100644
--- a/c/cmake_modules/AdbcDefines.cmake
+++ b/c/cmake_modules/AdbcDefines.cmake
@@ -93,5 +93,17 @@ endmacro()
 add_custom_target(all-tests)
 if(ADBC_BUILD_TESTS)
   find_package(GTest)
+  if(NOT GTest_FOUND)
+    message(STATUS "Building googletest from source")
+    include(FetchContent)
+    fetchcontent_declare(googletest
+                         URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
+    )
+    # Windows: https://stackoverflow.com/questions/12540970/
+    set(gtest_force_shared_crt
+        ON
+        CACHE BOOL "" FORCE)
+    fetchcontent_makeavailable(googletest)
+  endif()
   set(ADBC_TEST_LINK_LIBS GTest::gtest_main GTest::gtest GTest::gmock)
 endif()
diff --git a/c/driver/flight_sql/CMakeLists.txt b/c/driver/flight_sql/CMakeLists.txt
deleted file mode 100644
index f067911..0000000
--- a/c/driver/flight_sql/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-# 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.
-
-cmake_minimum_required(VERSION 3.14)
-get_filename_component(REPOSITORY_ROOT "../../.." ABSOLUTE)
-list(APPEND CMAKE_MODULE_PATH "${REPOSITORY_ROOT}/c/cmake_modules/")
-include(AdbcDefines)
-include(BuildUtils)
-
-project(adbc_driver_flight_sql
-        VERSION "${ADBC_BASE_VERSION}"
-        LANGUAGES CXX)
-
-find_package(Arrow REQUIRED)
-# ARROW-12175: Arrow libraries are not CMake components
-get_filename_component(ARROW_CONFIG_PATH ${Arrow_CONFIG} DIRECTORY)
-find_package(ArrowFlight REQUIRED HINTS ${ARROW_CONFIG_PATH})
-find_package(ArrowFlightSql REQUIRED HINTS ${ARROW_CONFIG_PATH})
-
-add_arrow_lib(adbc_driver_flight_sql
-              SOURCES
-              flight_sql.cc
-              OUTPUTS
-              ADBC_LIBRARIES
-              SHARED_LINK_LIBS
-              arrow_flight_sql_shared
-              arrow_flight_shared
-              arrow_shared
-              STATIC_LINK_LIBS
-              arrow_flight_sql_static
-              arrow_flight_static
-              arrow_static)
-include_directories(SYSTEM ${REPOSITORY_ROOT})
-include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
-foreach(LIB_TARGET ${ADBC_LIBRARIES})
-  target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
-endforeach()
-
-if(ADBC_BUILD_TESTS)
-  if(ADBC_TEST_LINKAGE STREQUAL "shared")
-    set(TEST_LINK_LIBS adbc_driver_flight_sql_shared)
-  else()
-    set(TEST_LINK_LIBS adbc_driver_flight_sql_static)
-  endif()
-
-  add_test_case(driver_flight_sql_test
-                PREFIX
-                adbc
-                SOURCES
-                flight_sql_test.cc
-                EXTRA_LINK_LIBS
-                ${TEST_LINK_LIBS})
-endif()
-
-validate_config()
-config_summary_message()
diff --git a/c/driver/flight_sql/README.md b/c/driver/flight_sql/README.md
deleted file mode 100644
index b1ac261..0000000
--- a/c/driver/flight_sql/README.md
+++ /dev/null
@@ -1,55 +0,0 @@
-<!---
-  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.
--->
-
-# ADBC Flight SQL Driver
-
-This implements an ADBC driver that wraps Arrow Flight SQL.  This is
-still a work in progress.
-
-## Building
-
-Dependencies: Flight SQL itself.  This can be installed with your
-favorite package manager, by installing the Arrow C++ libraries.
-
-See [CONTRIBUTING.md](../../CONTRIBUTING.md) for details.
-
-## Testing
-
-A running instance of the Flight SQL test server from the Arrow source
-tree is required.  This means [building Arrow with
-tests](https://arrow.apache.org/docs/developers/cpp/building.html):
-
-```shell
-# Using a checkout of Arrow
-$ cd arrow/
-$ mkdir build && cd build
-$ cmake ../cpp -DARROW_FLIGHT=ON -DARROW_FLIGHT_SQL=ON -DARROW_BUILD_TESTS=ON
-$ cmake --build .
-$ ./debug/flight-sql-test-server
-Server listening on localhost:31337
-```
-
-Then, to run the tests, set the environment variable specifying the
-Flight location before running tests:
-
-```shell
-# From a build of the driver
-$ export ADBC_FLIGHT_SQL_LOCATION=grpc://localhost:31337
-$ ctest
-```
diff --git a/c/driver/flight_sql/flight_sql.cc b/c/driver/flight_sql/flight_sql.cc
deleted file mode 100644
index 56c78d1..0000000
--- a/c/driver/flight_sql/flight_sql.cc
+++ /dev/null
@@ -1,683 +0,0 @@
-// 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.
-
-#include <memory>
-#include <mutex>
-#include <string>
-
-#include <arrow/c/bridge.h>
-#include <arrow/flight/client.h>
-#include <arrow/flight/sql/client.h>
-#include <arrow/ipc/dictionary.h>
-#include <arrow/record_batch.h>
-#include <arrow/result.h>
-#include <arrow/status.h>
-#include <arrow/util/string_builder.h>
-#include <arrow/util/string_view.h>
-#include "adbc.h"
-#include "driver/util.h"
-
-namespace flight = arrow::flight;
-namespace flightsql = arrow::flight::sql;
-using arrow::Status;
-
-namespace {
-
-void ReleaseError(struct AdbcError* error) {
-  if (error->message) {
-    delete[] error->message;
-    error->message = nullptr;
-  }
-}
-
-template <typename... Args>
-void SetError(struct AdbcError* error, Args&&... args) {
-  if (!error) return;
-  std::string message =
-      arrow::util::StringBuilder("[Flight SQL] ", std::forward<Args>(args)...);
-  if (error->message) {
-    message.reserve(message.size() + 1 + std::strlen(error->message));
-    message.append(1, '\n');
-    message.append(error->message);
-    delete[] error->message;
-  }
-  error->message = new char[message.size() + 1];
-  message.copy(error->message, message.size());
-  error->message[message.size()] = '\0';
-  error->release = ReleaseError;
-}
-
-class FlightSqlDatabaseImpl {
- public:
-  FlightSqlDatabaseImpl() : client_(nullptr), connection_count_(0) {}
-
-  flightsql::FlightSqlClient* Connect() {
-    std::lock_guard<std::mutex> guard(mutex_);
-    if (client_) ++connection_count_;
-    return client_.get();
-  }
-
-  AdbcStatusCode Init(struct AdbcError* error) {
-    if (client_) {
-      SetError(error, "Database already initialized");
-      return ADBC_STATUS_INVALID_STATE;
-    }
-    auto it = options_.find("location");
-    if (it == options_.end()) {
-      SetError(error, "Must provide 'location' option");
-      return ADBC_STATUS_INVALID_ARGUMENT;
-    }
-
-    flight::Location location;
-    arrow::Status status = flight::Location::Parse(it->second).Value(&location);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_INVALID_ARGUMENT;
-    }
-
-    std::unique_ptr<flight::FlightClient> flight_client;
-    status = flight::FlightClient::Connect(location).Value(&flight_client);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-
-    client_.reset(new flightsql::FlightSqlClient(std::move(flight_client)));
-    options_.clear();
-    return ADBC_STATUS_OK;
-  }
-
-  AdbcStatusCode SetOption(const char* key, const char* value, struct AdbcError* error) {
-    if (client_) {
-      SetError(error, "Database already initialized");
-      return ADBC_STATUS_INVALID_STATE;
-    }
-    options_[key] = value;
-    return ADBC_STATUS_OK;
-  }
-
-  AdbcStatusCode Disconnect(struct AdbcError* error) {
-    std::lock_guard<std::mutex> guard(mutex_);
-    if (--connection_count_ < 0) {
-      SetError(error, "Connection count underflow");
-      return ADBC_STATUS_INTERNAL;
-    }
-    return ADBC_STATUS_OK;
-  }
-
-  AdbcStatusCode Release(struct AdbcError* error) {
-    std::lock_guard<std::mutex> guard(mutex_);
-
-    if (connection_count_ > 0) {
-      SetError(error, "Cannot release database with ", connection_count_,
-               " open connections");
-      return ADBC_STATUS_INTERNAL;
-    }
-
-    auto status = client_->Close();
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-    return ADBC_STATUS_OK;
-  }
-
- private:
-  std::unique_ptr<flightsql::FlightSqlClient> client_;
-  int connection_count_;
-  std::unordered_map<std::string, std::string> options_;
-  std::mutex mutex_;
-};
-
-class FlightInfoReader : public arrow::RecordBatchReader {
- public:
-  explicit FlightInfoReader(flightsql::FlightSqlClient* client,
-                            std::unique_ptr<flight::FlightInfo> info)
-      : client_(client), info_(std::move(info)), next_endpoint_(0) {}
-
-  std::shared_ptr<arrow::Schema> schema() const override { return schema_; }
-
-  Status ReadNext(std::shared_ptr<arrow::RecordBatch>* batch) override {
-    flight::FlightStreamChunk chunk;
-    while (current_stream_ && !chunk.data) {
-      ARROW_ASSIGN_OR_RAISE(chunk, current_stream_->Next());
-      if (chunk.data) {
-        *batch = chunk.data;
-        break;
-      }
-      if (!chunk.data && !chunk.app_metadata) {
-        RETURN_NOT_OK(NextStream());
-      }
-    }
-    if (!current_stream_) *batch = nullptr;
-    return Status::OK();
-  }
-
-  Status Close() override {
-    if (current_stream_) {
-      current_stream_->Cancel();
-    }
-    return Status::OK();
-  }
-
-  static AdbcStatusCode Export(flightsql::FlightSqlClient* client,
-                               std::unique_ptr<flight::FlightInfo> info,
-                               struct ArrowArrayStream* stream, struct AdbcError* error) {
-    auto reader = std::make_shared<FlightInfoReader>(client, std::move(info));
-    auto status = reader->NextStream();
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-    if (!reader->schema_) {
-      // Empty result set - fall back on schema in FlightInfo
-      arrow::ipc::DictionaryMemo memo;
-      status = info->GetSchema(&memo).Value(&reader->schema_);
-      if (!status.ok()) {
-        SetError(error, status);
-        return ADBC_STATUS_INTERNAL;
-      }
-    }
-
-    status = arrow::ExportRecordBatchReader(std::move(reader), stream);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_INTERNAL;
-    }
-    return ADBC_STATUS_OK;
-  }
-
- private:
-  Status NextStream() {
-    if (next_endpoint_ >= info_->endpoints().size()) {
-      current_stream_ = nullptr;
-      return Status::OK();
-    }
-    // TODO: this needs to account for location
-    flight::FlightCallOptions call_options;
-    ARROW_ASSIGN_OR_RAISE(
-        current_stream_,
-        client_->DoGet(call_options, info_->endpoints()[next_endpoint_].ticket));
-    next_endpoint_++;
-    if (!schema_) {
-      ARROW_ASSIGN_OR_RAISE(schema_, current_stream_->GetSchema());
-    }
-    return Status::OK();
-  }
-
-  flightsql::FlightSqlClient* client_;
-  std::unique_ptr<flight::FlightInfo> info_;
-  size_t next_endpoint_;
-  std::shared_ptr<arrow::Schema> schema_;
-  std::unique_ptr<flight::FlightStreamReader> current_stream_;
-};
-
-class FlightSqlConnectionImpl {
- public:
-  FlightSqlConnectionImpl() : database_(nullptr), client_(nullptr) {}
-
-  //----------------------------------------------------------
-  // Common Functions
-  //----------------------------------------------------------
-
-  flightsql::FlightSqlClient* client() const { return client_; }
-
-  AdbcStatusCode Init(struct AdbcDatabase* database, struct AdbcError* error) {
-    if (!database->private_data) {
-      SetError(error, "database is not initialized");
-      return ADBC_STATUS_INVALID_STATE;
-    }
-
-    database_ = *reinterpret_cast<std::shared_ptr<FlightSqlDatabaseImpl>*>(
-        database->private_data);
-    client_ = database_->Connect();
-    if (!client_) {
-      SetError(error, "Database not yet initialized!");
-      return ADBC_STATUS_INVALID_STATE;
-    }
-    return ADBC_STATUS_OK;
-  }
-
-  AdbcStatusCode Close(struct AdbcError* error) { return database_->Disconnect(error); }
-
-  //----------------------------------------------------------
-  // Metadata
-  //----------------------------------------------------------
-
-  AdbcStatusCode GetTableTypes(struct ArrowArrayStream* stream, struct AdbcError* error) {
-    flight::FlightCallOptions call_options;
-    std::unique_ptr<flight::FlightInfo> flight_info;
-    auto status = client_->GetTableTypes(call_options).Value(&flight_info);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-    return FlightInfoReader::Export(client_, std::move(flight_info), stream, error);
-  }
-
-  //----------------------------------------------------------
-  // Partitioned Results
-  //----------------------------------------------------------
-
-  AdbcStatusCode ReadPartition(const uint8_t* serialized_partition,
-                               size_t serialized_length, struct ArrowArrayStream* out,
-                               struct AdbcError* error) {
-    std::vector<flight::FlightEndpoint> endpoints(1);
-    endpoints[0].ticket.ticket = std::string(
-        reinterpret_cast<const char*>(serialized_partition), serialized_length);
-    auto maybe_info = flight::FlightInfo::Make(
-        *arrow::schema({}), flight::FlightDescriptor::Command(""), endpoints,
-        /*total_records=*/-1, /*total_bytes=*/-1);
-    if (!maybe_info.ok()) {
-      SetError(error, maybe_info.status());
-      return ADBC_STATUS_INVALID_ARGUMENT;
-    }
-    std::unique_ptr<flight::FlightInfo> flight_info(
-        new flight::FlightInfo(maybe_info.MoveValueUnsafe()));
-    return FlightInfoReader::Export(client_, std::move(flight_info), out, error);
-  }
-
- private:
-  std::shared_ptr<FlightSqlDatabaseImpl> database_;
-  flightsql::FlightSqlClient* client_;
-};
-
-class FlightSqlPartitionsImpl {
- public:
-  explicit FlightSqlPartitionsImpl(const arrow::flight::FlightInfo& info) {
-    partitions_.reserve(info.endpoints().size());
-    pointers_.reserve(info.endpoints().size());
-    lengths_.reserve(info.endpoints().size());
-    for (const flight::FlightEndpoint& endpoint : info.endpoints()) {
-      // TODO(lidavidm): ARROW-17052 we should be serializing the entire endpoint
-      partitions_.push_back(endpoint.ticket.ticket);
-      pointers_.push_back(reinterpret_cast<const uint8_t*>(partitions_.back().data()));
-      lengths_.push_back(partitions_.back().size());
-    }
-  }
-
-  static void Export(const arrow::flight::FlightInfo& info, struct AdbcPartitions* out) {
-    FlightSqlPartitionsImpl* impl = new FlightSqlPartitionsImpl(info);
-    out->num_partitions = info.endpoints().size();
-    out->num_partitions = impl->partitions_.size();
-    out->partitions = impl->pointers_.data();
-    out->partition_lengths = impl->lengths_.data();
-    out->private_data = impl;
-    out->release = &Release;
-  }
-
-  static void Release(struct AdbcPartitions* partitions) {
-    FlightSqlPartitionsImpl* impl =
-        static_cast<FlightSqlPartitionsImpl*>(partitions->private_data);
-    delete impl;
-    partitions->num_partitions = 0;
-    partitions->partitions = nullptr;
-    partitions->partition_lengths = nullptr;
-    partitions->private_data = nullptr;
-    partitions->release = nullptr;
-  }
-
- private:
-  std::vector<std::string> partitions_;
-  std::vector<const uint8_t*> pointers_;
-  std::vector<size_t> lengths_;
-};
-
-class FlightSqlStatementImpl {
- public:
-  explicit FlightSqlStatementImpl(std::shared_ptr<FlightSqlConnectionImpl> connection)
-      : connection_(std::move(connection)) {}
-
-  //----------------------------------------------------------
-  // Common Functions
-  //----------------------------------------------------------
-
-  AdbcStatusCode Close(struct AdbcError* error) { return ADBC_STATUS_OK; }
-
-  //----------------------------------------------------------
-  // Statement Functions
-  //----------------------------------------------------------
-
-  AdbcStatusCode ExecutePartitions(const std::shared_ptr<FlightSqlStatementImpl>& self,
-                                   struct ArrowSchema* schema,
-                                   struct AdbcPartitions* partitions,
-                                   int64_t* rows_affected, struct AdbcError* error) {
-    flight::FlightCallOptions call_options;
-    if (!schema || !partitions) {
-      SetError(error, "Must provide schema and partitions");
-      return ADBC_STATUS_INVALID_ARGUMENT;
-    }
-    std::unique_ptr<flight::FlightInfo> info;
-    auto status = connection_->client()->Execute(call_options, query_).Value(&info);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-    if (rows_affected) {
-      if (info->total_records() >= 0) {
-        *rows_affected = static_cast<size_t>(info->total_records());
-      } else {
-        *rows_affected = -1;
-      }
-    }
-
-    arrow::ipc::DictionaryMemo memo;
-    std::shared_ptr<arrow::Schema> arrow_schema;
-    status = info->GetSchema(&memo).Value(&arrow_schema);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_INTERNAL;
-    }
-
-    status = arrow::ExportSchema(*arrow_schema, schema);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_INTERNAL;
-    }
-
-    FlightSqlPartitionsImpl::Export(*info, partitions);
-    return ADBC_STATUS_OK;
-  }
-
-  AdbcStatusCode ExecuteQuery(const std::shared_ptr<FlightSqlStatementImpl>& self,
-                              struct ArrowArrayStream* out, int64_t* rows_affected,
-                              struct AdbcError* error) {
-    flight::FlightCallOptions call_options;
-    if (!out) {
-      SetError(error, "Must provide out");
-      return ADBC_STATUS_INVALID_ARGUMENT;
-    }
-    std::unique_ptr<flight::FlightInfo> info;
-    auto status = connection_->client()->Execute(call_options, query_).Value(&info);
-    if (!status.ok()) {
-      SetError(error, status);
-      return ADBC_STATUS_IO;
-    }
-    if (rows_affected) {
-      if (info->total_records() >= 0) {
-        *rows_affected = static_cast<size_t>(info->total_records());
-      } else {
-        *rows_affected = -1;
-      }
-    }
-    return FlightInfoReader::Export(connection_->client(), std::move(info), out, error);
-  }
-
-  AdbcStatusCode SetSqlQuery(const std::shared_ptr<FlightSqlStatementImpl>&,
-                             const char* query, struct AdbcError* error) {
-    query_ = query;
-    return ADBC_STATUS_OK;
-  }
-
- private:
-  std::shared_ptr<FlightSqlConnectionImpl> connection_;
-  std::string query_;
-};
-
-AdbcStatusCode FlightSqlDatabaseNew(struct AdbcDatabase* database,
-                                    struct AdbcError* error) {
-  auto impl = std::make_shared<FlightSqlDatabaseImpl>();
-  database->private_data = new std::shared_ptr<FlightSqlDatabaseImpl>(impl);
-  return ADBC_STATUS_OK;
-}
-
-AdbcStatusCode FlightSqlDatabaseSetOption(struct AdbcDatabase* database, const char* key,
-                                          const char* value, struct AdbcError* error) {
-  if (!database || !database->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlDatabaseImpl>*>(database->private_data);
-  return (*ptr)->SetOption(key, value, error);
-}
-
-AdbcStatusCode FlightSqlDatabaseInit(struct AdbcDatabase* database,
-                                     struct AdbcError* error) {
-  if (!database->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlDatabaseImpl>*>(database->private_data);
-  return (*ptr)->Init(error);
-}
-
-AdbcStatusCode FlightSqlDatabaseRelease(struct AdbcDatabase* database,
-                                        struct AdbcError* error) {
-  if (!database->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlDatabaseImpl>*>(database->private_data);
-  AdbcStatusCode status = (*ptr)->Release(error);
-  delete ptr;
-  database->private_data = nullptr;
-  return status;
-}
-
-AdbcStatusCode FlightSqlConnectionReadPartition(struct AdbcConnection* connection,
-                                                const uint8_t* serialized_partition,
-                                                size_t serialized_length,
-                                                struct ArrowArrayStream* out,
-                                                struct AdbcError* error) {
-  if (!connection->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr = reinterpret_cast<std::shared_ptr<FlightSqlConnectionImpl>*>(
-      connection->private_data);
-  return (*ptr)->ReadPartition(serialized_partition, serialized_length, out, error);
-}
-
-AdbcStatusCode FlightSqlConnectionGetTableTypes(struct AdbcConnection* connection,
-                                                struct ArrowArrayStream* stream,
-                                                struct AdbcError* error) {
-  if (!connection->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr = reinterpret_cast<std::shared_ptr<FlightSqlConnectionImpl>*>(
-      connection->private_data);
-  return (*ptr)->GetTableTypes(stream, error);
-}
-
-AdbcStatusCode FlightSqlConnectionNew(struct AdbcConnection* connection,
-                                      struct AdbcError* error) {
-  auto impl = std::make_shared<FlightSqlConnectionImpl>();
-  connection->private_data = new std::shared_ptr<FlightSqlConnectionImpl>(impl);
-  return ADBC_STATUS_OK;
-}
-
-AdbcStatusCode FlightSqlConnectionSetOption(struct AdbcConnection* connection,
-                                            const char* key, const char* value,
-                                            struct AdbcError* error) {
-  return ADBC_STATUS_OK;
-}
-
-AdbcStatusCode FlightSqlConnectionInit(struct AdbcConnection* connection,
-                                       struct AdbcDatabase* database,
-                                       struct AdbcError* error) {
-  if (!connection->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto ptr = reinterpret_cast<std::shared_ptr<FlightSqlConnectionImpl>*>(
-      connection->private_data);
-  return (*ptr)->Init(database, error);
-}
-
-AdbcStatusCode FlightSqlConnectionRelease(struct AdbcConnection* connection,
-                                          struct AdbcError* error) {
-  if (!connection->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr = reinterpret_cast<std::shared_ptr<FlightSqlConnectionImpl>*>(
-      connection->private_data);
-  auto status = (*ptr)->Close(error);
-  delete ptr;
-  connection->private_data = nullptr;
-  return status;
-}
-
-AdbcStatusCode FlightSqlStatementExecutePartitions(struct AdbcStatement* statement,
-                                                   struct ArrowSchema* schema,
-                                                   struct AdbcPartitions* partitions,
-                                                   int64_t* rows_affected,
-                                                   struct AdbcError* error) {
-  if (!statement->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlStatementImpl>*>(statement->private_data);
-  return (*ptr)->ExecutePartitions(*ptr, schema, partitions, rows_affected, error);
-}
-
-AdbcStatusCode FlightSqlStatementExecuteQuery(struct AdbcStatement* statement,
-                                              struct ArrowArrayStream* out,
-                                              int64_t* rows_affected,
-                                              struct AdbcError* error) {
-  if (!statement->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlStatementImpl>*>(statement->private_data);
-  return (*ptr)->ExecuteQuery(*ptr, out, rows_affected, error);
-}
-
-AdbcStatusCode FlightSqlStatementNew(struct AdbcConnection* connection,
-                                     struct AdbcStatement* statement,
-                                     struct AdbcError* error) {
-  auto* ptr = reinterpret_cast<std::shared_ptr<FlightSqlConnectionImpl>*>(
-      connection->private_data);
-  auto impl = std::make_shared<FlightSqlStatementImpl>(*ptr);
-  statement->private_data = new std::shared_ptr<FlightSqlStatementImpl>(impl);
-  return ADBC_STATUS_OK;
-}
-
-AdbcStatusCode FlightSqlStatementRelease(struct AdbcStatement* statement,
-                                         struct AdbcError* error) {
-  if (!statement->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlStatementImpl>*>(statement->private_data);
-  auto status = (*ptr)->Close(error);
-  delete ptr;
-  statement->private_data = nullptr;
-  return status;
-}
-
-AdbcStatusCode FlightSqlStatementSetSqlQuery(struct AdbcStatement* statement,
-                                             const char* query, struct AdbcError* error) {
-  if (!statement->private_data) return ADBC_STATUS_INVALID_STATE;
-  auto* ptr =
-      reinterpret_cast<std::shared_ptr<FlightSqlStatementImpl>*>(statement->private_data);
-  return (*ptr)->SetSqlQuery(*ptr, query, error);
-}
-}  // namespace
-
-AdbcStatusCode AdbcDatabaseInit(struct AdbcDatabase* database, struct AdbcError* error) {
-  return FlightSqlDatabaseInit(database, error);
-}
-
-AdbcStatusCode AdbcDatabaseNew(struct AdbcDatabase* database, struct AdbcError* error) {
-  return FlightSqlDatabaseNew(database, error);
-}
-
-AdbcStatusCode AdbcDatabaseSetOption(struct AdbcDatabase* database, const char* key,
-                                     const char* value, struct AdbcError* error) {
-  return FlightSqlDatabaseSetOption(database, key, value, error);
-}
-
-AdbcStatusCode AdbcDatabaseRelease(struct AdbcDatabase* database,
-                                   struct AdbcError* error) {
-  return FlightSqlDatabaseRelease(database, error);
-}
-
-AdbcStatusCode AdbcConnectionReadPartition(struct AdbcConnection* connection,
-                                           const uint8_t* serialized_partition,
-                                           size_t serialized_length,
-                                           struct ArrowArrayStream* out,
-                                           struct AdbcError* error) {
-  return FlightSqlConnectionReadPartition(connection, serialized_partition,
-                                          serialized_length, out, error);
-}
-
-AdbcStatusCode AdbcConnectionGetTableTypes(struct AdbcConnection* connection,
-                                           struct ArrowArrayStream* stream,
-                                           struct AdbcError* error) {
-  return FlightSqlConnectionGetTableTypes(connection, stream, error);
-}
-
-AdbcStatusCode AdbcConnectionInit(struct AdbcConnection* connection,
-                                  struct AdbcDatabase* database,
-                                  struct AdbcError* error) {
-  return FlightSqlConnectionInit(connection, database, error);
-}
-
-AdbcStatusCode AdbcConnectionNew(struct AdbcConnection* connection,
-                                 struct AdbcError* error) {
-  return FlightSqlConnectionNew(connection, error);
-}
-
-AdbcStatusCode AdbcConnectionSetOption(struct AdbcConnection* connection, const char* key,
-                                       const char* value, struct AdbcError* error) {
-  return FlightSqlConnectionSetOption(connection, key, value, error);
-}
-
-AdbcStatusCode AdbcConnectionRelease(struct AdbcConnection* connection,
-                                     struct AdbcError* error) {
-  return FlightSqlConnectionRelease(connection, error);
-}
-
-// XXX: cpplint gets confused if declared as struct ArrowSchema*
-AdbcStatusCode AdbcStatementExecutePartitions(struct AdbcStatement* statement,
-                                              ArrowSchema* schema,
-                                              struct AdbcPartitions* partitions,
-                                              int64_t* rows_affected,
-                                              struct AdbcError* error) {
-  return FlightSqlStatementExecutePartitions(statement, schema, partitions, rows_affected,
-                                             error);
-}
-
-AdbcStatusCode AdbcStatementExecuteQuery(struct AdbcStatement* statement,
-                                         struct ArrowArrayStream* out,
-                                         int64_t* rows_affected,
-                                         struct AdbcError* error) {
-  return FlightSqlStatementExecuteQuery(statement, out, rows_affected, error);
-}
-
-AdbcStatusCode AdbcStatementNew(struct AdbcConnection* connection,
-                                struct AdbcStatement* statement,
-                                struct AdbcError* error) {
-  return FlightSqlStatementNew(connection, statement, error);
-}
-
-AdbcStatusCode AdbcStatementRelease(struct AdbcStatement* statement,
-                                    struct AdbcError* error) {
-  return FlightSqlStatementRelease(statement, error);
-}
-
-AdbcStatusCode AdbcStatementSetSqlQuery(struct AdbcStatement* statement,
-                                        const char* query, struct AdbcError* error) {
-  return FlightSqlStatementSetSqlQuery(statement, query, error);
-}
-
-extern "C" {
-ADBC_EXPORT
-AdbcStatusCode AdbcDriverInit(int version, void* raw_driver, struct AdbcError* error) {
-  if (version != ADBC_VERSION_1_0_0) return ADBC_STATUS_NOT_IMPLEMENTED;
-
-  auto* driver = reinterpret_cast<struct AdbcDriver*>(raw_driver);
-  std::memset(driver, 0, sizeof(*driver));
-  driver->DatabaseNew = FlightSqlDatabaseNew;
-  driver->DatabaseSetOption = FlightSqlDatabaseSetOption;
-  driver->DatabaseInit = FlightSqlDatabaseInit;
-  driver->DatabaseRelease = FlightSqlDatabaseRelease;
-
-  driver->ConnectionNew = FlightSqlConnectionNew;
-  driver->ConnectionSetOption = FlightSqlConnectionSetOption;
-  driver->ConnectionInit = FlightSqlConnectionInit;
-  driver->ConnectionReadPartition = FlightSqlConnectionReadPartition;
-  driver->ConnectionRelease = FlightSqlConnectionRelease;
-  driver->ConnectionGetTableTypes = FlightSqlConnectionGetTableTypes;
-
-  driver->StatementExecutePartitions = FlightSqlStatementExecutePartitions;
-  driver->StatementExecuteQuery = FlightSqlStatementExecuteQuery;
-  driver->StatementNew = FlightSqlStatementNew;
-  driver->StatementRelease = FlightSqlStatementRelease;
-  driver->StatementSetSqlQuery = FlightSqlStatementSetSqlQuery;
-
-  return ADBC_STATUS_OK;
-}
-}
diff --git a/c/driver/flight_sql/flight_sql_test.cc b/c/driver/flight_sql/flight_sql_test.cc
deleted file mode 100644
index e1c6ce6..0000000
--- a/c/driver/flight_sql/flight_sql_test.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// 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.
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <cstdlib>
-
-#include <arrow/record_batch.h>
-#include <arrow/testing/gtest_util.h>
-#include <arrow/testing/matchers.h>
-#include <arrow/util/logging.h>
-
-#include "adbc.h"
-#include "driver/test_util.h"
-
-namespace adbc {
-
-using arrow::PointeesEqual;
-
-static const char kServerEnvVar[] = "ADBC_FLIGHT_SQL_LOCATION";
-
-class AdbcFlightSqlTest : public ::testing::Test {
- public:
-  void SetUp() override {
-    if (const char* location = std::getenv(kServerEnvVar)) {
-      ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseNew(&database, &error));
-      ADBC_ASSERT_OK_WITH_ERROR(
-          error, AdbcDatabaseSetOption(&database, "location", location, &error));
-      ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseInit(&database, &error));
-      ADBC_ASSERT_OK_WITH_ERROR(error, AdbcConnectionNew(&connection, &error));
-      ADBC_ASSERT_OK_WITH_ERROR(error,
-                                AdbcConnectionInit(&connection, &database, &error));
-    } else {
-      FAIL() << "Must provide location of Flight SQL server at " << kServerEnvVar;
-    }
-  }
-
-  void TearDown() override {
-    ADBC_ASSERT_OK_WITH_ERROR(error, AdbcConnectionRelease(&connection, &error));
-    ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseRelease(&database, &error));
-  }
-
- protected:
-  AdbcDriver driver;
-  AdbcDatabase database;
-  AdbcConnection connection;
-  AdbcError error = {};
-};
-
-TEST_F(AdbcFlightSqlTest, Metadata) {
-  struct ArrowArrayStream stream;
-  ADBC_ASSERT_OK_WITH_ERROR(error,
-                            AdbcConnectionGetTableTypes(&connection, &stream, &error));
-
-  std::shared_ptr<arrow::Schema> schema;
-  arrow::RecordBatchVector batches;
-  ASSERT_NO_FATAL_FAILURE(ReadStream(&stream, &schema, &batches));
-  ASSERT_SCHEMA_EQ(
-      *schema,
-      *arrow::schema({arrow::field("table_type", arrow::utf8(), /*nullable=*/false)}));
-  EXPECT_THAT(batches, ::testing::UnorderedPointwise(
-                           PointeesEqual(),
-                           {
-                               adbc::RecordBatchFromJSON(schema, R"([["table"]])"),
-                           }));
-}
-
-TEST_F(AdbcFlightSqlTest, SqlExecute) {
-  std::string query = "SELECT 1";
-  AdbcStatement statement;
-  std::memset(&statement, 0, sizeof(statement));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementNew(&connection, &statement, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error,
-                            AdbcStatementSetSqlQuery(&statement, query.c_str(), &error));
-
-  std::shared_ptr<arrow::Schema> schema;
-  arrow::RecordBatchVector batches;
-  ASSERT_NO_FATAL_FAILURE(ReadStatement(&statement, &schema, &batches));
-  ASSERT_SCHEMA_EQ(*schema, *arrow::schema({arrow::field("1", arrow::int64())}));
-  EXPECT_THAT(batches,
-              ::testing::UnorderedPointwise(
-                  PointeesEqual(), {
-                                       adbc::RecordBatchFromJSON(schema, "[[1]]"),
-                                   }));
-}
-
-TEST_F(AdbcFlightSqlTest, SqlExecuteInvalid) {
-  std::string query = "INVALID";
-  AdbcStatement statement;
-  std::memset(&statement, 0, sizeof(statement));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementNew(&connection, &statement, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error,
-                            AdbcStatementSetSqlQuery(&statement, query.c_str(), &error));
-  struct ArrowArrayStream stream;
-  ASSERT_NE(AdbcStatementExecuteQuery(&statement, &stream, nullptr, &error),
-            ADBC_STATUS_OK);
-  ADBC_ASSERT_ERROR_THAT(error, ::testing::HasSubstr("syntax error"));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementRelease(&statement, &error));
-}
-
-TEST_F(AdbcFlightSqlTest, Partitions) {
-  // Serialize the query result handle into a partition so it can be
-  // retrieved separately. (With multiple partitions we could
-  // distribute them across multiple machines or fetch data in
-  // parallel.)
-  std::string query = "SELECT 42";
-  AdbcStatement statement;
-  std::memset(&statement, 0, sizeof(statement));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementNew(&connection, &statement, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error,
-                            AdbcStatementSetSqlQuery(&statement, query.c_str(), &error));
-  struct ArrowSchema result_set_schema;
-  struct AdbcPartitions partitions;
-  std::memset(&partitions, 0, sizeof(partitions));
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error, AdbcStatementExecutePartitions(&statement, &result_set_schema, &partitions,
-                                            /*rows_affected=*/nullptr, &error));
-
-  ASSERT_EQ(partitions.num_partitions, 1);
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementRelease(&statement, &error));
-
-  // Reconstruct the partition
-  struct ArrowArrayStream stream;
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcConnectionReadPartition(
-                                       &connection, partitions.partitions[0],
-                                       partitions.partition_lengths[0], &stream, &error));
-  partitions.release(&partitions);
-  result_set_schema.release(&result_set_schema);
-
-  std::shared_ptr<arrow::Schema> schema;
-  arrow::RecordBatchVector batches;
-  ASSERT_NO_FATAL_FAILURE(ReadStream(&stream, &schema, &batches));
-  ASSERT_SCHEMA_EQ(*schema, *arrow::schema({arrow::field("42", arrow::int64())}));
-  EXPECT_THAT(batches,
-              ::testing::UnorderedPointwise(
-                  PointeesEqual(), {
-                                       adbc::RecordBatchFromJSON(schema, "[[42]]"),
-                                   }));
-}
-
-}  // namespace adbc
diff --git a/c/driver/sqlite/CMakeLists.txt b/c/driver/sqlite/CMakeLists.txt
index 820d14e..1a40a3f 100644
--- a/c/driver/sqlite/CMakeLists.txt
+++ b/c/driver/sqlite/CMakeLists.txt
@@ -48,6 +48,7 @@ add_arrow_lib(adbc_driver_sqlite
 include_directories(SYSTEM ${REPOSITORY_ROOT})
 include_directories(SYSTEM ${REPOSITORY_ROOT}/c/)
 include_directories(SYSTEM ${REPOSITORY_ROOT}/c/vendor/nanoarrow/)
+include_directories(SYSTEM ${SQLite3_INCLUDE_DIRS})
 foreach(LIB_TARGET ${ADBC_LIBRARIES})
   target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
 endforeach()
diff --git a/c/driver/test_util.h b/c/driver/test_util.h
deleted file mode 100644
index 9c8040e..0000000
--- a/c/driver/test_util.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// 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.
-
-#pragma once
-
-#include <memory>
-#include <string>
-#include <utility>
-
-#include <arrow/c/bridge.h>
-#include <arrow/ipc/json_simple.h>
-#include <arrow/record_batch.h>
-#include <arrow/result.h>
-#include <arrow/testing/gtest_util.h>
-#include <arrow/util/macros.h>
-#include "adbc.h"
-
-namespace adbc {
-
-#define ADBC_ASSERT_OK(expr)          \
-  do {                                \
-    auto code_ = (expr);              \
-    ASSERT_EQ(code_, ADBC_STATUS_OK); \
-  } while (false)
-
-#define ADBC_ASSERT_OK_WITH_ERROR(ERROR, EXPR)                                 \
-  do {                                                                         \
-    auto code_ = (EXPR);                                                       \
-    if (code_ != ADBC_STATUS_OK) {                                             \
-      std::string errmsg_ = ERROR.message ? ERROR.message : "(unknown error)"; \
-      if (ERROR.message) error.release(&error);                                \
-      ASSERT_EQ(code_, ADBC_STATUS_OK) << errmsg_;                             \
-    }                                                                          \
-  } while (false)
-
-#define ADBC_ASSERT_ERROR_THAT(ERROR, PATTERN)                               \
-  do {                                                                       \
-    ASSERT_NE(ERROR.message, nullptr);                                       \
-    std::string errmsg_ = ERROR.message ? ERROR.message : "(unknown error)"; \
-    if (ERROR.message) error.release(&error);                                \
-    ASSERT_THAT(errmsg_, PATTERN) << errmsg_;                                \
-  } while (false)
-
-#define ASSERT_SCHEMA_EQ(schema1, schema2) \
-  ASSERT_TRUE((schema1).Equals((schema2))) \
-      << "LHS: " << (schema1).ToString() << "RHS: " << (schema2).ToString()
-
-static inline void ReadStream(struct ArrowArrayStream* stream,
-                              std::shared_ptr<arrow::Schema>* schema,
-                              arrow::RecordBatchVector* batches) {
-  ASSERT_OK_AND_ASSIGN(auto reader, arrow::ImportRecordBatchReader(stream));
-
-  *schema = reader->schema();
-
-  while (true) {
-    ASSERT_OK_AND_ASSIGN(auto batch, reader->Next());
-    if (!batch) break;
-    batches->push_back(std::move(batch));
-  }
-}
-
-static inline void ReadStatement(AdbcStatement* statement,
-                                 std::shared_ptr<arrow::Schema>* schema,
-                                 arrow::RecordBatchVector* batches) {
-  AdbcError error = {};
-  ArrowArrayStream stream;
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error, AdbcStatementExecuteQuery(statement, &stream, nullptr, &error));
-  ASSERT_NO_FATAL_FAILURE(ReadStream(&stream, schema, batches));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcStatementRelease(statement, &error));
-}
-
-static inline std::shared_ptr<arrow::RecordBatch> RecordBatchFromJSON(
-    const std::shared_ptr<arrow::Schema>& schema, const std::string& json) {
-  auto struct_type = arrow::struct_(schema->fields());
-  std::shared_ptr<arrow::Array> struct_array =
-      *arrow::ipc::internal::json::ArrayFromJSON(struct_type, json);
-  return *arrow::RecordBatch::FromStructArray(struct_array);
-}
-
-}  // namespace adbc
diff --git a/c/driver/util.h b/c/driver/util.h
deleted file mode 100644
index 1ac8408..0000000
--- a/c/driver/util.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-#include <string>
-#include <unordered_map>
-
-#include "arrow/result.h"
-#include "arrow/util/string_view.h"
-
-#define ADBC_RETURN_NOT_OK(expr)         \
-  do {                                   \
-    auto _s = (expr);                    \
-    if (_s != ADBC_STATUS_OK) return _s; \
-  } while (false)
diff --git a/c/driver_manager/adbc_driver_manager_test.cc b/c/driver_manager/adbc_driver_manager_test.cc
index 23975e3..3f37fd6 100644
--- a/c/driver_manager/adbc_driver_manager_test.cc
+++ b/c/driver_manager/adbc_driver_manager_test.cc
@@ -24,7 +24,6 @@
 
 #include "adbc.h"
 #include "adbc_driver_manager.h"
-#include "driver/test_util.h"
 #include "validation/adbc_validation.h"
 #include "validation/adbc_validation_util.h"
 
@@ -51,7 +50,7 @@ class DriverManager : public ::testing::Test {
     }
 
     if (driver.release) {
-      ADBC_ASSERT_OK_WITH_ERROR(error, driver.release(&driver, &error));
+      ASSERT_THAT(driver.release(&driver, &error), IsOkStatus(&error));
       ASSERT_EQ(driver.private_data, nullptr);
       ASSERT_EQ(driver.private_manager, nullptr);
     }
@@ -67,23 +66,23 @@ TEST_F(DriverManager, DatabaseCustomInitFunc) {
   std::memset(&database, 0, sizeof(database));
 
   // Explicitly set entrypoint
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseNew(&database, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error, AdbcDatabaseSetOption(&database, "driver", "adbc_driver_sqlite", &error));
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error, AdbcDatabaseSetOption(&database, "entrypoint", "AdbcDriverInit", &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseInit(&database, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseRelease(&database, &error));
+  ASSERT_THAT(AdbcDatabaseNew(&database, &error), IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseSetOption(&database, "driver", "adbc_driver_sqlite", &error),
+              IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseSetOption(&database, "entrypoint", "AdbcDriverInit", &error),
+              IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseInit(&database, &error), IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseRelease(&database, &error), IsOkStatus(&error));
 
   // Set invalid entrypoint
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseNew(&database, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error, AdbcDatabaseSetOption(&database, "driver", "adbc_driver_sqlite", &error));
-  ADBC_ASSERT_OK_WITH_ERROR(
-      error,
-      AdbcDatabaseSetOption(&database, "entrypoint", "ThisSymbolDoesNotExist", &error));
+  ASSERT_THAT(AdbcDatabaseNew(&database, &error), IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseSetOption(&database, "driver", "adbc_driver_sqlite", &error),
+              IsOkStatus(&error));
+  ASSERT_THAT(
+      AdbcDatabaseSetOption(&database, "entrypoint", "ThisSymbolDoesNotExist", &error),
+      IsOkStatus(&error));
   ASSERT_EQ(ADBC_STATUS_INTERNAL, AdbcDatabaseInit(&database, &error));
-  ADBC_ASSERT_OK_WITH_ERROR(error, AdbcDatabaseRelease(&database, &error));
+  ASSERT_THAT(AdbcDatabaseRelease(&database, &error), IsOkStatus(&error));
 }
 
 class SqliteQuirks : public adbc_validation::DriverQuirks {