chore(deps): Bump chrono from 0.4.28 to 0.4.29 (#8677)

* chore(deps): Bump chrono from 0.4.28 to 0.4.29

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.28 to 0.4.29.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.28...v0.4.29)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* fix: deprecations

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marco Neumann <marco@crepererum.net>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
dependabot[bot] 2023-09-06 09:20:58 +00:00 committed by GitHub
parent 720bdc22c8
commit 4f6864c0b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 18 deletions

4
Cargo.lock generated
View File

@ -806,9 +806,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.28"
version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f"
checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02"
dependencies = [
"android-tzdata",
"iana-time-zone",

View File

@ -227,7 +227,6 @@ async fn check_ids_exists_in_catalog(
mod tests {
use super::*;
use async_trait::async_trait;
use chrono::TimeZone;
use data_types::{
ColumnId, ColumnSet, CompactionLevel, NamespaceId, ParquetFile, ParquetFileId,
ParquetFileParams, PartitionId, TableId, Timestamp, TransitionPartitionId,
@ -243,10 +242,18 @@ mod tests {
use std::{assert_eq, vec};
use uuid::Uuid;
static OLDER_TIME: Lazy<DateTime<Utc>> =
Lazy::new(|| Utc.datetime_from_str("2022-01-01T00:00:00z", "%+").unwrap());
static NEWER_TIME: Lazy<DateTime<Utc>> =
Lazy::new(|| Utc.datetime_from_str("2022-02-02T00:00:00z", "%+").unwrap());
static OLDER_TIME: Lazy<DateTime<Utc>> = Lazy::new(|| {
DateTime::parse_from_str("2022-01-01T00:00:00z", "%+")
.unwrap()
.naive_utc()
.and_utc()
});
static NEWER_TIME: Lazy<DateTime<Utc>> = Lazy::new(|| {
DateTime::parse_from_str("2022-02-02T00:00:00z", "%+")
.unwrap()
.naive_utc()
.and_utc()
});
async fn create_catalog_and_file() -> (Arc<dyn Catalog>, ParquetFile) {
let metric_registry = Arc::new(metric::Registry::new());

View File

@ -30,31 +30,36 @@ fn parse_timestamp_utc(s: &str) -> Option<Timestamp> {
fn parse_timestamp_tz(s: &str, tz: chrono_tz::Tz) -> Option<Timestamp> {
// 1a. Try a date time format string with nanosecond precision
// https://github.com/influxdata/influxql/blob/1ba470371ec093d57a726b143fe6ccbacf1b452b/ast.go#L3661
tz.datetime_from_str(s, "%Y-%m-%d %H:%M:%S%.f")
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.f")
.ok()
.and_then(|ts| tz.from_local_datetime(&ts).earliest())
// 1a. Try a date time format string without nanosecond precision
.or_else(|_| tz.datetime_from_str(s, "%Y-%m-%d %H:%M:%S"))
.or_else(|| {
NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S")
.ok()
.and_then(|ts| tz.from_local_datetime(&ts).earliest())
})
// 2. Try RFC3339 with nano precision
// https://github.com/influxdata/influxql/blob/1ba470371ec093d57a726b143fe6ccbacf1b452b/ast.go#L3664
.or_else(|_| {
DateTime::parse_from_str(s, "%+").map(|ts| tz.from_utc_datetime(&ts.naive_utc()))
.or_else(|| {
DateTime::parse_from_str(s, "%+")
.map(|ts| tz.from_utc_datetime(&ts.naive_utc()))
.ok()
})
// 3. Try a date string
// https://github.com/influxdata/influxql/blob/1ba470371ec093d57a726b143fe6ccbacf1b452b/ast.go#L3671
.or_else(|_| {
.or_else(|| {
// Parse as a naive date, add a midnight time and then interpret the result in
// timezone "tz"
NaiveDate::parse_from_str(s, "%Y-%m-%d")
.map(|nd| nd.and_time(NaiveTime::default()).and_local_timezone(tz))
.map_err(|_| ())?
.ok()?
// When converted to the target timezone, tz, it is possible the
// date is ambiguous due to time shifts. In this case, rather than
// fail, choose the earliest valid date.
.earliest()
// if there is no valid date, return an error
.ok_or(())
})
.map(|ts| ts.with_timezone(&ts.offset().fix()))
.ok()
}
/// Parse the string and return a `DateTime` using a fixed offset.

View File

@ -7,7 +7,7 @@ edition.workspace = true
license.workspace = true
[dependencies]
chrono = { version = "0.4.28", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.29", default-features = false, features = ["clock", "std"] }
parking_lot = "0.12"
tokio = { version = "1.32", features = ["macros", "parking_lot", "rt-multi-thread", "sync", "time"] }
workspace-hack = { version = "0.1", path = "../workspace-hack" }

View File

@ -48,7 +48,7 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }
[dev-dependencies]
assert_matches = "1.5"
base64 = "0.21.3"
chrono = { version = "0.4.28", default-features = false }
chrono = { version = "0.4.29", default-features = false }
criterion = { version = "0.5", default-features = false, features = [
"async_tokio",
"rayon",