Skip to content

Commit 54a80a0

Browse files
authored
Upgrade dependencies (#232)
1 parent e8714ea commit 54a80a0

File tree

9 files changed

+86
-78
lines changed

9 files changed

+86
-78
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- run: cargo update -p native-tls --precise 0.2.13 # 0.2.14 requires rustc 1.80
4040
- run: cargo update -p litemap --precise 0.7.4 # 0.7.5 requires rustc 1.81
4141
- run: cargo update -p zerofrom --precise 0.1.5 # 0.1.6 requires rustc 1.81
42+
- run: cargo update -p url --precise 2.5.0 # 2.5.4 requires rustc 1.82
4243
- run: cargo build
4344
- run: cargo build --no-default-features
4445
- run: cargo build --features uuid,time,chrono

Cargo.toml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,46 +99,46 @@ rustls-tls-native-roots = [
9999
[dependencies]
100100
clickhouse-derive = { version = "0.2.0", path = "derive" }
101101

102-
thiserror = "1.0.16"
103-
serde = "1.0.106"
104-
bytes = "1.5.0"
105-
tokio = { version = "1.0.1", features = ["rt", "macros"] }
106-
http-body-util = "0.1.2"
107-
hyper = "1.4"
108-
hyper-util = { version = "0.1.6", features = ["client-legacy", "http1"] }
109-
hyper-tls = { version = "0.6.0", optional = true }
102+
thiserror = "2"
103+
serde = "1"
104+
bytes = "1"
105+
tokio = { version = "1", features = ["rt", "macros"] }
106+
http-body-util = "0.1"
107+
hyper = "1"
108+
hyper-util = { version = "0.1", features = ["client-legacy", "http1"] }
109+
hyper-tls = { version = "0.6", optional = true }
110110
rustls = { version = "0.23", default-features = false, optional = true }
111-
hyper-rustls = { version = "0.27.3", default-features = false, features = [
111+
hyper-rustls = { version = "0.27", default-features = false, features = [
112112
"http1",
113113
"tls12",
114114
], optional = true }
115-
url = "2.1.1"
116-
futures = "0.3.5"
117-
futures-channel = "0.3.30"
118-
static_assertions = "1.1"
115+
url = "2"
116+
futures = "0.3"
117+
futures-channel = "0.3"
118+
static_assertions = "1"
119119
sealed = "0.6"
120120
sha-1 = { version = "0.10", optional = true }
121-
serde_json = { version = "1.0.68", optional = true }
122-
lz4_flex = { version = "0.11.3", default-features = false, features = [
121+
serde_json = { version = "1", optional = true }
122+
lz4_flex = { version = "0.11", default-features = false, features = [
123123
"std",
124124
], optional = true }
125-
cityhash-rs = { version = "=1.0.1", optional = true } # exact version for safety
125+
cityhash-rs = { version = ">=1.0.1", optional = true } # 1.0.1+ is Apache/MIT, earlier was GPL-3
126126
uuid = { version = "1", optional = true }
127127
time = { version = "0.3", optional = true }
128128
chrono = { version = "0.4", optional = true, features = ["serde"] }
129-
bstr = { version = "1.11.0", default-features = false }
129+
bstr = { version = "1", default-features = false }
130130
quanta = { version = "0.12", optional = true }
131-
replace_with = { version = "0.1.7" }
131+
replace_with = { version = "0.1" }
132132

133133
[dev-dependencies]
134-
criterion = "0.5.0"
135-
serde = { version = "1.0.106", features = ["derive"] }
136-
tokio = { version = "1.0.1", features = ["full", "test-util"] }
137-
hyper = { version = "1.1", features = ["server"] }
138-
serde_bytes = "0.11.4"
134+
criterion = "0.6"
135+
serde = { version = "1", features = ["derive"] }
136+
tokio = { version = "1", features = ["full", "test-util"] }
137+
hyper = { version = "1", features = ["server"] }
138+
serde_bytes = "0.11"
139139
serde_json = "1"
140-
serde_repr = "0.1.7"
140+
serde_repr = "0.1"
141141
uuid = { version = "1", features = ["v4", "serde"] }
142-
time = { version = "0.3.17", features = ["macros", "rand"] }
143-
fixnum = { version = "0.9.2", features = ["serde", "i32", "i64", "i128"] }
144-
rand = { version = "0.8.5", features = ["small_rng"] }
142+
time = { version = "0.3", features = ["macros", "rand"] }
143+
fixnum = { version = "0.9", features = ["serde", "i32", "i64", "i128"] }
144+
rand = { version = "0.9", features = ["small_rng"] }

benches/insert.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ use std::{
55
};
66

77
use bytes::Bytes;
8-
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
8+
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
99
use http_body_util::Empty;
1010
use hyper::{body::Incoming, Request, Response};
1111
use serde::Serialize;
12+
use std::hint::black_box;
1213

1314
use clickhouse::{error::Result, Client, Compression, Row};
1415

benches/select.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ use std::{
55
};
66

77
use bytes::Bytes;
8-
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
8+
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
99
use futures::stream::{self, StreamExt as _};
1010
use http_body_util::StreamBody;
1111
use hyper::{
1212
body::{Body, Frame, Incoming},
1313
Request, Response,
1414
};
1515
use serde::Deserialize;
16+
use std::hint::black_box;
1617

1718
use clickhouse::{
1819
error::{Error, Result},
@@ -32,12 +33,15 @@ async fn serve(
3233
}
3334

3435
fn prepare_chunk() -> Bytes {
35-
use rand::{distributions::Standard, rngs::SmallRng, Rng, SeedableRng};
36+
use rand::{distr::StandardUniform, rngs::SmallRng, Rng, SeedableRng};
3637

3738
// Generate random data to avoid _real_ compression.
3839
// TODO: It would be more useful to generate real data.
3940
let mut rng = SmallRng::seed_from_u64(0xBA5E_FEED);
40-
let raw: Vec<_> = (&mut rng).sample_iter(Standard).take(128 * 1024).collect();
41+
let raw: Vec<_> = (&mut rng)
42+
.sample_iter(StandardUniform)
43+
.take(128 * 1024)
44+
.collect();
4145

4246
// If the feature is enabled, compress the data even if we use the `None`
4347
// compression. The compression ratio is low anyway due to random data.

derive/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rust-version = "1.73.0"
1414
proc-macro = true
1515

1616
[dependencies]
17-
proc-macro2 = "1.0"
18-
syn = "2.0"
19-
quote = "1.0"
20-
serde_derive_internals = "0.29.1"
17+
proc-macro2 = "1"
18+
syn = "2"
19+
quote = "1"
20+
serde_derive_internals = "0.29"

examples/data_types_derive_containers.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rand::distributions::Alphanumeric;
1+
use rand::distr::Alphanumeric;
22
use rand::Rng;
33

44
use clickhouse::sql::Identifier;
@@ -83,7 +83,7 @@ pub struct Row {
8383

8484
impl Row {
8585
pub fn new() -> Self {
86-
let mut rng = rand::thread_rng();
86+
let mut rng = rand::rng();
8787
Row {
8888
arr: vec![random_str()],
8989
arr2: vec![vec![random_str()]],
@@ -92,7 +92,7 @@ impl Row {
9292
// Nested
9393
// NB: the length of all vectors/slices representing Nested columns must be the same
9494
nested_name: vec![random_str(), random_str()],
95-
nested_count: vec![rng.gen(), rng.gen()],
95+
nested_count: vec![rng.random(), rng.random()],
9696
// Geo
9797
point: random_point(),
9898
ring: random_ring(),
@@ -111,16 +111,16 @@ impl Default for Row {
111111
}
112112

113113
fn random_str() -> String {
114-
rand::thread_rng()
114+
rand::rng()
115115
.sample_iter(&Alphanumeric)
116116
.take(3)
117117
.map(char::from)
118118
.collect()
119119
}
120120

121121
fn random_point() -> Point {
122-
let mut rng = rand::thread_rng();
123-
(rng.gen(), rng.gen())
122+
let mut rng = rand::rng();
123+
(rng.random(), rng.random())
124124
}
125125

126126
fn random_ring() -> Ring {

examples/data_types_derive_simple.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use std::str::FromStr;
2-
31
use chrono::{DateTime, NaiveDate, Utc};
42
use fixnum::{
53
typenum::{U12, U4, U8},
64
FixedPoint,
75
};
8-
use rand::{distributions::Alphanumeric, seq::SliceRandom, Rng};
6+
use rand::prelude::IndexedRandom;
7+
use rand::{distr::Alphanumeric, Rng};
8+
use std::str::FromStr;
99
use time::{Date, Month, OffsetDateTime, Time};
1010

1111
use clickhouse::{error::Result, sql::Identifier, Client};
@@ -182,27 +182,27 @@ pub enum Enum16 {
182182

183183
impl Row {
184184
pub fn new() -> Self {
185-
let mut rng = rand::thread_rng();
185+
let mut rng = rand::rng();
186186
Row {
187-
int8: rng.gen(),
188-
int16: rng.gen(),
189-
int32: rng.gen(),
190-
int64: rng.gen(),
191-
int128: rng.gen(),
192-
uint8: rng.gen(),
193-
uint16: rng.gen(),
194-
uint32: rng.gen(),
195-
uint64: rng.gen(),
196-
uint128: rng.gen(),
197-
float32: rng.gen(),
198-
float64: rng.gen(),
199-
boolean: rng.gen(),
187+
int8: rng.random(),
188+
int16: rng.random(),
189+
int32: rng.random(),
190+
int64: rng.random(),
191+
int128: rng.random(),
192+
uint8: rng.random(),
193+
uint16: rng.random(),
194+
uint32: rng.random(),
195+
uint64: rng.random(),
196+
uint128: rng.random(),
197+
float32: rng.random(),
198+
float64: rng.random(),
199+
boolean: rng.random(),
200200
str: random_str(),
201-
blob_str: rng.gen::<[u8; 3]>().to_vec(),
201+
blob_str: rng.random::<[u8; 3]>().to_vec(),
202202
nullable_str: Some(random_str()),
203203
low_car_str: random_str(),
204204
nullable_low_car_str: Some(random_str()),
205-
fixed_str: rng.gen(),
205+
fixed_str: rng.random(),
206206
uuid: uuid::Uuid::new_v4(),
207207
ipv4: std::net::Ipv4Addr::from_str("172.195.0.1").unwrap(),
208208
ipv6: std::net::Ipv6Addr::from_str("::ffff:acc3:1").unwrap(),
@@ -255,7 +255,7 @@ impl Default for Row {
255255
}
256256

257257
fn random_str() -> String {
258-
rand::thread_rng()
258+
rand::rng()
259259
.sample_iter(&Alphanumeric)
260260
.take(3)
261261
.map(char::from)

tests/it/chrono.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::ops::RangeBounds;
44

55
use chrono::{DateTime, Datelike, NaiveDate, Utc};
66
use rand::{
7-
distributions::{Distribution, Standard},
7+
distr::{Distribution, StandardUniform},
88
Rng,
99
};
1010
use serde::{Deserialize, Serialize};
@@ -230,23 +230,21 @@ async fn date32() {
230230
// Distribution isn't implemented for `chrono` types, but we can lift the implementation from the `time` crate: https://docs.rs/time/latest/src/time/rand.rs.html#14-20
231231
struct NaiveDateWrapper(NaiveDate);
232232

233-
impl Distribution<NaiveDateWrapper> for Standard {
233+
impl Distribution<NaiveDateWrapper> for StandardUniform {
234234
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> NaiveDateWrapper {
235235
NaiveDateWrapper(
236-
NaiveDate::from_num_days_from_ce_opt(
237-
rng.gen_range(
238-
NaiveDate::MIN.num_days_from_ce()..=NaiveDate::MAX.num_days_from_ce(),
239-
),
240-
)
236+
NaiveDate::from_num_days_from_ce_opt(rng.random_range(
237+
NaiveDate::MIN.num_days_from_ce()..=NaiveDate::MAX.num_days_from_ce(),
238+
))
241239
.unwrap(),
242240
)
243241
}
244242
}
245243

246244
fn generate_dates(years: impl RangeBounds<i32>, count: usize) -> Vec<NaiveDate> {
247-
let mut rng = rand::thread_rng();
245+
let mut rng = rand::rng();
248246
let mut dates: Vec<_> = (&mut rng)
249-
.sample_iter(Standard)
247+
.sample_iter(StandardUniform)
250248
.filter_map(|date: NaiveDateWrapper| {
251249
if years.contains(&date.0.year()) {
252250
Some(date.0)

tests/it/time.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![cfg(feature = "time")]
22

3-
use std::ops::RangeBounds;
3+
use std::ops::Range;
44

5-
use rand::{distributions::Standard, Rng};
5+
use rand::Rng;
66
use serde::{Deserialize, Serialize};
77
use time::{macros::datetime, Date, OffsetDateTime};
88

@@ -219,12 +219,16 @@ async fn date32() {
219219
}
220220
}
221221

222-
fn generate_dates(years: impl RangeBounds<i32>, count: usize) -> Vec<Date> {
223-
let mut rng = rand::thread_rng();
224-
let mut dates: Vec<_> = (&mut rng)
225-
.sample_iter(Standard)
226-
.filter(|date: &Date| years.contains(&date.year()))
227-
.take(count)
222+
fn generate_dates(years: Range<i32>, count: usize) -> Vec<Date> {
223+
let mut rng = rand::rng();
224+
let mut dates: Vec<_> = (0..count)
225+
.map(|_| {
226+
let year = rng.random_range(years.clone());
227+
let month = rng.random_range(1..=12);
228+
let day = rng.random_range(1..=28); // Safe for all months
229+
Date::from_calendar_date(year, time::Month::try_from(month).unwrap(), day as u8)
230+
.unwrap()
231+
})
228232
.collect();
229233

230234
dates.sort_unstable();

0 commit comments

Comments
 (0)