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
Enable casting of string to timestamp with microsecond resolution #3752
Conversation
arrow-cast/src/cast.rs
Outdated
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())) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
I have confirmed that the integration test in array_cast already contains examples of other timestamp array types |
Thank you |
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. |
…ache#3752) * Enable casting of string to timestamp with microsecond resolution * Enable string conversion to timestamp with second and millisecond resolution
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 toTimestamp(TimeUnit::Second, _)
/Timestamp(TimeUnit::Millisecond, _)
/Timestamp(TimeUnit::Microsecond, _)
by makingcast_string_to_timestamp
generic.Are there any user-facing changes?
No more casting errors for the said type pairs.