[ 
https://issues.apache.org/jira/browse/BEAM-4385?focusedWorklogId=108787&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-108787
 ]

ASF GitHub Bot logged work on BEAM-4385:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/18 22:19
            Start Date: 04/Jun/18 22:19
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on a change in pull request #5528: 
[BEAM-4385][SQL] Add LIKE operator to Beam SQL
URL: https://github.com/apache/beam/pull/5528#discussion_r192897300
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/interpreter/operator/comparison/BeamSqlLikeExpression.java
 ##########
 @@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package 
org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.comparison;
+
+import java.util.List;
+import java.util.regex.Pattern;
+import 
org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.BeamSqlExpression;
+
+/** {@code BeamSqlExpression} for 'LIKE' operation. */
+public class BeamSqlLikeExpression extends BeamSqlCompareExpression {
+
+  public BeamSqlLikeExpression(List<BeamSqlExpression> operands) {
+    super(operands);
+  }
+
+  @Override
+  public Boolean compare(CharSequence leftValue, CharSequence rightValue) {
+    String regexStr = rightValue.toString();
+
+    return Pattern.compile(regexStr).matcher(leftValue).matches();
 
 Review comment:
   Fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 108787)
    Time Spent: 50m  (was: 40m)

> Support LIKE operator
> ---------------------
>
>                 Key: BEAM-4385
>                 URL: https://issues.apache.org/jira/browse/BEAM-4385
>             Project: Beam
>          Issue Type: New Feature
>          Components: dsl-sql
>            Reporter: Kenneth Knowles
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently the LIKE operator is not supported. It is pretty important.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to