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 c74f3d32c chore(rust)!: use `arrow-*` subcrates and bump to `53.1.0`
(#2208)
c74f3d32c is described below
commit c74f3d32c3d2448288eb18eb8bdac720883ec18f
Author: Matthijs Brobbel <[email protected]>
AuthorDate: Tue Oct 8 04:10:48 2024 +0200
chore(rust)!: use `arrow-*` subcrates and bump to `53.1.0` (#2208)
As discussed in
https://github.com/apache/arrow-adbc/pull/1725#discussion_r1567512784,
we can now use the `arrow-*` subcrates. This also bumps these `arrow`
crates to the latest release. This is a breaking change for the
`adbc_core` crate.
---
.github/workflows/rust.yml | 10 +-
rust/Cargo.lock | 264 ++--------------------
rust/Cargo.toml | 7 +-
rust/core/Cargo.toml | 6 +-
rust/core/src/driver_exporter.rs | 18 +-
rust/core/src/driver_manager.rs | 18 +-
rust/core/src/error.rs | 2 +-
rust/core/src/ffi/methods.rs | 4 +-
rust/core/src/lib.rs | 14 +-
rust/core/src/schemas.rs | 2 +-
rust/core/tests/common/mod.rs | 13 +-
rust/core/tests/driver_manager_sqlite.rs | 2 +-
rust/drivers/dummy/Cargo.toml | 9 +-
rust/drivers/dummy/src/lib.rs | 89 ++++----
rust/drivers/dummy/tests/driver_exporter_dummy.rs | 7 +-
15 files changed, 124 insertions(+), 341 deletions(-)
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 8f2ff7ddf..9a367ea5d 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -44,6 +44,9 @@ defaults:
jobs:
native-unix:
uses: ./.github/workflows/native-unix.yml
+ permissions:
+ contents: read
+ id-token: write
rust:
needs: [native-unix]
@@ -70,7 +73,12 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: driver-manager-${{ matrix.os }}
- path: ${{ github.workspace }}/build
+ path: "~"
+ - name: Untar artifacts
+ shell: bash -l {0}
+ run: |
+ cd
+ tar xvf ~/local.tgz -C ${{ github.workspace }}/build
- name: Set dynamic linker path
if: matrix.os == 'ubuntu-latest'
run: |
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index d89c533d8..12ccab568 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -6,7 +6,9 @@ version = 3
name = "adbc_core"
version = "0.15.0"
dependencies = [
- "arrow",
+ "arrow-array",
+ "arrow-schema",
+ "arrow-select",
"libloading",
"once_cell",
]
@@ -16,7 +18,10 @@ name = "adbc_dummy"
version = "0.15.0"
dependencies = [
"adbc_core",
- "arrow",
+ "arrow-array",
+ "arrow-buffer",
+ "arrow-schema",
+ "arrow-select",
]
[[package]]
@@ -33,15 +38,6 @@ dependencies = [
"zerocopy",
]
-[[package]]
-name = "aho-corasick"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
-dependencies = [
- "memchr",
-]
-
[[package]]
name = "android-tzdata"
version = "0.1.1"
@@ -57,44 +53,11 @@ dependencies = [
"libc",
]
-[[package]]
-name = "arrow"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "219d05930b81663fd3b32e3bde8ce5bff3c4d23052a99f11a8fa50a3b47b2658"
-dependencies = [
- "arrow-arith",
- "arrow-array",
- "arrow-buffer",
- "arrow-cast",
- "arrow-data",
- "arrow-ord",
- "arrow-row",
- "arrow-schema",
- "arrow-select",
- "arrow-string",
-]
-
-[[package]]
-name = "arrow-arith"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0272150200c07a86a390be651abdd320a2d12e84535f0837566ca87ecd8f95e0"
-dependencies = [
- "arrow-array",
- "arrow-buffer",
- "arrow-data",
- "arrow-schema",
- "chrono",
- "half",
- "num",
-]
-
[[package]]
name = "arrow-array"
-version = "51.0.0"
+version = "53.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8010572cf8c745e242d1b632bd97bd6d4f40fefed5ed1290a8f433abaa686fea"
+checksum = "7f16835e8599dbbb1659fd869d865254c4cf32c6c2bb60b6942ac9fc36bfa5da"
dependencies = [
"ahash",
"arrow-buffer",
@@ -108,91 +71,41 @@ dependencies = [
[[package]]
name = "arrow-buffer"
-version = "51.0.0"
+version = "53.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d0a2432f0cba5692bf4cb757469c66791394bac9ec7ce63c1afe74744c37b27"
+checksum = "1a1f34f0faae77da6b142db61deba2cb6d60167592b178be317b341440acba80"
dependencies = [
"bytes",
"half",
"num",
]
-[[package]]
-name = "arrow-cast"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9abc10cd7995e83505cc290df9384d6e5412b207b79ce6bdff89a10505ed2cba"
-dependencies = [
- "arrow-array",
- "arrow-buffer",
- "arrow-data",
- "arrow-schema",
- "arrow-select",
- "atoi",
- "base64",
- "chrono",
- "half",
- "lexical-core",
- "num",
- "ryu",
-]
-
[[package]]
name = "arrow-data"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2742ac1f6650696ab08c88f6dd3f0eb68ce10f8c253958a18c943a68cd04aec5"
-dependencies = [
- "arrow-buffer",
- "arrow-schema",
- "half",
- "num",
-]
-
-[[package]]
-name = "arrow-ord"
-version = "51.0.0"
+version = "53.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3e6b61e3dc468f503181dccc2fc705bdcc5f2f146755fa5b56d0a6c5943f412"
+checksum = "2b1e618bbf714c7a9e8d97203c806734f012ff71ae3adc8ad1b075689f540634"
dependencies = [
- "arrow-array",
"arrow-buffer",
- "arrow-data",
"arrow-schema",
- "arrow-select",
"half",
"num",
]
-[[package]]
-name = "arrow-row"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "848ee52bb92eb459b811fb471175ea3afcf620157674c8794f539838920f9228"
-dependencies = [
- "ahash",
- "arrow-array",
- "arrow-buffer",
- "arrow-data",
- "arrow-schema",
- "half",
- "hashbrown",
-]
-
[[package]]
name = "arrow-schema"
-version = "51.0.0"
+version = "53.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02d9483aaabe910c4781153ae1b6ae0393f72d9ef757d38d09d450070cf2e528"
+checksum = "fbf0388a18fd7f7f3fe3de01852d30f54ed5182f9004db700fbe3ba843ed2794"
dependencies = [
"bitflags",
]
[[package]]
name = "arrow-select"
-version = "51.0.0"
+version = "53.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "849524fa70e0e3c5ab58394c770cb8f514d0122d20de08475f7b472ed8075830"
+checksum = "b83e5723d307a38bf00ecd2972cd078d1339c7fd3eb044f609958a9a24463f3a"
dependencies = [
"ahash",
"arrow-array",
@@ -202,44 +115,12 @@ dependencies = [
"num",
]
-[[package]]
-name = "arrow-string"
-version = "51.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9373cb5a021aee58863498c37eb484998ef13377f69989c6c5ccfbd258236cdb"
-dependencies = [
- "arrow-array",
- "arrow-buffer",
- "arrow-data",
- "arrow-schema",
- "arrow-select",
- "memchr",
- "num",
- "regex",
- "regex-syntax",
-]
-
-[[package]]
-name = "atoi"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
-dependencies = [
- "num-traits",
-]
-
[[package]]
name = "autocfg"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
-[[package]]
-name = "base64"
-version = "0.22.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
-
[[package]]
name = "bitflags"
version = "2.5.0"
@@ -374,70 +255,6 @@ dependencies = [
"wasm-bindgen",
]
-[[package]]
-name = "lexical-core"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46"
-dependencies = [
- "lexical-parse-float",
- "lexical-parse-integer",
- "lexical-util",
- "lexical-write-float",
- "lexical-write-integer",
-]
-
-[[package]]
-name = "lexical-parse-float"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f"
-dependencies = [
- "lexical-parse-integer",
- "lexical-util",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-parse-integer"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9"
-dependencies = [
- "lexical-util",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-util"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc"
-dependencies = [
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-write-float"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862"
-dependencies = [
- "lexical-util",
- "lexical-write-integer",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-write-integer"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446"
-dependencies = [
- "lexical-util",
- "static_assertions",
-]
-
[[package]]
name = "libc"
version = "0.2.155"
@@ -466,12 +283,6 @@ version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
-[[package]]
-name = "memchr"
-version = "2.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
-
[[package]]
name = "num"
version = "0.4.3"
@@ -570,47 +381,6 @@ dependencies = [
"proc-macro2",
]
-[[package]]
-name = "regex"
-version = "1.10.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-automata",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-automata"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
-
-[[package]]
-name = "ryu"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
-
-[[package]]
-name = "static_assertions"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-
[[package]]
name = "syn"
version = "2.0.66"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 21a0e20bc..31174d19a 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -33,5 +33,10 @@ keywords = ["arrow"]
categories = ["database"]
[workspace.dependencies]
-arrow = { version = "51.0.0", default-features = false, features = ["ffi"] }
adbc_core = { path = "./core" }
+arrow-array = { version = "53.1.0", default-features = false, features = [
+ "ffi",
+] }
+arrow-buffer = { version = "53.1.0", default-features = false }
+arrow-schema = { version = "53.1.0", default-features = false }
+arrow-select = { version = "53.1.0", default-features = false }
diff --git a/rust/core/Cargo.toml b/rust/core/Cargo.toml
index fd7bc8820..5acf07a83 100644
--- a/rust/core/Cargo.toml
+++ b/rust/core/Cargo.toml
@@ -23,9 +23,13 @@ authors = { workspace = true }
license = { workspace = true }
[dependencies]
-arrow = { workspace = true }
+arrow-array.workspace = true
+arrow-schema.workspace = true
libloading = { version = "0.8", optional = true }
once_cell = "1.19.0"
+[dev-dependencies]
+arrow-select.workspace = true
+
[features]
driver_manager = ["dep:libloading"]
diff --git a/rust/core/src/driver_exporter.rs b/rust/core/src/driver_exporter.rs
index bd0951759..9c7531509 100644
--- a/rust/core/src/driver_exporter.rs
+++ b/rust/core/src/driver_exporter.rs
@@ -20,10 +20,10 @@ use std::ffi::{CStr, CString};
use std::hash::Hash;
use std::os::raw::{c_char, c_int, c_void};
-use arrow::array::StructArray;
-use arrow::datatypes::DataType;
-use arrow::ffi::{from_ffi, FFI_ArrowArray, FFI_ArrowSchema};
-use arrow::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
+use arrow_array::ffi::{from_ffi, FFI_ArrowArray, FFI_ArrowSchema};
+use arrow_array::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
+use arrow_array::StructArray;
+use arrow_schema::DataType;
use crate::error::{Error, Result, Status};
use crate::ffi::constants::ADBC_STATUS_OK;
@@ -168,15 +168,15 @@ impl<DriverType: Driver + Default + 'static> FFIDriver
for DriverType {
/// # Parameters
///
/// - `$func_name` - Driver's initialization function name. The recommended
name
-/// is `AdbcDriverInit`, or a name derived from the name of the driver's shared
-/// library as follows: remove the `lib` prefix (on Unix systems) and all file
-/// extensions, then `PascalCase` the driver name, append `Init`, and prepend
-/// `Adbc` (if not already there). For example:
+/// is `AdbcDriverInit`, or a name derived from the name of the driver's
shared
+/// library as follows: remove the `lib` prefix (on Unix systems) and all
file
+/// extensions, then `PascalCase` the driver name, append `Init`, and prepend
+/// `Adbc` (if not already there). For example:
/// - `libadbc_driver_sqlite.so.2.0.0` -> `AdbcDriverSqliteInit`
/// - `adbc_driver_sqlite.dll` -> `AdbcDriverSqliteInit`
/// - `proprietary_driver.dll` -> `AdbcProprietaryDriverInit`
/// - `$driver_type` - Driver's type which must implement [Driver] and
[Default].
-/// Currently, the Rust driver is exported as an ADBC 1.1.0 C driver.
+/// Currently, the Rust driver is exported as an ADBC 1.1.0 C driver.
#[macro_export]
macro_rules! export_driver {
($func_name:ident, $driver_type:ty) => {
diff --git a/rust/core/src/driver_manager.rs b/rust/core/src/driver_manager.rs
index 40ef974f7..25015a2bd 100644
--- a/rust/core/src/driver_manager.rs
+++ b/rust/core/src/driver_manager.rs
@@ -23,10 +23,10 @@
//!
//! There are two ways that drivers can be used:
//! 1. By linking (either statically or dynamically) the driver implementation
-//! at link-time and then using [ManagedDriver::load_static].
+//! at link-time and then using [ManagedDriver::load_static].
//! 2. By loading the driver implementation at run-time (with
`dlopen/LoadLibrary`)
-//! using [ManagedDriver::load_dynamic_from_name] or
-//! [ManagedDriver::load_dynamic_from_filename].
+//! using [ManagedDriver::load_dynamic_from_name] or
+//! [ManagedDriver::load_dynamic_from_filename].
//!
//! Drivers are initialized using a function provided by the driver as a main
//! entrypoint, canonically called `AdbcDriverInit`. Although many will use a
@@ -110,9 +110,9 @@ use std::os::raw::{c_char, c_void};
use std::ptr::{null, null_mut};
use std::sync::{Arc, Mutex};
-use arrow::array::{Array, RecordBatch, RecordBatchReader, StructArray};
-use arrow::ffi::{to_ffi, FFI_ArrowSchema};
-use arrow::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
+use arrow_array::ffi::{to_ffi, FFI_ArrowSchema};
+use arrow_array::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
+use arrow_array::{Array, RecordBatch, RecordBatchReader, StructArray};
use crate::{
error::{Error, Status},
@@ -881,7 +881,7 @@ impl Connection for ManagedConnection {
catalog: Option<&str>,
db_schema: Option<&str>,
table_name: &str,
- ) -> Result<arrow::datatypes::Schema> {
+ ) -> Result<arrow_schema::Schema> {
let catalog = catalog.map(CString::new).transpose()?;
let db_schema = db_schema.map(CString::new).transpose()?;
let table_name = CString::new(table_name)?;
@@ -1053,7 +1053,7 @@ impl Statement for ManagedStatement {
Ok(reader)
}
- fn execute_schema(&mut self) -> Result<arrow::datatypes::Schema> {
+ fn execute_schema(&mut self) -> Result<arrow_schema::Schema> {
let driver =
&self.inner.connection.database.driver.driver.lock().unwrap();
let mut statement = self.inner.statement.lock().unwrap();
let mut error = ffi::FFI_AdbcError::with_driver(driver);
@@ -1110,7 +1110,7 @@ impl Statement for ManagedStatement {
Ok(result)
}
- fn get_parameter_schema(&self) -> Result<arrow::datatypes::Schema> {
+ fn get_parameter_schema(&self) -> Result<arrow_schema::Schema> {
let driver =
&self.inner.connection.database.driver.driver.lock().unwrap();
let mut statement = self.inner.statement.lock().unwrap();
let mut error = ffi::FFI_AdbcError::with_driver(driver);
diff --git a/rust/core/src/error.rs b/rust/core/src/error.rs
index 2ee19452d..67d2113f4 100644
--- a/rust/core/src/error.rs
+++ b/rust/core/src/error.rs
@@ -20,7 +20,7 @@
use std::os::raw::c_char;
use std::{ffi::NulError, fmt::Display};
-use arrow::error::ArrowError;
+use arrow_schema::ArrowError;
/// Status of an operation.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
diff --git a/rust/core/src/ffi/methods.rs b/rust/core/src/ffi/methods.rs
index e7f40459a..e47fe4fff 100644
--- a/rust/core/src/ffi/methods.rs
+++ b/rust/core/src/ffi/methods.rs
@@ -19,8 +19,8 @@
use std::os::raw::{c_char, c_int};
-use arrow::ffi::{FFI_ArrowArray, FFI_ArrowSchema};
-use arrow::ffi_stream::FFI_ArrowArrayStream;
+use arrow_array::ffi::{FFI_ArrowArray, FFI_ArrowSchema};
+use arrow_array::ffi_stream::FFI_ArrowArrayStream;
use super::{
constants::ADBC_STATUS_NOT_IMPLEMENTED, FFI_AdbcConnection,
FFI_AdbcDatabase, FFI_AdbcError,
diff --git a/rust/core/src/lib.rs b/rust/core/src/lib.rs
index 901f6a574..8568c8b82 100644
--- a/rust/core/src/lib.rs
+++ b/rust/core/src/lib.rs
@@ -28,9 +28,9 @@
//! This library currently provides:
//! - An abstract Rust API to be implemented by vendor-specific drivers.
//! - A driver manager which implements this same API, but dynamically loads
-//! drivers internally and forwards calls appropriately using the [C
API](https://github.com/apache/arrow-adbc/blob/main/adbc.h).
+//! drivers internally and forwards calls appropriately using the [C
API](https://github.com/apache/arrow-adbc/blob/main/adbc.h).
//! - A driver exporter that takes an implementation of the abstract API and
-//! turns it into an object file that implements the C API.
+//! turns it into an object file that implements the C API.
//!
//! # Native Rust drivers
//!
@@ -70,8 +70,8 @@ pub mod schemas;
use std::collections::HashSet;
-use arrow::datatypes::Schema;
-use arrow::record_batch::{RecordBatch, RecordBatchReader};
+use arrow_array::{RecordBatch, RecordBatchReader};
+use arrow_schema::Schema;
use error::Result;
use options::{OptionConnection, OptionDatabase, OptionStatement, OptionValue};
@@ -335,9 +335,9 @@ pub trait Connection: Optionable<Option = OptionConnection>
{
/// - `db_schema` - The database schema (or `None` if not applicable). May
be a search pattern
/// - `table_name` - The table name (or `None` if not applicable). May be
a search pattern
/// - `approximate` - If false, request exact values of statistics, else
- /// allow for best-effort, approximate, or cached values. The database may
- /// return approximate values regardless, as indicated in the result.
- /// Requesting exact values may be expensive or unsupported.
+ /// allow for best-effort, approximate, or cached values. The database
may
+ /// return approximate values regardless, as indicated in the result.
+ /// Requesting exact values may be expensive or unsupported.
///
/// # Result
///
diff --git a/rust/core/src/schemas.rs b/rust/core/src/schemas.rs
index 4dabecefa..29afa755f 100644
--- a/rust/core/src/schemas.rs
+++ b/rust/core/src/schemas.rs
@@ -19,7 +19,7 @@
use std::sync::Arc;
-use arrow::datatypes::{DataType, Field, Schema, SchemaRef, UnionFields,
UnionMode};
+use arrow_schema::{DataType, Field, Schema, SchemaRef, UnionFields, UnionMode};
use once_cell::sync::Lazy;
/// Schema of the data returned by
[get_table_types][crate::Connection::get_table_types].
diff --git a/rust/core/tests/common/mod.rs b/rust/core/tests/common/mod.rs
index 3631579a3..b55a6ddd3 100644
--- a/rust/core/tests/common/mod.rs
+++ b/rust/core/tests/common/mod.rs
@@ -29,11 +29,12 @@ use adbc_core::options::{
use adbc_core::schemas;
use adbc_core::{Connection, Database, Driver, Optionable, Statement};
-use arrow::array::{as_string_array, Array, Float64Array, Int64Array,
StringArray};
-use arrow::compute::concat_batches;
-use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
-use arrow::error::ArrowError;
-use arrow::record_batch::{RecordBatch, RecordBatchReader};
+use arrow_array::{
+ cast::as_string_array, Array, Float64Array, Int64Array, RecordBatch,
RecordBatchReader,
+ StringArray,
+};
+use arrow_schema::{ArrowError, DataType, Field, Schema, SchemaRef};
+use arrow_select::concat::concat_batches;
pub struct SingleBatchReader {
batch: Option<RecordBatch>,
@@ -226,7 +227,7 @@ pub fn test_connection_get_table_schema(connection: &mut
ManagedConnection) {
let mut statement = connection.new_statement().unwrap();
statement
- .set_sql_query(&format!("create table {TABLE_NAME}(a bigint, b
bigint);"))
+ .set_sql_query(format!("create table {TABLE_NAME}(a bigint, b
bigint);"))
.unwrap();
statement.execute_update().unwrap();
diff --git a/rust/core/tests/driver_manager_sqlite.rs
b/rust/core/tests/driver_manager_sqlite.rs
index db83de580..e6053b8dd 100644
--- a/rust/core/tests/driver_manager_sqlite.rs
+++ b/rust/core/tests/driver_manager_sqlite.rs
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-use arrow::datatypes::{Field, Schema};
+use arrow_schema::{Field, Schema};
use adbc_core::driver_manager::{ManagedDatabase, ManagedDriver};
use adbc_core::options::{AdbcVersion, OptionConnection, OptionDatabase};
diff --git a/rust/drivers/dummy/Cargo.toml b/rust/drivers/dummy/Cargo.toml
index eb933e18c..ec690af84 100644
--- a/rust/drivers/dummy/Cargo.toml
+++ b/rust/drivers/dummy/Cargo.toml
@@ -24,8 +24,13 @@ authors = { workspace = true }
license = { workspace = true }
[dependencies]
-arrow = { workspace = true }
-adbc_core = { workspace = true }
+adbc_core = { path = "../../core" }
+arrow-array.workspace = true
+arrow-buffer.workspace = true
+arrow-schema.workspace = true
+
+[dev-dependencies]
+arrow-select.workspace = true
[lib]
crate-type = ["lib", "cdylib"]
diff --git a/rust/drivers/dummy/src/lib.rs b/rust/drivers/dummy/src/lib.rs
index 3591a4ed9..4ba348c3a 100644
--- a/rust/drivers/dummy/src/lib.rs
+++ b/rust/drivers/dummy/src/lib.rs
@@ -20,14 +20,13 @@ use std::sync::Arc;
use std::{collections::HashMap, fmt::Debug, hash::Hash};
use adbc_core::options::Statistics;
-use arrow::array::{
+use arrow_array::{
Array, ArrayRef, BinaryArray, BooleanArray, Float64Array, Int16Array,
Int32Array, Int64Array,
- ListArray, MapArray, StringArray, StructArray, UInt32Array, UInt64Array,
UnionArray,
+ ListArray, MapArray, RecordBatch, RecordBatchReader, StringArray,
StructArray, UInt32Array,
+ UInt64Array, UnionArray,
};
-use arrow::buffer::{Buffer, OffsetBuffer, ScalarBuffer};
-use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
-use arrow::error::ArrowError;
-use arrow::record_batch::{RecordBatch, RecordBatchReader};
+use arrow_buffer::{OffsetBuffer, ScalarBuffer};
+use arrow_schema::{ArrowError, DataType, Field, Schema, SchemaRef,
UnionFields};
use adbc_core::{
error::{Error, Result, Status},
@@ -354,46 +353,42 @@ impl Connection for DummyConnection {
Into::<u32>::into(&InfoCode::DriverArrowVersion),
]);
- let type_id_buffer = Buffer::from_slice_ref([0_i8, 1, 2, 3, 4, 5]);
- let value_offsets_buffer = Buffer::from_slice_ref([0_i32, 0, 0, 0, 0,
0]);
+ let type_id_buffer = [0_i8, 1, 2, 3, 4, 5]
+ .into_iter()
+ .collect::<ScalarBuffer<i8>>();
+ let value_offsets_buffer = [0_i32, 0, 0, 0, 0, 0]
+ .into_iter()
+ .collect::<ScalarBuffer<i32>>();
let value_array = UnionArray::try_new(
- &[0, 1, 2, 3, 4, 5],
- type_id_buffer,
- Some(value_offsets_buffer),
- vec![
- (
+ UnionFields::new(
+ [0, 1, 2, 3, 4, 5],
+ [
Field::new("string_value",
string_value_array.data_type().clone(), true),
- Arc::new(string_value_array),
- ),
- (
Field::new("bool_value",
bool_value_array.data_type().clone(), true),
- Arc::new(bool_value_array),
- ),
- (
Field::new("int64_value",
int64_value_array.data_type().clone(), true),
- Arc::new(int64_value_array),
- ),
- (
Field::new(
"int32_bitmask",
int32_bitmask_array.data_type().clone(),
true,
),
- Arc::new(int32_bitmask_array),
- ),
- (
Field::new("string_list",
string_list_array.data_type().clone(), true),
- Arc::new(string_list_array),
- ),
- (
Field::new(
"int32_to_int32_list_map",
int32_to_int32_list_map_array.data_type().clone(),
true,
),
- Arc::new(int32_to_int32_list_map_array),
- ),
+ ],
+ ),
+ type_id_buffer,
+ Some(value_offsets_buffer),
+ vec![
+ Arc::new(string_value_array),
+ Arc::new(bool_value_array),
+ Arc::new(int64_value_array),
+ Arc::new(int32_bitmask_array),
+ Arc::new(string_list_array),
+ Arc::new(int32_to_int32_list_map_array),
],
)?;
@@ -654,29 +649,25 @@ impl Connection for DummyConnection {
let statistic_value_uint64_array = UInt64Array::from(vec![42]);
let statistic_value_float64_array =
Float64Array::from(Vec::<f64>::new());
let statistic_value_binary_array =
BinaryArray::from(Vec::<&[u8]>::new());
- let type_id_buffer = Buffer::from_slice_ref([1_i8]);
- let value_offsets_buffer = Buffer::from_slice_ref([0_i32]);
+ let type_id_buffer = [1_i8].into_iter().collect::<ScalarBuffer<i8>>();
+ let value_offsets_buffer =
[0_i32].into_iter().collect::<ScalarBuffer<i32>>();
let statistic_value_array = UnionArray::try_new(
- &[0, 1, 2, 3],
- type_id_buffer,
- Some(value_offsets_buffer),
- vec![
- (
+ UnionFields::new(
+ [0, 1, 2, 3],
+ [
Field::new("int64", DataType::Int64, true),
- Arc::new(statistic_value_int64_array),
- ),
- (
Field::new("uint64", DataType::UInt64, true),
- Arc::new(statistic_value_uint64_array),
- ),
- (
Field::new("float64", DataType::Float64, true),
- Arc::new(statistic_value_float64_array),
- ),
- (
Field::new("binary", DataType::Binary, true),
- Arc::new(statistic_value_binary_array),
- ),
+ ],
+ ),
+ type_id_buffer,
+ Some(value_offsets_buffer),
+ vec![
+ Arc::new(statistic_value_int64_array),
+ Arc::new(statistic_value_uint64_array),
+ Arc::new(statistic_value_float64_array),
+ Arc::new(statistic_value_binary_array),
],
)?;
@@ -775,7 +766,7 @@ impl Connection for DummyConnection {
catalog: Option<&str>,
db_schema: Option<&str>,
table_name: &str,
- ) -> Result<arrow::datatypes::Schema> {
+ ) -> Result<arrow_schema::Schema> {
let catalog = catalog.unwrap_or("default");
let db_schema = db_schema.unwrap_or("default");
diff --git a/rust/drivers/dummy/tests/driver_exporter_dummy.rs
b/rust/drivers/dummy/tests/driver_exporter_dummy.rs
index 318f822f9..a9601cbde 100644
--- a/rust/drivers/dummy/tests/driver_exporter_dummy.rs
+++ b/rust/drivers/dummy/tests/driver_exporter_dummy.rs
@@ -22,10 +22,9 @@
use std::ops::Deref;
use std::sync::Arc;
-use arrow::array::{Array, Float64Array, Int64Array, StringArray};
-use arrow::compute::concat_batches;
-use arrow::datatypes::{DataType, Field, Schema};
-use arrow::record_batch::{RecordBatch, RecordBatchReader};
+use arrow_array::{Array, Float64Array, Int64Array, RecordBatch,
RecordBatchReader, StringArray};
+use arrow_schema::{DataType, Field, Schema};
+use arrow_select::concat::concat_batches;
use adbc_core::driver_manager::{
ManagedConnection, ManagedDatabase, ManagedDriver, ManagedStatement,