strongduanmu commented on a change in pull request #12280:
URL: https://github.com/apache/shardingsphere/pull/12280#discussion_r704996787
##########
File path:
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/SQLStatementAssert.java
##########
@@ -49,6 +56,9 @@
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final SQLStatement actual, final SQLParserTestCase expected) {
ParameterMarkerAssert.assertCount(assertContext,
actual.getParameterCount(), expected.getParameters().size());
+ if (!expected.getComments().isEmpty()) {
Review comment:
@tuichenchuxin Can we add a `CommentAssert` to handle this logic? And
move `if (!expected.getComments().isEmpty())` into the `assertComment` method.
##########
File path:
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/generic/CommentSegment.java
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.sql.parser.sql.common.segment.generic;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Comment segment.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class CommentSegment {
Review comment:
@tuichenchuxin Please extends SQLSegment interface.
##########
File path:
shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/SQLParserTestCase.java
##########
@@ -41,6 +44,9 @@
@XmlAttribute
private String parameters;
+ @XmlElement(name = "comments")
+ private List<ExpectedComment> comments = new LinkedList<>();
Review comment:
@tuichenchuxin `@XmlElement(name = "comment")` may be better.
--
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]