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

prettyprint to show timezone offset for timestamp with timezone #2937

Closed
waitingkuo opened this issue Oct 26, 2022 · 1 comment · Fixed by #2939
Closed

prettyprint to show timezone offset for timestamp with timezone #2937

waitingkuo opened this issue Oct 26, 2022 · 1 comment · Fixed by #2939
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.

I'd like to print timezone offset when the timestamp contains timezone

Describe the solution you'd like

i would like this

use arrow::array::{
    Array, TimestampSecondArray,
};
use arrow::datatypes::*;
use arrow::record_batch::RecordBatch;
use std::sync::Arc;

use arrow::util::pretty::print_batches;

fn main() {


    let arr = TimestampSecondArray::from_vec(vec![0], Some("+08:00".to_string()));
    let schema = Arc::new(Schema::new(vec![Field::new(
        "f",
        arr.data_type().clone(),
        true,
    )]));

    let batch = RecordBatch::try_new(schema, vec![Arc::new(arr)]).unwrap();
    print_batches(&[batch]).unwrap();
}

to output

+---------------------------+
| f                         |
+---------------------------+
| 1970-01-01T08:00:00+08:00 |
+---------------------------+

instead of

+---------------------+
| f                   |
+---------------------+
| 1970-01-01 00:00:00 |
+---------------------+

Describe alternatives you've considered

Additional context

@waitingkuo waitingkuo added the enhancement Any new improvement worthy of a entry in the changelog label Oct 26, 2022
@waitingkuo waitingkuo changed the title prettyprint shows timezone offset for timestamp with timezone prettyprint to show timezone offset for timestamp with timezone Oct 26, 2022
@alamb alamb added the arrow Changes to the arrow crate label Oct 28, 2022
@alamb
Copy link
Contributor

alamb commented Oct 28, 2022

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

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.

2 participants