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

Incorrect timestamp formatting in JSON response from /query Endpoint #2386

Open
nikrooz opened this issue Dec 5, 2024 · 2 comments
Open

Comments

@nikrooz
Copy link
Contributor

nikrooz commented Dec 5, 2024

Given that the timestamps are in UTC format, I anticipate a trailing Z:

Screenshot 2024-12-05 at 15 11 29

FYI, there was a similar issue in arrow-json apache/arrow-rs#3449 but it has been resolved for some time now.

@nikrooz
Copy link
Contributor Author

nikrooz commented Dec 5, 2024

CC @jackkleeman @slinkydeveloper

@jackkleeman
Copy link
Contributor

jackkleeman commented Dec 5, 2024

fn write_timestamp(
    f: &mut dyn Write,
    naive: NaiveDateTime,
    timezone: Option<Tz>,
    format: Option<&str>,
) -> FormatResult {
    match timezone {
        Some(tz) => {
            let date = Utc.from_utc_datetime(&naive).with_timezone(&tz);
            match format {
                Some(s) => write!(f, "{}", date.format(s))?,
                None => write!(f, "{}", date.to_rfc3339_opts(SecondsFormat::AutoSi, true))?,
            }
        }
        None => match format {
            Some(s) => write!(f, "{}", naive.format(s))?,
            None => write!(f, "{naive:?}")?,
        },
    }
    Ok(())
}

Heres the underlying function. I believe format will be none, so it would use the rfc3339 if it has a timezone, or otherwise it uses the default Debug impl for NaiveDateTime, which goes like 2015-06-30T23:59:60.500

The problem here is that the timestamp data itself is non timezoned. I will see if this is easily fixable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants