xuzifu666 commented on code in PR #4434:
URL: https://github.com/apache/calcite/pull/4434#discussion_r2162903354


##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/QueryBuilders.java:
##########
@@ -499,12 +501,27 @@ static class RegexpQueryBuilder extends QueryBuilder {
     private final String value;
 
     RegexpQueryBuilder(final String fieldName, final String value) {
+      requireNonNull(fieldName, "fieldName");
+      requireNonNull(value, "value");
       this.fieldName = fieldName;
-      this.value = value;
+      // replace % to * and _ to ? for sql with like operator
+      this.value = replaceWildcard(replaceWildcard(value, "%", "*"), "_", "?");

Review Comment:
   I had test the case:
   ```String str = replaceWildcard("a\nsss%","%","*");```
   it would return "a\nsss*", it seems work well,
   and I test another case:
   ```String str = replaceWildcard("a\nsss%","\n","*");```
   it would return "a*sss%", which also work well. But I'm not sure if this is 
what you're concerned about. @mihaibudiu 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to