Skip to content

Commit

Permalink
strict string parse
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijchen committed Mar 13, 2024
1 parent 87f1191 commit a56c2b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions be/src/vec/functions/function_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,11 @@ struct ConvertThroughParsing {
parsed = try_parse_impl<ToDataType, void*, FromDataType>(
vec_to[i], read_buffer, context->state()->timezone_obj());
}
bool parse_success = parsed && is_all_read(read_buffer);
if (string_size > 0 && !parse_success) {
std::string_view raw{reinterpret_cast<const char *>(&(*chars)[current_offset]), string_size};
return Status::RuntimeError("failed to parse '{}' as {}", raw, col_to->get_name());
}
(*vec_null_map_to)[i] = !parsed || !is_all_read(read_buffer);
current_offset = next_offset;
}
Expand Down

0 comments on commit a56c2b1

Please sign in to comment.