Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

branch-2.1: [fix](inverted index) Content Check for Tokenize Function Parser #44465 #44555

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions be/src/vec/functions/function_tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ Status FunctionTokenize::execute_impl(FunctionContext* /*context*/, Block& block
}
inverted_index_ctx.parser_type = get_inverted_index_parser_type_from_string(
get_parser_string_from_properties(properties));
if (inverted_index_ctx.parser_type == InvertedIndexParserType::PARSER_UNKNOWN) {
return Status::Error<doris::ErrorCode::INVERTED_INDEX_INVALID_PARAMETERS>(
"unsupported parser type. currently, only 'english', 'chinese', and "
"'unicode' analyzers are supported.");
}

inverted_index_ctx.parser_mode = get_parser_mode_string_from_properties(properties);
inverted_index_ctx.char_filter_map =
get_parser_char_filter_map_from_properties(properties);
Expand Down
11 changes: 11 additions & 0 deletions regression-test/suites/inverted_index_p0/test_tokenize.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.

import java.sql.SQLException

suite("test_tokenize"){
// prepare test table
Expand Down Expand Up @@ -98,4 +99,14 @@ suite("test_tokenize"){

qt_tokenize_sql """SELECT TOKENIZE('华夏智胜新税股票A', '"parser"="unicode"');"""
qt_tokenize_sql """SELECT TOKENIZE('华夏智胜新税股票A', '"parser"="unicode","stopwords" = "none"');"""

try {
sql """ SELECT TOKENIZE('华夏智胜新税股票A', '"parser"="eng"'); """
} catch (SQLException e) {
if (e.message.contains("E-6000")) {
log.info("e message: {}", e.message)
} else {
throw e
}
}
}
Loading