Skip to content

Commit

Permalink
Update arrow requirement from 32 to 33 (#123)
Browse files Browse the repository at this point in the history
* Update arrow requirement from 32 to 33

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

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

Signed-off-by: dependabot[bot] <[email protected]>

* fix clippy

Change-Id: I2f9df13eecad63025d0bac3c01850bcfb26464c9

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: wangfenjin <[email protected]>
  • Loading branch information
dependabot[bot] and wangfenjin authored Feb 14, 2023
1 parent 18eff6d commit e636b3b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ memchr = "2.3"
uuid = { version = "1.0", optional = true }
smallvec = "1.6.1"
cast = { version = "0.3", features = ["std"] }
arrow = { version = "32", default-features = false, features = ["prettyprint", "ffi"] }
arrow = { version = "33", 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
2 changes: 1 addition & 1 deletion libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ cc = { version = "1.0", features = ["parallel"], optional = true }
vcpkg = { version = "0.2", optional = true }

[dev-dependencies]
arrow = { version = "32", default-features = false, features = ["ffi"] }
arrow = { version = "33", default-features = false, features = ["ffi"] }
22 changes: 11 additions & 11 deletions libduckdb-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,23 @@ mod tests {
assert_eq!(duckdb_arrow_row_count(result), 3);
assert_eq!(duckdb_arrow_column_count(result), 2);

let mut arrays = &FFI_ArrowArray::empty();
let mut schema = &FFI_ArrowSchema::empty();
let schema = &mut schema;
if duckdb_query_arrow_schema(result, schema as *mut _ as *mut duckdb_arrow_schema)
!= duckdb_state_DuckDBSuccess
let mut arrays = FFI_ArrowArray::empty();
let mut schema = FFI_ArrowSchema::empty();
if duckdb_query_arrow_schema(
result,
&mut std::ptr::addr_of_mut!(schema) as *mut _ as *mut duckdb_arrow_schema,
) != duckdb_state_DuckDBSuccess
{
panic!("SELECT error")
}
let arrays = &mut arrays;
if duckdb_query_arrow_array(result, arrays as *mut _ as *mut duckdb_arrow_array)
!= duckdb_state_DuckDBSuccess
if duckdb_query_arrow_array(
result,
&mut std::ptr::addr_of_mut!(arrays) as *mut _ as *mut duckdb_arrow_array,
) != duckdb_state_DuckDBSuccess
{
panic!("SELECT error")
}
let arrow_array =
ArrowArray::try_from_raw(*arrays as *const FFI_ArrowArray, *schema as *const FFI_ArrowSchema)
.expect("ok");
let arrow_array = ArrowArray::new(arrays, schema);
let array_data = ArrayData::try_from(arrow_array).expect("ok");
let struct_array = StructArray::from(array_data);
assert_eq!(struct_array.len(), 3);
Expand Down
24 changes: 12 additions & 12 deletions src/raw_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,28 @@ impl RawStatement {
pub fn step(&self) -> Option<StructArray> {
self.result?;
unsafe {
let mut arrays = &FFI_ArrowArray::empty();
let arrays = &mut arrays;
if ffi::duckdb_query_arrow_array(self.result_unwrap(), arrays as *mut _ as *mut ffi::duckdb_arrow_array)
!= ffi::DuckDBSuccess
let mut arrays = FFI_ArrowArray::empty();
if ffi::duckdb_query_arrow_array(
self.result_unwrap(),
&mut std::ptr::addr_of_mut!(arrays) as *mut _ as *mut ffi::duckdb_arrow_array,
) != ffi::DuckDBSuccess
{
return None;
}
if (**arrays).is_empty() {
if arrays.is_empty() {
return None;
}

let mut schema = &FFI_ArrowSchema::empty();
let schema = &mut schema;
if ffi::duckdb_query_arrow_schema(self.result_unwrap(), schema as *mut _ as *mut ffi::duckdb_arrow_schema)
!= ffi::DuckDBSuccess
let mut schema = FFI_ArrowSchema::empty();
if ffi::duckdb_query_arrow_schema(
self.result_unwrap(),
&mut std::ptr::addr_of_mut!(schema) as *mut _ as *mut ffi::duckdb_arrow_schema,
) != ffi::DuckDBSuccess
{
return None;
}

let arrow_array =
ArrowArray::try_from_raw(*arrays as *const FFI_ArrowArray, *schema as *const FFI_ArrowSchema)
.expect("ok");
let arrow_array = ArrowArray::new(arrays, schema);
let array_data = ArrayData::try_from(arrow_array).expect("ok");
let struct_array = StructArray::from(array_data);
Some(struct_array)
Expand Down

0 comments on commit e636b3b

Please sign in to comment.