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

fix debug information for Timestamp with Timezone #3072

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

waitingkuo
Copy link
Contributor

Which issue does this PR close?

Closes #2917

Rationale for this change

    let a =
        TimestampSecondArray::from(vec![0]).with_timezone_opt(Some("+08:00".to_string()));
    println!("{:?}", a);

    let a =
        TimestampSecondArray::from(vec![0]).with_timezone_opt(Some("xxx".to_string()));
    println!("{:?}", a);

    let a = TimestampSecondArray::from(vec![0])
        .with_timezone_opt(Some("Asia/Taipei".to_string()));
    println!("{:?}", a);

outputs

PrimitiveArray<Timestamp(Second, Some("+08:00"))>
[
  1970-01-01T08:00:00+08:00,
]
PrimitiveArray<Timestamp(Second, Some("xxx"))>
[
  1970-01-01T00:00:00 (Unknown Time Zone 'xxx'),
]
PrimitiveArray<Timestamp(Second, Some("Asia/Taipei"))>
[
  1970-01-01T08:00:00+08:00,
]

What changes are included in this PR?

Are there any user-facing changes?

yes, debug information for timestamp changed

@waitingkuo
Copy link
Contributor Author

cc @tustvold

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 10, 2022
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +1412 to 1425
#[test]
#[cfg(feature = "chrono-tz")]
fn test_timestamp_with_tz_with_daylight_saving_fmt_debug() {
let arr: PrimitiveArray<TimestampMillisecondType> =
TimestampMillisecondArray::from(vec![
1647161999000,
1647162000000,
1667717999000,
1667718000000,
])
.with_timezone("America/Denver".to_string());
assert_eq!(
"PrimitiveArray<Timestamp(Millisecond, Some(\"America/Denver\"))>\n[\n 2022-03-13T01:59:59-07:00,\n 2022-03-13T03:00:00-06:00,\n 2022-11-06T00:59:59-06:00,\n 2022-11-06T01:00:00-06:00,\n]",
format!("{:?}", arr)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add these test cases to timezone with daylight saving

Comment on lines +561 to +564
Ok(tz) => match as_datetime_with_timezone::<T>(v, tz) {
Some(datetime) => write!(f, "{}", datetime.to_rfc3339()),
None => write!(f, "null"),
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outputs to rfc3339 format if tz parsed successfully

@tustvold tustvold merged commit a0fb44a into apache:master Nov 10, 2022
@ursabot
Copy link

ursabot commented Nov 10, 2022

Benchmark runs are scheduled for baseline = d76a0d6 and contender = a0fb44a. a0fb44a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add timezone offset for debug format of Timestamp with Timezone
3 participants