Skip to content

Commit

Permalink
fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Apr 28, 2024
1 parent 52de3f1 commit 7196ea1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/src/execution/datafusion/expressions/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,23 @@ fn do_cast_string_to_int<
let positive = ch == '+';
parsed_sign = true;
if negative || positive {
if i + 1 == len {
// input string is just "+" or "-"
return none_or_err(eval_mode, type_name, str);
}
// consume this char
continue;
} else if i + 1 == len {
return none_or_err(eval_mode, type_name, str);
}
}

if ch == '.' && eval_mode == EvalMode::Legacy {
// truncate decimal in legacy mode
state = State::ParseFractionalDigits;
// consume this char
continue;
if ch == '.' {
if eval_mode == EvalMode::Legacy {
// truncate decimal in legacy mode
state = State::ParseFractionalDigits;
continue;
} else {
return none_or_err(eval_mode, type_name, str);
}
}

let digit = if ch.is_ascii_digit() {
Expand Down

0 comments on commit 7196ea1

Please sign in to comment.