Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Nov 21, 2024
1 parent ce0ac43 commit bda45be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions be/src/vec/common/string_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ struct StringRef {
explicit operator std::string() const { return to_string(); }
operator std::string_view() const { return std::string_view {data, size}; }

StringRef substring(int start_pos, int new_len) const {
StringRef substring(int64_t start_pos, int64_t new_len) const {
return {data + start_pos, (new_len < 0) ? (size - start_pos) : new_len};
}

StringRef substring(int start_pos) const { return substring(start_pos, size - start_pos); }
StringRef substring(int64_t start_pos) const { return substring(start_pos, size - start_pos); }

const char* begin() const { return data; }
const char* end() const { return data + size; }
Expand Down
8 changes: 3 additions & 5 deletions be/src/vec/functions/like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ Status FunctionLikeBase::constant_starts_with_fn_scalar(LikeSearchState* state,
const StringRef& pattern,
unsigned char* result) {
*result = (val.size >= state->search_string_sv.size) &&
(state->search_string_sv ==
val.substring(0, cast_set<int>(state->search_string_sv.size)));
(state->search_string_sv == val.substring(0, state->search_string_sv.size));
return Status::OK();
}

Expand Down Expand Up @@ -290,9 +289,8 @@ Status FunctionLikeBase::constant_ends_with_fn_scalar(LikeSearchState* state, co
const StringRef& pattern,
unsigned char* result) {
*result = (val.size >= state->search_string_sv.size) &&
(state->search_string_sv ==
val.substring(cast_set<int>(val.size - state->search_string_sv.size),
cast_set<int>(state->search_string_sv.size)));
(state->search_string_sv == val.substring(val.size - state->search_string_sv.size,
state->search_string_sv.size));
return Status::OK();
}

Expand Down

0 comments on commit bda45be

Please sign in to comment.