Skip to content

Commit 5498723

Browse files
committed
chore(rust): bump dep versions, crate edition and msrv
Signed-off-by: if0ne <pavel.agafonov.al@gmail.com>
1 parent bb3f4bf commit 5498723

14 files changed

Lines changed: 678 additions & 720 deletions

File tree

rust/Cargo.lock

Lines changed: 517 additions & 590 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ resolver = "2"
2222
[workspace.package]
2323
version = "0.23.0"
2424
description = "Rust implementation of Arrow Database Connectivity (ADBC)"
25-
edition = "2021"
26-
rust-version = "1.81"
25+
edition = "2024"
26+
rust-version = "1.88"
2727
authors = ["Apache Arrow <dev@arrow.apache.org>"]
2828
license = "Apache-2.0"
2929
documentation = "https://docs.rs/adbc_core/"
@@ -37,9 +37,9 @@ categories = ["database"]
3737
adbc_core = { path = "./core", version = "0.23.0" }
3838
adbc_driver_manager = { path = "./driver_manager", version = "0.23.0" }
3939
adbc_ffi = { path = "./ffi", version = "0.23.0" }
40-
arrow-array = { version = ">=53.1.0, <59", default-features = false, features = [
40+
arrow-array = { version = ">=58, <59", default-features = false, features = [
4141
"ffi",
4242
] }
43-
arrow-buffer = { version = ">=53.1.0, <59", default-features = false }
44-
arrow-schema = { version = ">=53.1.0, <59", default-features = false }
45-
arrow-select = { version = ">=53.1.0, <59", default-features = false }
43+
arrow-buffer = { version = ">=58, <59", default-features = false }
44+
arrow-schema = { version = ">=58, <59", default-features = false }
45+
arrow-select = { version = ">=58, <59", default-features = false }

rust/driver/datafusion/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ categories.workspace = true
3333
[dependencies]
3434
adbc_core.workspace = true
3535
adbc_ffi = { workspace = true, optional = true }
36-
arrow-array = "57.3.0"
37-
arrow-buffer = "57.3.0"
38-
arrow-schema = "57.3.0"
39-
datafusion = { version = "52.1.0", default-features = false }
40-
datafusion-substrait = { version = "52.1.0", default-features = false }
36+
arrow-array = "58"
37+
arrow-buffer = "58"
38+
arrow-schema = "58"
39+
datafusion = { git = "https://github.com/apache/arrow-datafusion", default-features = false, features = ["sql"] }
40+
datafusion-substrait = { git = "https://github.com/apache/arrow-datafusion", default-features = false }
4141
tokio = { version = "1.50", features = ["rt-multi-thread"] }
4242
prost = "0.14.3"
4343

4444
[dev-dependencies]
45-
arrow-select = "57.3.0"
45+
arrow-select = "58"
4646

4747
[lib]
4848
crate-type = ["lib", "cdylib"]

rust/driver/datafusion/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ use arrow_buffer::{OffsetBuffer, ScalarBuffer};
4141
use arrow_schema::{ArrowError, DataType, Field, SchemaRef};
4242

4343
use adbc_core::{
44+
Connection, Database, Driver, Optionable, Statement,
4445
error::{Error, Result, Status},
4546
options::{
4647
InfoCode, ObjectDepth, OptionConnection, OptionDatabase, OptionStatement, OptionValue,
4748
},
48-
schemas, Connection, Database, Driver, Optionable, Statement,
49+
schemas,
4950
};
5051

5152
pub enum Runtime {

rust/driver/dummy/src/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ use arrow_buffer::{OffsetBuffer, ScalarBuffer};
2929
use arrow_schema::{ArrowError, DataType, Field, Schema, SchemaRef, UnionFields};
3030

3131
use adbc_core::{
32-
constants,
32+
Connection, Database, Driver, Optionable, PartitionedResult, Statement, constants,
3333
error::{Error, Result, Status},
3434
options::{
3535
InfoCode, ObjectDepth, OptionConnection, OptionDatabase, OptionStatement, OptionValue,
3636
},
37-
schemas, Connection, Database, Driver, Optionable, PartitionedResult, Statement,
37+
schemas,
3838
};
3939

4040
#[derive(Debug)]
@@ -177,13 +177,12 @@ where
177177

178178
fn maybe_panic(fnname: impl AsRef<str>) {
179179
if let Some(func) = std::env::var_os("PANICDUMMY_FUNC").map(|x| x.to_string_lossy().to_string())
180+
&& fnname.as_ref() == func
180181
{
181-
if fnname.as_ref() == func {
182-
let message = std::env::var_os("PANICDUMMY_MESSAGE")
183-
.map(|x| x.to_string_lossy().to_string())
184-
.unwrap_or_else(|| format!("We panicked in {}!", fnname.as_ref()));
185-
panic!("{}", message);
186-
}
182+
let message = std::env::var_os("PANICDUMMY_MESSAGE")
183+
.map(|x| x.to_string_lossy().to_string())
184+
.unwrap_or_else(|| format!("We panicked in {}!", fnname.as_ref()));
185+
panic!("{}", message);
187186
}
188187
}
189188

rust/driver/snowflake/src/database/builder.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ use std::env;
2525
use std::{fmt, path::PathBuf, str::FromStr, time::Duration};
2626

2727
use adbc_core::{
28+
Driver as _,
2829
error::{Error, Result, Status},
2930
options::{OptionDatabase, OptionValue},
30-
Driver as _,
3131
};
3232
use url::{Host, Url};
3333

34-
use crate::{builder::BuilderIter, Database, Driver};
34+
use crate::{Database, Driver, builder::BuilderIter};
3535
#[cfg(feature = "env")]
3636
use crate::{
3737
builder::{env_parse, env_parse_map_err},
@@ -1097,7 +1097,9 @@ mod tests {
10971097
#[test]
10981098
fn from_env_parse_error() {
10991099
// Set a value that fails to parse to a LogLevel
1100-
env::set_var(Builder::LOG_TRACING_ENV, "warning");
1100+
unsafe {
1101+
env::set_var(Builder::LOG_TRACING_ENV, "warning");
1102+
}
11011103
let result = Builder::from_env();
11021104
assert!(result.is_err());
11031105
assert_eq!(
@@ -1108,15 +1110,19 @@ mod tests {
11081110
)
11091111
);
11101112
// Fix it to move on
1111-
env::set_var(Builder::LOG_TRACING_ENV, "warn");
1113+
1114+
unsafe { env::set_var(Builder::LOG_TRACING_ENV, "warn") };
11121115

11131116
// Set a value that fails to parse to a duration
1114-
env::set_var(Builder::LOGIN_TIMEOUT_ENV, "forever");
1117+
unsafe { env::set_var(Builder::LOGIN_TIMEOUT_ENV, "forever") };
11151118
let result = Builder::from_env();
11161119
assert!(result.is_err());
11171120
assert_eq!(
11181121
result.unwrap_err(),
1119-
Error::with_message_and_status("invalid duration (valid durations are a sequence of decimal numbers, each with optional fraction and a unit suffix, such as 300ms, 1.5h, 2h45m, valid time units are ns, us, ms, s, m, h)", Status::InvalidArguments)
1122+
Error::with_message_and_status(
1123+
"invalid duration (valid durations are a sequence of decimal numbers, each with optional fraction and a unit suffix, such as 300ms, 1.5h, 2h45m, valid time units are ns, us, ms, s, m, h)",
1124+
Status::InvalidArguments
1125+
)
11201126
);
11211127
}
11221128
}

rust/driver/snowflake/src/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl fmt::Debug for Driver {
6464
}
6565

6666
#[cfg(any(feature = "bundled", feature = "linked"))]
67-
extern "C" {
67+
unsafe extern "C" {
6868
#[link_name = "AdbcDriverSnowflakeInit"]
6969
fn init(version: c_int, raw_driver: *mut c_void, err: *mut FFI_AdbcError) -> AdbcStatusCode;
7070
}

rust/driver/snowflake/src/driver/builder.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ use adbc_core::{
2424
options::AdbcVersion,
2525
};
2626

27+
use crate::Driver;
2728
#[cfg(feature = "env")]
2829
use crate::builder::env_parse;
29-
use crate::Driver;
3030

3131
/// A builder for [`Driver`].
3232
///
@@ -94,7 +94,9 @@ mod tests {
9494
#[test]
9595
fn from_env_parse_error() {
9696
// Set a value that fails to parse to an AdbcVersion
97-
env::set_var(Builder::ADBC_VERSION_ENV, "?");
97+
unsafe {
98+
env::set_var(Builder::ADBC_VERSION_ENV, "?");
99+
}
98100
let result = Builder::from_env();
99101
assert!(result.is_err());
100102
assert_eq!(

rust/driver_manager/src/search.rs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use path_slash::PathBufExt;
1919
use std::borrow::Cow;
20-
use std::ffi::{c_void, OsStr};
20+
use std::ffi::{OsStr, c_void};
2121
use std::fmt::Write;
2222
use std::fs;
2323
use std::path::{Path, PathBuf};
@@ -27,10 +27,10 @@ use libloading::Symbol;
2727
use toml::de::{DeTable, DeValue};
2828

2929
use adbc_core::{
30+
LOAD_FLAG_ALLOW_RELATIVE_PATHS, LOAD_FLAG_SEARCH_ENV, LOAD_FLAG_SEARCH_SYSTEM,
31+
LOAD_FLAG_SEARCH_USER, LoadFlags,
3032
error::{Error, Result, Status},
3133
options::AdbcVersion,
32-
LoadFlags, LOAD_FLAG_ALLOW_RELATIVE_PATHS, LOAD_FLAG_SEARCH_ENV, LOAD_FLAG_SEARCH_SYSTEM,
33-
LOAD_FLAG_SEARCH_USER,
3434
};
3535
use adbc_ffi::{
3636
options::check_status,
@@ -695,8 +695,8 @@ const fn arch_triplet() -> (&'static str, &'static str, &'static str) {
695695
mod target_windows {
696696
use windows_sys as windows;
697697

698-
use std::ffi::c_void;
699698
use std::ffi::OsString;
699+
use std::ffi::c_void;
700700
use std::os::windows::ffi::OsStringExt;
701701
use std::path::PathBuf;
702702
use std::slice;
@@ -788,30 +788,28 @@ fn system_config_dir() -> Option<PathBuf> {
788788

789789
fn get_search_paths(lvls: LoadFlags) -> Vec<PathBuf> {
790790
let mut result = Vec::new();
791-
if lvls & LOAD_FLAG_SEARCH_ENV != 0 {
792-
if let Some(paths) = env::var_os("ADBC_DRIVER_PATH") {
793-
for p in env::split_paths(&paths) {
794-
result.push(p);
795-
}
791+
if lvls & LOAD_FLAG_SEARCH_ENV != 0
792+
&& let Some(paths) = env::var_os("ADBC_DRIVER_PATH")
793+
{
794+
for p in env::split_paths(&paths) {
795+
result.push(p);
796796
}
797797
}
798798

799-
if lvls & LOAD_FLAG_SEARCH_USER != 0 {
800-
if let Some(path) = user_config_dir() {
801-
if path.exists() {
802-
result.push(path);
803-
}
804-
}
799+
if lvls & LOAD_FLAG_SEARCH_USER != 0
800+
&& let Some(path) = user_config_dir()
801+
&& path.exists()
802+
{
803+
result.push(path);
805804
}
806805

807806
// system level for windows is to search the registry keys
808807
#[cfg(not(windows))]
809-
if lvls & LOAD_FLAG_SEARCH_SYSTEM != 0 {
810-
if let Some(path) = system_config_dir() {
811-
if path.exists() {
812-
result.push(path);
813-
}
814-
}
808+
if lvls & LOAD_FLAG_SEARCH_SYSTEM != 0
809+
&& let Some(path) = system_config_dir()
810+
&& path.exists()
811+
{
812+
result.push(path);
815813
}
816814

817815
result
@@ -1017,7 +1015,7 @@ pub(crate) fn parse_driver_uri<'a>(uri: &'a str) -> Result<DriverLocator<'a>> {
10171015
mod tests {
10181016
use std::env;
10191017

1020-
use adbc_core::{options::AdbcVersion, LOAD_FLAG_ALLOW_RELATIVE_PATHS};
1018+
use adbc_core::{LOAD_FLAG_ALLOW_RELATIVE_PATHS, options::AdbcVersion};
10211019
use temp_env::{with_var, with_var_unset};
10221020

10231021
use crate::ManagedDriver;

rust/driver_manager/tests/connection_profile.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
use std::path::PathBuf;
1919

2020
use adbc_core::options::{AdbcVersion, OptionDatabase, OptionValue};
21-
use adbc_core::{error::Status, LOAD_FLAG_DEFAULT};
21+
use adbc_core::{LOAD_FLAG_DEFAULT, error::Status};
22+
use adbc_driver_manager::ManagedDatabase;
2223
use adbc_driver_manager::profile::{
2324
ConnectionProfile, ConnectionProfileProvider, FilesystemProfileProvider,
2425
};
25-
use adbc_driver_manager::ManagedDatabase;
2626
use serial_test::serial;
2727

2828
mod common;
@@ -460,7 +460,9 @@ fn test_profile_hierarchical_path_via_env_var() {
460460

461461
// Set ADBC_PROFILE_PATH to the parent directory
462462
let prev_value = env::var_os("ADBC_PROFILE_PATH");
463-
env::set_var("ADBC_PROFILE_PATH", tmp_dir.path());
463+
unsafe {
464+
env::set_var("ADBC_PROFILE_PATH", tmp_dir.path());
465+
}
464466

465467
// Verify the environment variable is set correctly
466468
assert_eq!(
@@ -473,9 +475,11 @@ fn test_profile_hierarchical_path_via_env_var() {
473475
let result = provider.get_profile("databases/postgres/production", None);
474476

475477
// Restore the original environment variable
476-
match prev_value {
477-
Some(val) => env::set_var("ADBC_PROFILE_PATH", val),
478-
None => env::remove_var("ADBC_PROFILE_PATH"),
478+
unsafe {
479+
match prev_value {
480+
Some(val) => env::set_var("ADBC_PROFILE_PATH", val),
481+
None => env::remove_var("ADBC_PROFILE_PATH"),
482+
}
479483
}
480484

481485
// Verify the profile was loaded successfully
@@ -518,16 +522,20 @@ fn test_profile_hierarchical_path_with_extension_via_env_var() {
518522

519523
// Set ADBC_PROFILE_PATH to the parent directory
520524
let prev_value = env::var_os("ADBC_PROFILE_PATH");
521-
env::set_var("ADBC_PROFILE_PATH", tmp_dir.path());
525+
unsafe {
526+
env::set_var("ADBC_PROFILE_PATH", tmp_dir.path());
527+
}
522528

523529
// Try to load the profile using hierarchical relative path with .toml extension
524530
let provider = FilesystemProfileProvider;
525531
let result = provider.get_profile("configs/dev/database.toml", None);
526532

527533
// Restore the original environment variable
528-
match prev_value {
529-
Some(val) => env::set_var("ADBC_PROFILE_PATH", val),
530-
None => env::remove_var("ADBC_PROFILE_PATH"),
534+
unsafe {
535+
match prev_value {
536+
Some(val) => env::set_var("ADBC_PROFILE_PATH", val),
537+
None => env::remove_var("ADBC_PROFILE_PATH"),
538+
}
531539
}
532540

533541
// Verify the profile was loaded successfully

0 commit comments

Comments
 (0)