CodingBingo commented on a change in pull request #12295:
URL: https://github.com/apache/shardingsphere/pull/12295#discussion_r708116710



##########
File path: 
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/expression/ExpressionSegmentUtil.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.expression;
+
+import com.google.common.collect.Lists;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
+
+import java.util.List;
+
+/**
+ * Expression segment util.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class ExpressionSegmentUtil {
+    /**
+     * Extract all ParameterMarkerExpressionSegment from ExpressionSegment 
list.
+     *
+     * @param expressions ExpressionSegment list
+     * @return ParameterMarkerExpressionSegment list
+     */
+    public static List<ParameterMarkerExpressionSegment> 
extractParameterMarkerExpressionSegment(final List<ExpressionSegment> 
expressions) {
+        List<ParameterMarkerExpressionSegment> extractList = 
Lists.newArrayList();
+        for (ExpressionSegment each : expressions) {
+            if (each instanceof ParameterMarkerExpressionSegment) {

Review comment:
       I have questions here, this method is only works for 
**InsertStatementContext**, the method name should be more specific, such as 
**extractParameterMarkerExpressionSegmentInInsertStatementContext**
   in addition, if we enum all class here, another class added, they need to 
change this class, I am thinking if there is a better way.




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