JingsongLi commented on code in PR #87:
URL: https://github.com/apache/flink-table-store/pull/87#discussion_r849016332


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/predicate/PredicateConverter.java:
##########
@@ -95,9 +109,49 @@ public Predicate visit(CallExpression call) {
                     .map(FieldReferenceExpression::getFieldIndex)
                     .map(IsNotNull::new)
                     .orElseThrow(UnsupportedExpression::new);
+        } else if (func == BuiltInFunctionDefinitions.LIKE) {
+            FieldReferenceExpression fieldRefExpr =
+                    
extractFieldReference(children.get(0)).orElseThrow(UnsupportedExpression::new);
+            if (fieldRefExpr
+                    .getOutputDataType()
+                    .getLogicalType()
+                    .is(LogicalTypeFamily.CHARACTER_STRING)) {
+                String sqlPattern =
+                        extractLiteral(fieldRefExpr.getOutputDataType(), 
children.get(1))
+                                .orElseThrow(UnsupportedExpression::new)
+                                .value()
+                                .toString();
+                String escape =
+                        children.size() <= 2
+                                ? null
+                                : 
extractLiteral(fieldRefExpr.getOutputDataType(), children.get(2))
+                                        
.orElseThrow(UnsupportedExpression::new)
+                                        .value()
+                                        .toString();
+                String regexPattern = SqlLikeUtils.sqlToRegexLike(sqlPattern, 
escape);
+                Matcher matcher1 = 
SUPPORTED_JAVA_BEGIN_PATTERN1.matcher(regexPattern);

Review Comment:
   Why we use java regex here?
   I'm more concerned about whether the rule is perfect, for example, if it 
contains '*', it looks like it is not recognized as starsWith.
   Why can't we be consistent with Flink `LikeCallGen`?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to