Skip to content

Commit 4c4696f

Browse files
committed
Bump versions
Signed-off-by: Xuanwo <[email protected]>
1 parent 823c45a commit 4c4696f

File tree

26 files changed

+813
-714
lines changed

26 files changed

+813
-714
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ serde = { version = "1.0.145", features = ["derive", "rc"] }
122122
serde_json = { version = "1.0.85", default-features = false, features = ["preserve_order"] }
123123

124124
# chrono
125-
chrono = { version = "0.4.22", features = ["serde"] }
125+
chrono = { version = "0.4.24", features = ["serde"] }
126126
chrono-tz = "0.6.3"
127127

128128
# memory

src/common/io/src/cursor_ext/cursor_read_datetime_ext.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,19 @@ where T: AsRef<[u8]>
9797
.map_err_to_code(ErrorCode::BadBytes, || {
9898
format!("Cannot parse value:{} to Date type", v)
9999
})?;
100-
let mut dt = tz.from_local_datetime(&d.and_hms(0, 0, 0)).unwrap();
100+
let mut dt = tz
101+
.from_local_datetime(&d.and_hms_opt(0, 0, 0).unwrap())
102+
.unwrap();
101103

102104
let less_1000 = |dt: DateTime<Tz>| {
103105
// convert timestamp less than `1000-01-01 00:00:00` to `1000-01-01 00:00:00`
104106
if dt.year() < 1000 {
105-
Ok(tz.from_utc_datetime(&NaiveDate::from_ymd(1000, 1, 1).and_hms(0, 0, 0)))
107+
Ok(tz.from_utc_datetime(
108+
&NaiveDate::from_ymd_opt(1000, 1, 1)
109+
.unwrap()
110+
.and_hms_opt(0, 0, 0)
111+
.unwrap(),
112+
))
106113
} else {
107114
Ok(dt)
108115
}
@@ -133,13 +140,13 @@ where T: AsRef<[u8]>
133140
if times.len() < 3 {
134141
times.resize(3, 0);
135142
dt = tz
136-
.from_local_datetime(&d.and_hms(times[0], times[1], times[2]))
143+
.from_local_datetime(&d.and_hms_opt(times[0], times[1], times[2]).unwrap())
137144
.unwrap();
138145
return less_1000(dt);
139146
}
140147

141148
dt = tz
142-
.from_local_datetime(&d.and_hms(times[0], times[1], times[2]))
149+
.from_local_datetime(&d.and_hms_opt(times[0], times[1], times[2]).unwrap())
143150
.unwrap();
144151

145152
// ms .microseconds
@@ -187,7 +194,12 @@ where T: AsRef<[u8]>
187194
if self.ignore(|b| b == b'z' || b == b'Z') {
188195
// ISO 8601 The Z on the end means UTC (that is, an offset-from-UTC of zero hours-minutes-seconds).
189196
if dt.year() < 1000 {
190-
Ok(tz.from_utc_datetime(&NaiveDate::from_ymd(1000, 1, 1).and_hms(0, 0, 0)))
197+
Ok(tz.from_utc_datetime(
198+
&NaiveDate::from_ymd_opt(1000, 1, 1)
199+
.unwrap()
200+
.and_hms_opt(0, 0, 0)
201+
.unwrap(),
202+
))
191203
} else {
192204
let current_tz = dt.offset().fix().local_minus_utc();
193205
calc_offset(current_tz.into(), 0, &dt)
@@ -239,11 +251,18 @@ where T: AsRef<[u8]>
239251
|| ((0..60).contains(&minute_offset) && hour_offset < 14)
240252
{
241253
if dt.year() < 1970 {
242-
Ok(tz.from_utc_datetime(&NaiveDate::from_ymd(1970, 1, 1).and_hms(0, 0, 0)))
254+
Ok(tz.from_utc_datetime(
255+
&NaiveDate::from_ymd_opt(1970, 1, 1)
256+
.unwrap()
257+
.and_hms_opt(0, 0, 0)
258+
.unwrap(),
259+
))
243260
} else {
244261
let current_tz_sec = dt.offset().fix().local_minus_utc();
245-
let mut val_tz_sec = FixedOffset::east(hour_offset * 3600 + minute_offset * 60)
246-
.local_minus_utc();
262+
let mut val_tz_sec =
263+
FixedOffset::east_opt(hour_offset * 3600 + minute_offset * 60)
264+
.unwrap()
265+
.local_minus_utc();
247266
if west_tz {
248267
val_tz_sec = -val_tz_sec;
249268
}

src/common/storage/src/stage.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ impl StageFileInfo {
7272
md5: meta.content_md5().map(str::to_string),
7373
last_modified: meta
7474
.last_modified()
75-
.map_or(Utc::now(), |t| Utc.timestamp(t.unix_timestamp(), 0)),
75+
.map(|v| Utc.timestamp_nanos(v.unix_timestamp_nanos() as i64))
76+
.unwrap_or_default(),
7677
etag: meta.etag().map(str::to_string),
7778
status: StageFileStatus::NeedCopy,
7879
creator: None,

src/meta/proto-conv/tests/it/proto_conv.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn new_db_meta_share() -> mt::DatabaseMeta {
4242
engine: "44".to_string(),
4343
engine_options: btreemap! {s("abc") => s("def")},
4444
options: btreemap! {s("xyz") => s("foo")},
45-
created_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
46-
updated_on: Utc.ymd(2014, 11, 29).and_hms(12, 0, 9),
45+
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
46+
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap(),
4747
comment: "foo bar".to_string(),
4848
drop_on: None,
4949
shared_by: BTreeSet::new(),
@@ -59,8 +59,8 @@ fn new_db_meta() -> mt::DatabaseMeta {
5959
engine: "44".to_string(),
6060
engine_options: btreemap! {s("abc") => s("def")},
6161
options: btreemap! {s("xyz") => s("foo")},
62-
created_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
63-
updated_on: Utc.ymd(2014, 11, 29).and_hms(12, 0, 9),
62+
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
63+
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap(),
6464
comment: "foo bar".to_string(),
6565
drop_on: None,
6666
shared_by: BTreeSet::from_iter(vec![1].into_iter()),
@@ -69,7 +69,7 @@ fn new_db_meta() -> mt::DatabaseMeta {
6969
}
7070

7171
fn new_share_meta_share_from_db_ids() -> share::ShareMeta {
72-
let now = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
72+
let now = Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap();
7373

7474
let db_entry = share::ShareGrantEntry::new(
7575
share::ShareGrantObject::Database(1),
@@ -91,13 +91,13 @@ fn new_share_meta_share_from_db_ids() -> share::ShareMeta {
9191
accounts: BTreeSet::from_iter(vec![s("a"), s("b")].into_iter()),
9292
share_from_db_ids: BTreeSet::from_iter(vec![1, 2].into_iter()),
9393
comment: Some(s("comment")),
94-
share_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
95-
update_on: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
94+
share_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
95+
update_on: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
9696
}
9797
}
9898

9999
fn new_share_meta() -> share::ShareMeta {
100-
let now = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
100+
let now = Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap();
101101

102102
let db_entry = share::ShareGrantEntry::new(
103103
share::ShareGrantObject::Database(1),
@@ -119,17 +119,17 @@ fn new_share_meta() -> share::ShareMeta {
119119
accounts: BTreeSet::from_iter(vec![s("a"), s("b")].into_iter()),
120120
share_from_db_ids: BTreeSet::new(),
121121
comment: Some(s("comment")),
122-
share_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
123-
update_on: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
122+
share_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
123+
update_on: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
124124
}
125125
}
126126

127127
fn new_share_account_meta() -> share::ShareAccountMeta {
128128
share::ShareAccountMeta {
129129
account: s("account"),
130130
share_id: 4,
131-
share_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
132-
accept_on: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
131+
share_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
132+
accept_on: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
133133
}
134134
}
135135

@@ -189,8 +189,8 @@ fn new_table_meta() -> mt::TableMeta {
189189
default_cluster_key: Some("(a + 2, b)".to_string()),
190190
cluster_keys: vec!["(a + 2, b)".to_string()],
191191
default_cluster_key_id: Some(0),
192-
created_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
193-
updated_on: Utc.ymd(2014, 11, 29).and_hms(12, 0, 10),
192+
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
193+
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
194194
comment: s("table_comment"),
195195
field_comments: vec!["c".to_string(); 21],
196196
drop_on: None,
@@ -234,7 +234,7 @@ pub(crate) fn new_table_copied_file_info_v6() -> mt::TableCopiedFileInfo {
234234
mt::TableCopiedFileInfo {
235235
etag: Some("etag".to_string()),
236236
content_length: 1024,
237-
last_modified: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
237+
last_modified: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
238238
}
239239
}
240240

src/meta/proto-conv/tests/it/user_proto_conv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ pub(crate) fn test_webhdfs_stage_info() -> mt::principal::StageInfo {
348348

349349
pub(crate) fn test_stage_file() -> mt::principal::StageFile {
350350
let dt = NaiveDateTime::new(
351-
NaiveDate::from_ymd(2022, 9, 16),
352-
NaiveTime::from_hms(0, 1, 2),
351+
NaiveDate::from_ymd_opt(2022, 9, 16).unwrap(),
352+
NaiveTime::from_hms_opt(0, 1, 2).unwrap(),
353353
);
354354
let user_id = mt::principal::UserIdentity::new("datafuselabs", "datafuselabs.rs");
355355
mt::principal::StageFile {
@@ -718,8 +718,8 @@ fn test_old_stage_file() -> anyhow::Result<()> {
718718
let got = mt::principal::StageFile::from_pb(p).map_err(print_err)?;
719719

720720
let dt = NaiveDateTime::new(
721-
NaiveDate::from_ymd(2022, 9, 16),
722-
NaiveTime::from_hms(0, 1, 2),
721+
NaiveDate::from_ymd_opt(2022, 9, 16).unwrap(),
722+
NaiveTime::from_hms_opt(0, 1, 2).unwrap(),
723723
);
724724
let user_id = mt::principal::UserIdentity::new("datafuselabs", "datafuselabs.rs");
725725
let want = mt::principal::StageFile {

src/meta/proto-conv/tests/it/v002_database_meta.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn test_decode_v2_database_meta() -> anyhow::Result<()> {
4545
engine: "44".to_string(),
4646
engine_options: btreemap! {s("abc") => s("def")},
4747
options: btreemap! {s("xyz") => s("foo")},
48-
created_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
49-
updated_on: Utc.ymd(2014, 11, 29).and_hms(12, 0, 9),
48+
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
49+
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap(),
5050
comment: "foo bar".to_string(),
5151
drop_on: None,
5252
shared_by: BTreeSet::from_iter(vec![1].into_iter()),

src/meta/proto-conv/tests/it/v002_share_account_meta.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ fn test_decode_v2_share_account_meta() -> anyhow::Result<()> {
3939
let want = || share::ShareAccountMeta {
4040
account: "account".into(),
4141
share_id: 4,
42-
share_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
43-
accept_on: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
42+
share_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
43+
accept_on: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
4444
};
4545

4646
common::test_pb_from_to(func_name!(), want())?;

src/meta/proto-conv/tests/it/v002_share_meta.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn test_decode_v2_share_meta() -> anyhow::Result<()> {
4444
];
4545

4646
let want = || {
47-
let now = Utc.ymd(2014, 11, 28).and_hms(12, 0, 9);
47+
let now = Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap();
4848

4949
let db_entry = share::ShareGrantEntry::new(
5050
share::ShareGrantObject::Database(1),
@@ -66,8 +66,8 @@ fn test_decode_v2_share_meta() -> anyhow::Result<()> {
6666
accounts: BTreeSet::from_iter(vec![s("a"), s("b")].into_iter()),
6767
share_from_db_ids: BTreeSet::new(),
6868
comment: Some(s("comment")),
69-
share_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
70-
update_on: Some(Utc.ymd(2014, 11, 29).and_hms(12, 0, 9)),
69+
share_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
70+
update_on: Some(Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 9).unwrap()),
7171
}
7272
};
7373

src/meta/proto-conv/tests/it/v002_table_meta.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ fn test_decode_v2_table_meta() -> anyhow::Result<()> {
133133
default_cluster_key: Some("(a + 2, b)".to_string()),
134134
cluster_keys: vec!["(a + 2, b)".to_string()],
135135
default_cluster_key_id: Some(0),
136-
created_on: Utc.ymd(2014, 11, 28).and_hms(12, 0, 9),
137-
updated_on: Utc.ymd(2014, 11, 29).and_hms(12, 0, 10),
136+
created_on: Utc.with_ymd_and_hms(2014, 11, 28, 12, 0, 9).unwrap(),
137+
updated_on: Utc.with_ymd_and_hms(2014, 11, 29, 12, 0, 10).unwrap(),
138138
comment: s("table_comment"),
139139
field_comments: vec!["c".to_string(); 21],
140140
drop_on: None,

0 commit comments

Comments
 (0)