Skip to content

Commit

Permalink
Update arrow requirement from 40 to 41 (#172)
Browse files Browse the repository at this point in the history
* Update arrow requirement from 40 to 41

Updates the requirements on [arrow](https://github.com/apache/arrow-rs) to permit the latest version.
- [Changelog](https://github.com/apache/arrow-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/apache/arrow-rs/commits)

---
updated-dependencies:
- dependency-name: arrow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* disable clone clippy

* remove as_string

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: wangfenjin <wangfenj@gmail.com>
  • Loading branch information
dependabot[bot] and wangfenjin authored Jun 15, 2023
1 parent cb39dec commit 8c73970
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ memchr = "2.3"
uuid = { version = "1.0", optional = true }
smallvec = "1.6.1"
cast = { version = "0.3", features = ["std"] }
arrow = { version = "40", default-features = false, features = ["prettyprint", "ffi"] }
arrow = { version = "41", default-features = false, features = ["prettyprint", "ffi"] }
rust_decimal = "1.14"
strum = { version = "0.24", features = ["derive"] }
r2d2 = { version = "0.8.9", optional = true }
Expand Down
1 change: 1 addition & 0 deletions duckdb-loadable-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::redundant_clone)]
use proc_macro2::Ident;

use syn::{parse_macro_input, spanned::Spanned, Item};
Expand Down
2 changes: 1 addition & 1 deletion libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ serde_json = { version = "1.0" }
tar = "0.4.38"

[dev-dependencies]
arrow = { version = "40", default-features = false, features = ["ffi"] }
arrow = { version = "41", default-features = false, features = ["ffi"] }
13 changes: 8 additions & 5 deletions src/vtab/function.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::{
as_string,
ffi::{
duckdb_bind_add_result_column, duckdb_bind_get_extra_info, duckdb_bind_get_parameter,
duckdb_bind_get_parameter_count, duckdb_bind_info, duckdb_bind_set_bind_data, duckdb_bind_set_cardinality,
Expand Down Expand Up @@ -29,17 +28,19 @@ impl BindInfo {
/// * `name`: The name of the column
/// * `type`: The logical type of the column
pub fn add_result_column(&self, column_name: &str, column_type: LogicalType) {
let c_str = CString::new(column_name).unwrap();
unsafe {
duckdb_bind_add_result_column(self.ptr, as_string!(column_name), column_type.ptr);
duckdb_bind_add_result_column(self.ptr, c_str.as_ptr() as *const c_char, column_type.ptr);
}
}
/// Report that an error has occurred while calling bind.
///
/// # Arguments
/// * `error`: The error message
pub fn set_error(&self, error: &str) {
let c_str = CString::new(error).unwrap();
unsafe {
duckdb_bind_set_error(self.ptr, as_string!(error));
duckdb_bind_set_error(self.ptr, c_str.as_ptr() as *const c_char);
}
}
/// Sets the user-provided bind data in the bind object. This object can be retrieved again during execution.
Expand Down Expand Up @@ -157,7 +158,8 @@ impl InitInfo {
/// # Arguments
/// * `error`: The error message
pub fn set_error(&self, error: &str) {
unsafe { duckdb_init_set_error(self.0, as_string!(error)) }
let c_str = CString::new(error).unwrap();
unsafe { duckdb_init_set_error(self.0, c_str.as_ptr() as *const c_char) }
}
}

Expand Down Expand Up @@ -298,8 +300,9 @@ impl FunctionInfo {
/// # Arguments
/// * `error`: The error message
pub fn set_error(&self, error: &str) {
let c_str = CString::new(error).unwrap();
unsafe {
duckdb_function_set_error(self.0, as_string!(error));
duckdb_function_set_error(self.0, c_str.as_ptr() as *const c_char);
}
}
/// Gets the bind data set by [`BindInfo::set_bind_data`] during the bind.
Expand Down
9 changes: 0 additions & 9 deletions src/vtab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ pub use vector::{FlatVector, Inserter, ListVector, StructVector, Vector};

use ffi::{duckdb_bind_info, duckdb_data_chunk, duckdb_function_info, duckdb_init_info};

/// Returns a `*const c_char` pointer to the given string
#[macro_export]
macro_rules! as_string {
($x:expr) => {
std::ffi::CString::new($x).expect("c string").as_ptr().cast::<c_char>()
};
}
pub(crate) use as_string;

use ffi::duckdb_malloc;
use std::mem::size_of;

Expand Down

0 comments on commit 8c73970

Please sign in to comment.