imay commented on a change in pull request #3579: URL: https://github.com/apache/incubator-doris/pull/3579#discussion_r425079015
########## File path: be/src/exec/es/es_query_builder.cpp ########## @@ -113,12 +113,17 @@ WildCardQueryBuilder::WildCardQueryBuilder(const ExtLikePredicate& like_predicat // example of translation : // abc_123 ===> abc?123 // abc%ykz ===> abc*123 + // %abc123 ===> *abc123 + // _abc123 ===> ?abc123 + // \\_abc1 ===> \\_abc1 // abc\\_123 ===> abc\\_123 // abc\\%123 ===> abc\\%123 // NOTE. user must input sql like 'abc\\_123' or 'abc\\%ykz' for (int i = 0; i< _like_value.size(); i++) { - if ((_like_value[i] == '_' || _like_value[i]== '%') && i > 0) { - if (_like_value[i-1] != '\\' ) { + if (_like_value[i] == '_' || _like_value[i]== '%') { Review comment: ```suggestion if (_like_value[i] == '_' || _like_value[i] == '%') { ``` ########## File path: be/src/exec/es/es_query_builder.cpp ########## @@ -113,12 +113,17 @@ WildCardQueryBuilder::WildCardQueryBuilder(const ExtLikePredicate& like_predicat // example of translation : // abc_123 ===> abc?123 // abc%ykz ===> abc*123 + // %abc123 ===> *abc123 + // _abc123 ===> ?abc123 + // \\_abc1 ===> \\_abc1 // abc\\_123 ===> abc\\_123 // abc\\%123 ===> abc\\%123 // NOTE. user must input sql like 'abc\\_123' or 'abc\\%ykz' for (int i = 0; i< _like_value.size(); i++) { - if ((_like_value[i] == '_' || _like_value[i]== '%') && i > 0) { - if (_like_value[i-1] != '\\' ) { + if (_like_value[i] == '_' || _like_value[i]== '%') { + if (i == 0) { + _like_value[i] = (_like_value[i] == '_') ? '?' : '*'; + } else if (_like_value[i-1] != '\\' ) { Review comment: ```suggestion } else if (_like_value[i - 1] != '\\' ) { ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org