diff --git a/src/sql/parser/ob_fast_parser.cpp b/src/sql/parser/ob_fast_parser.cpp index 207b9b6315..9a0eee0f8e 100644 --- a/src/sql/parser/ob_fast_parser.cpp +++ b/src/sql/parser/ob_fast_parser.cpp @@ -1181,7 +1181,7 @@ int64_t ObFastParserBase::is_hint_begin(int64_t pos) ch = raw_sql_.char_at(pos); next_ch = raw_sql_.char_at(++pos); // check and ignore comment - while (ch != '*' && next_ch != '/' && !raw_sql_.is_search_end()) { + while (ch != '*' && next_ch != '/' && !raw_sql_.is_search_end(pos)) { ch = raw_sql_.char_at(pos); next_ch = raw_sql_.char_at(++pos); } diff --git a/src/sql/parser/ob_fast_parser.h b/src/sql/parser/ob_fast_parser.h index 5b8b4dfda0..10c4da67ab 100644 --- a/src/sql/parser/ob_fast_parser.h +++ b/src/sql/parser/ob_fast_parser.h @@ -87,6 +87,10 @@ struct ObRawSql { { return search_end_ || cur_pos_ > raw_sql_len_ - 1; } + inline bool is_search_end(const int64_t pos) + { + return search_end_ || pos > raw_sql_len_ - 1; + } inline char peek() { if (cur_pos_ >= raw_sql_len_ - 1) {