Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use of deprecated method chrono::DateTime::<Tz>::timestamp_nanos: use timestamp_nanos_opt() instead #156

Closed
gdubya opened this issue Oct 30, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@gdubya
Copy link

gdubya commented Oct 30, 2023

Error compiling the project with rustc 1.73.0

rustc 1.73.0 (cc66ad468 2023-10-03)
cargo 1.73.0 (9c4383fb5 2023-08-26)

error: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
   --> src/coercions.rs:141:52
    |
141 |         .map(|dt: DateTime<Utc>| Value::Number((dt.timestamp_nanos() / 1000).into()))
    |                                                    ^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:7:9
    |
7   | #![deny(warnings)]
    |         ^^^^^^^^
    = note: `#[deny(deprecated)]` implied by `#[deny(warnings)]`

error: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
  --> src/dead_letters.rs:47:34
   |
47 |             timestamp: timestamp.timestamp_nanos() / 1000,
   |                                  ^^^^^^^^^^^^^^^

error: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
  --> src/dead_letters.rs:59:34
   |
59 |             timestamp: timestamp.timestamp_nanos() / 1000,
   |                                  ^^^^^^^^^^^^^^^

error: use of deprecated method `chrono::DateTime::<Tz>::timestamp_nanos`: use `timestamp_nanos_opt()` instead
  --> src/dead_letters.rs:72:34
   |
72 |             timestamp: timestamp.timestamp_nanos() / 1000,
@gdubya
Copy link
Author

gdubya commented Oct 31, 2023

Is it safe / enough to simply replace the timestamp_nanos() usages with timestamp_nanos_opt().unwrap() ?

@mightyshazam
Copy link
Collaborator

Is it safe / enough to simply replace the timestamp_nanos() usages with timestamp_nanos_opt().unwrap() ?

It should be okay, given that the previous method would panic if invalid. It doesn't change behavior.

@rtyler rtyler added enhancement New feature or request good first issue Good for newcomers labels Nov 1, 2023
@gdubya
Copy link
Author

gdubya commented Nov 8, 2023

Actually I think this error message was a result of me running cargo update at some point. I took a clean copy of the repo and ran cargo build using rustc 1.73 and it compiles fine (no "deprecated method" errors). So, the cause of the error needs a bit more investigation.

@punitchauhan771
Copy link

Hi @gdubya
I am not sure but this might be the issue since you updated your cargo, chrono version in Cargo.toml is set to "0", and it likely updated to the latest version (0.4.31), which introduced the deprecation warning since it was added in this version.
reference link: chronotope/chrono#1275

rtyler added a commit to rtyler/kafka-delta-ingest that referenced this issue Dec 9, 2023
This change includes a lot of minor changes to compile against newer
deltalake libraries

Closes delta-io#156
rtyler added a commit to rtyler/kafka-delta-ingest that referenced this issue Dec 17, 2023
This change includes a lot of minor changes to compile against newer
deltalake libraries

Closes delta-io#156
@rtyler rtyler closed this as completed in c800722 Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants