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

Add timezone offset for debug format of Timestamp with Timezone #2917

Closed
waitingkuo opened this issue Oct 24, 2022 · 4 comments · Fixed by #3072
Closed

Add timezone offset for debug format of Timestamp with Timezone #2917

waitingkuo opened this issue Oct 24, 2022 · 4 comments · Fixed by #3072
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@waitingkuo
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

fn main() {
    let arr = TimestampSecondArray::from_vec(vec![0], Some("America/New_York".to_string()));
    println!("{:?}", a);
}

this outputs followings for now

PrimitiveArray<Timestamp(Second, None)>
[
  1970-01-01 00:00:00,
]

Describe the solution you'd like

outputs something like this

PrimitiveArray<Timestamp(Second, Some("America/New_York"))>
[
  1969-12-31 19:00:00 -05:00,
]

Describe alternatives you've considered

Additional context

we could extends

DataType::Timestamp(_, _) => {
let v = self.value(index).to_isize().unwrap() as i64;
match as_datetime::<T>(v) {
Some(datetime) => write!(f, "{:?}", datetime),
None => write!(f, "null"),
}
}

by as_datetime_with_timezone which will be added in #2909

@waitingkuo waitingkuo added the enhancement Any new improvement worthy of a entry in the changelog label Oct 24, 2022
@waitingkuo
Copy link
Contributor Author

waitingkuo commented Oct 26, 2022

@tustvold @jhorstmann do you think we should show
1970-01-01T00:00:00 or
1969-12-31T19:00:00-05:00
in this case?

in prettyprint i prefer the one with timezone shift. but for the Debug, should we just show the underline datetime without the offset shift?

@tustvold
Copy link
Contributor

My vote would be for consistently outputting RFC3339

@waitingkuo
Copy link
Contributor Author

if timezone is incorrect, say "Asia/Taipei2", should we output something like this?

+--------------------------------------------------------+
| Timestamp(Second, Some("Asia/Taipei2")) |
+--------------------------------------------------------+
| 1970-01-01T00:00:00 (Unknown Time Zone 'Asia/Taipei2') |
+--------------------------------------------------------+

note that this the prettyprint's result in #2939

@waitingkuo waitingkuo changed the title Add timezone offset while displaying Timestamp with Timezone Add timezone offset for debug format of Timestamp with Timezone Oct 27, 2022
@alamb alamb added the arrow Changes to the arrow crate label Nov 11, 2022
@alamb
Copy link
Contributor

alamb commented Nov 11, 2022

label_issue.py automatically added labels {'arrow'} from #3072

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants