ByteBaker commented on code in PR #23316:
URL: https://github.com/apache/datafusion/pull/23316#discussion_r3523030676
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1374,14 +1381,20 @@ impl SessionContext {
let mut seconds = None;
for duration in duration.split_inclusive(&['m', 's']) {
- let (number, unit) = duration.split_at(duration.len() - 1);
+ let (unit_start, unit) =
+ duration.char_indices().next_back().ok_or_else(|| {
Review Comment:
Yes. The tests for empty value and non-ASCII value are covered by
`test_parse_duration`. The `ok_or_else()` branch itself is defensive since
`next_back()` can be `None` only for an empty string, which is rejected by the
earlier `duration.trim().is_empty()` guard before the loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]