Skip to content

Commit

Permalink
Update arrow requirement from 25 to 26 (#96)
Browse files Browse the repository at this point in the history
* Update arrow requirement from 25 to 26

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@25.0.0...26.0.0)

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

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

* fix clippy error

Change-Id: Idb65d2547e1f706a510137904ab14d6f15a74741

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 Nov 8, 2022
1 parent 67d6c90 commit 1a7968d
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 37 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 = "25", default-features = false, features = ["prettyprint", "ffi"] }
arrow = { version = "26", 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 = "25", default-features = false, features = ["ffi"] }
arrow = { version = "26", default-features = false, features = ["ffi"] }
12 changes: 6 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ mod test {
db.execute_batch("CREATE TABLE foo(x Text)")?;

let mut stmt = db.prepare("INSERT INTO foo(x) VALUES (?)")?;
stmt.execute(&[&"a"])?;
stmt.execute(&[&"b"])?;
stmt.execute(&[&"c"])?;
stmt.execute([&"a"])?;
stmt.execute([&"b"])?;
stmt.execute([&"c"])?;
stmt.execute([Value::Null])?;

let val: Result<Vec<Option<String>>> = db
Expand Down Expand Up @@ -178,9 +178,9 @@ mod test {
db.execute_batch("CREATE TABLE foo(x Text)")?;

let mut stmt = db.prepare("INSERT INTO foo(x) VALUES (?)")?;
stmt.execute(&[&"a"])?;
stmt.execute(&[&"b"])?;
stmt.execute(&[&"c"])?;
stmt.execute([&"a"])?;
stmt.execute([&"b"])?;
stmt.execute([&"c"])?;
stmt.execute([Value::Null])?;

let val: Result<Vec<Option<String>>> = db
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ mod test {
}

let path_string = path.to_str().unwrap();
let db = Connection::open(&path_string)?;
let db = Connection::open(path_string)?;
let the_answer: Result<i64> = db.query_row("SELECT x FROM foo", [], |r| r.get(0));

assert_eq!(42i64, the_answer?);
Expand Down
6 changes: 3 additions & 3 deletions src/r2d2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ mod test {
conn.execute_batch("CREATE TABLE foo(x Text)")?;

let mut stmt = conn.prepare("INSERT INTO foo(x) VALUES (?)")?;
stmt.execute(&[&"a"])?;
stmt.execute(&[&"b"])?;
stmt.execute(&[&"c"])?;
stmt.execute([&"a"])?;
stmt.execute([&"b"])?;
stmt.execute([&"c"])?;
stmt.execute([Value::Null])?;

let val: Result<Vec<Option<String>>> = conn
Expand Down
2 changes: 1 addition & 1 deletion src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ impl RowIndex for usize {
impl RowIndex for &'_ str {
#[inline]
fn idx(&self, stmt: &Statement<'_>) -> Result<usize> {
stmt.column_index(*self)
stmt.column_index(self)
}
}

Expand Down
30 changes: 14 additions & 16 deletions src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,17 @@ mod test {
let db = Connection::open_in_memory()?;
db.execute_batch("CREATE TABLE foo(x INTEGER)")?;

assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", &[&2i32])?, 1);
assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", &[&3i32])?, 1);
assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", [&2i32])?, 1);
assert_eq!(db.execute("INSERT INTO foo(x) VALUES (?)", [&3i32])?, 1);

// TODO(wangfenjin): No column type for SUM(x)?
assert_eq!(
5i32,
db.query_row::<i32, _, _>("SELECT SUM(x) FROM foo WHERE x > ?", &[&0i32], |r| r.get(0))?
db.query_row::<i32, _, _>("SELECT SUM(x) FROM foo WHERE x > ?", [&0i32], |r| r.get(0))?
);
assert_eq!(
3i32,
db.query_row::<i32, _, _>("SELECT SUM(x) FROM foo WHERE x > ?", &[&2i32], |r| r.get(0))?
db.query_row::<i32, _, _>("SELECT SUM(x) FROM foo WHERE x > ?", [&2i32], |r| r.get(0))?
);
Ok(())
}
Expand All @@ -518,10 +518,10 @@ mod test {
db.execute_batch(sql)?;

let mut stmt = db.prepare("INSERT INTO test (name) VALUES (?)")?;
stmt.execute(&[&"one"])?;
stmt.execute([&"one"])?;

let mut stmt = db.prepare("SELECT COUNT(*) FROM test WHERE name = ?")?;
assert_eq!(1i32, stmt.query_row::<i32, _, _>(&[&"one"], |r| r.get(0))?);
assert_eq!(1i32, stmt.query_row::<i32, _, _>([&"one"], |r| r.get(0))?);
Ok(())
}

Expand All @@ -536,7 +536,7 @@ mod test {

let mut stmt = db.prepare("SELECT id FROM test where name = ?")?;
{
let mut rows = stmt.query(&[&"one"])?;
let mut rows = stmt.query([&"one"])?;
let id: Result<i32> = rows.next()?.unwrap().get(0);
assert_eq!(Ok(1), id);
}
Expand All @@ -554,7 +554,7 @@ mod test {
db.execute_batch(sql)?;

let mut stmt = db.prepare("SELECT id FROM test where name = ? ORDER BY id ASC")?;
let mut rows = stmt.query_and_then(&[&"one"], |row| {
let mut rows = stmt.query_and_then([&"one"], |row| {
let id: i32 = row.get(0)?;
if id == 1 {
Ok(id)
Expand Down Expand Up @@ -584,7 +584,7 @@ mod test {
db.execute_batch(sql)?;

let mut stmt = db.prepare("INSERT INTO test (x, y) VALUES (?, ?)")?;
assert!(stmt.execute(&[&"one"]).is_err());
assert!(stmt.execute([&"one"]).is_err());
Ok(())
}

Expand All @@ -595,7 +595,7 @@ mod test {
db.execute_batch(sql)?;

let mut stmt = db.prepare("INSERT INTO test (x) VALUES (?)")?;
stmt.execute(&[&"one"])?;
stmt.execute([&"one"])?;

let result: Option<String> = db.query_row("SELECT y FROM test WHERE x = 'one'", [], |row| row.get(0))?;
assert!(result.is_none());
Expand Down Expand Up @@ -731,11 +731,9 @@ mod test {
fn test_bind_parameters() -> Result<()> {
let db = Connection::open_in_memory()?;
// dynamic slice:
db.query_row(
"SELECT ?1, ?2, ?3",
&[&1u8 as &dyn ToSql, &"one", &Some("one")],
|row| row.get::<_, u8>(0),
)?;
db.query_row("SELECT ?1, ?2, ?3", [&1u8 as &dyn ToSql, &"one", &Some("one")], |row| {
row.get::<_, u8>(0)
})?;
// existing collection:
let data = vec![1, 2, 3];
db.query_row("SELECT ?1, ?2, ?3", params_from_iter(&data), |row| row.get::<_, u8>(0))?;
Expand Down Expand Up @@ -792,7 +790,7 @@ mod test {
assert_eq!("UTF-16le", encoding);
db.execute_batch("CREATE TABLE foo(x TEXT)")?;
let expected = "テスト";
db.execute("INSERT INTO foo(x) VALUES (?)", &[&expected])?;
db.execute("INSERT INTO foo(x) VALUES (?)", [&expected])?;
let actual: String = db.query_row("SELECT x FROM foo", [], |row| row.get(0))?;
assert_eq!(expected, actual);
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/types/from_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ mod test {
T: Into<i128> + FromSql + ::std::fmt::Debug,
{
for n in out_of_range {
let err = db.query_row("SELECT ?", &[n], |r| r.get::<_, T>(0)).unwrap_err();
let err = db.query_row("SELECT ?", [n], |r| r.get::<_, T>(0)).unwrap_err();
match err {
Error::IntegralValueOutOfRange(_, value) => assert_eq!(*n, value),
_ => panic!("unexpected error: {}", err),
}
}
for n in in_range {
assert_eq!(*n, db.query_row("SELECT ?", &[n], |r| r.get::<_, T>(0)).unwrap().into());
assert_eq!(*n, db.query_row("SELECT ?", [n], |r| r.get::<_, T>(0)).unwrap().into());
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod test {
let db = checked_memory_handle()?;

let v1234 = vec![1u8, 2, 3, 4];
db.execute("INSERT INTO foo(b) VALUES (?)", &[&v1234])?;
db.execute("INSERT INTO foo(b) VALUES (?)", [&v1234])?;

let v: Vec<u8> = db.query_row("SELECT b FROM foo", [], |r| r.get(0))?;
assert_eq!(v, v1234);
Expand All @@ -203,7 +203,7 @@ mod test {
let db = checked_memory_handle()?;

let empty = vec![];
db.execute("INSERT INTO foo(b) VALUES (?)", &[&empty])?;
db.execute("INSERT INTO foo(b) VALUES (?)", [&empty])?;

let v: Vec<u8> = db.query_row("SELECT b FROM foo", [], |r| r.get(0))?;
assert_eq!(v, empty);
Expand All @@ -215,7 +215,7 @@ mod test {
let db = checked_memory_handle()?;

let s = "hello, world!";
db.execute("INSERT INTO foo(t) VALUES (?)", &[&s])?;
db.execute("INSERT INTO foo(t) VALUES (?)", [&s])?;

let from: String = db.query_row("SELECT t FROM foo", [], |r| r.get(0))?;
assert_eq!(from, s);
Expand Down Expand Up @@ -254,8 +254,8 @@ mod test {
let s = Some("hello, world!");
let b = Some(vec![1u8, 2, 3, 4]);

db.execute("INSERT INTO foo(t) VALUES (?)", &[&s])?;
db.execute("INSERT INTO foo(b) VALUES (?)", &[&b])?;
db.execute("INSERT INTO foo(t) VALUES (?)", [&s])?;
db.execute("INSERT INTO foo(b) VALUES (?)", [&b])?;

let mut stmt = db.prepare("SELECT t, b FROM foo ORDER BY ROWID ASC")?;
let mut rows = stmt.query([])?;
Expand Down
2 changes: 1 addition & 1 deletion src/types/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mod test {
let data: serde_json::Value = serde_json::from_str(json).unwrap();
db.execute(
"INSERT INTO foo (t, b) VALUES (?, ?)",
&[&data as &dyn ToSql, &json.as_bytes()],
[&data as &dyn ToSql, &json.as_bytes()],
)?;

let t: serde_json::Value = db.query_row("SELECT t FROM foo", [], |r| r.get(0))?;
Expand Down

0 comments on commit 1a7968d

Please sign in to comment.