MartijnVisser commented on code in PR #29334:
URL: https://github.com/apache/flink/pull/29334#discussion_r4362255921


##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/ExecutorImpl.java:
##########
@@ -110,6 +111,15 @@
 /** Executor to connect to {@link SqlGateway} and execute statements. */
 public class ExecutorImpl implements Executor {
 
+    /**
+     * The planner's own class for an incomplete statement, as a headline of 
the server trace. The
+     * message text is not searched, since the planner echoes the statement in 
it.
+     */
+    private static final Pattern INCOMPLETE_STATEMENT =

Review Comment:
   The snippet indents the echoed line by four spaces, so it can't start with 
the class name. The old check was a `contains` on the whole trace, and a shared 
helper would only replace this one regex, so I'd leave it.



##########
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/ExecutorImplITCase.java:
##########
@@ -218,6 +220,43 @@ void testCompleteStatement() {
         }
     }
 
+    @Test
+    void testIncompleteStatementIsReported() {

Review Comment:
   You're right, `CliClientMultiStatementITTest` fails without the check 
because of the multi-line `EXECUTE STATEMENT SET` in `statement_set.q`. I've 
removed the positive test.



##########
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliStringsTest.java:
##########
@@ -0,0 +1,289 @@
+/*
+ * 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.flink.table.client.cli;
+
+import org.apache.flink.runtime.rest.util.RestClientException;
+import org.apache.flink.table.api.SqlParserEOFException;
+import org.apache.flink.table.api.SqlParserException;
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.client.gateway.SqlExecutionException;
+
+import 
org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+
+import org.apache.calcite.sql.parser.SqlParseException;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for the exception line that {@link CliStrings#messageError} picks. */
+class CliStringsTest {

Review Comment:
   I'd keep them separate, they cover different branches: the length check, the 
`cause.toString()` check, the empty-message stop, and chain vs REST body. I've 
added the tab, no-frames, cause-less and REST class-name cases. A REST 
candidate without a message has an empty message, which never matches.



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