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

Enable casting of string to timestamp with microsecond resolution #3752

Merged
merged 2 commits into from Feb 23, 2023

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Feb 23, 2023

Which issue does this PR close?

Closes #3751.

Rationale for this change

Enable casting strings to timestamps with second, millisecond and microsecond resolution.

What changes are included in this PR?

Implement conversion of Utf8/LargeUtf8 timestamp strings to Timestamp(TimeUnit::Second, _)/Timestamp(TimeUnit::Millisecond, _)/Timestamp(TimeUnit::Microsecond, _) by making cast_string_to_timestamp generic.

Are there any user-facing changes?

No more casting errors for the said type pairs.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Feb 23, 2023
let scale_factor = match TimestampType::get_time_unit() {
TimeUnit::Microsecond => 1_000,
TimeUnit::Nanosecond => 1,
_ => return Err(ArrowError::CastError("String to timestamp casting supports only microsecond or nanosecond resolution".to_string()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a particular reason not to just support the full set whilst here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not to my knowledge; I can add them too if no one objects.

@tustvold
Copy link
Contributor

I have confirmed that the integration test in array_cast already contains examples of other timestamp array types

@tustvold tustvold merged commit 57f79c0 into apache:master Feb 23, 2023
@tustvold
Copy link
Contributor

Thank you

@ursabot
Copy link

ursabot commented Feb 23, 2023

Benchmark runs are scheduled for baseline = 9699e1d and contender = 57f79c0. 57f79c0 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

gruuya added a commit to splitgraph/arrow-rs that referenced this pull request Feb 23, 2023
…ache#3752)

* Enable casting of string to timestamp with microsecond resolution

* Enable string conversion to timestamp with second and millisecond resolution
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.

Support casting string to timestamp with microsecond resolution
3 participants