You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/10/28 02:12:38 UTC

[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #13304: Support mysql regular function visit

strongduanmu commented on a change in pull request #13304:
URL: https://github.com/apache/shardingsphere/pull/13304#discussion_r737968844



##########
File path: shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/impl/FunctionProjection.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.shardingsphere.infra.binder.segment.select.projection.impl;
+
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.ToString;
+import org.apache.shardingsphere.infra.binder.segment.select.projection.Projection;
+
+import java.util.Optional;
+
+/**
+ * Function projection.
+ */
+@RequiredArgsConstructor
+@Getter
+@EqualsAndHashCode
+@ToString
+public final class FunctionProjection implements Projection {

Review comment:
       @tuichenchuxin If we move FunctionSegment to ExpressionProjectionSegment, this class can be removed.

##########
File path: shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/expression/ExpressionAssert.java
##########
@@ -276,6 +278,26 @@ public static void assertBetweenExpression(final SQLCaseAssertContext assertCont
             SQLSegmentAssert.assertIs(assertContext, actual, expected);
         }
     }
+    
+    /**
+     * Assert function.

Review comment:
       Please add a blank line after java doc description.

##########
File path: shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
##########
@@ -83,6 +85,9 @@
         if (projectionSegment instanceof ExpressionProjectionSegment) {
             return Optional.of(createProjection((ExpressionProjectionSegment) projectionSegment));
         }
+        if (projectionSegment instanceof FunctionSegment) {
+            return Optional.of(createProjection((FunctionSegment) projectionSegment));

Review comment:
       @tuichenchuxin Can we merge FunctionSegment to ExpressionProjectionSegment?




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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