fsk119 commented on a change in pull request #15383:
URL: https://github.com/apache/flink/pull/15383#discussion_r602060291



##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -487,6 +491,12 @@ private void callSet(SqlCommandCall cmdCall) {
         }
     }
 
+    private void setSqlCliVerbose(String key, String value) {
+        if (SqlClientOptions.VERBOSE.key().equals(key)) {
+            isVerbose = Boolean.parseBoolean(value);
+        }
+    }

Review comment:
       It's a little hack. I think we'd better to read option value from the 
SessionContext. 
   
   Because we also have RESET command and it would be modified by the RESET. 
   

##########
File path: flink-table/flink-sql-client/src/test/resources/sql/verbose.q
##########
@@ -0,0 +1,119 @@
+# function.q - CREATE/DROP/ALTER FUNCTION
+#
+# 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.
+
+SET sql-client.verbose = false;
+[INFO] Session property has been set.
+!info
+
+select * from test_table;
+[ERROR] Could not execute SQL statement. Reason:
+org.apache.calcite.sql.validate.SqlValidatorException: Object 'test_table' not 
found
+!error
+
+SET sql-client.verbose = true;
+[INFO] Session property has been set.
+!info
+
+select * from test_table;
+[ERROR] Could not execute SQL statement. Reason:
+org.apache.calcite.sql.validate.SqlValidatorException: 
org.apache.calcite.sql.validate.SqlValidatorException: Object 'test_table' not 
found
+       at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
+       at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
+       at 
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
+       at 
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
+       at 
org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:467)
+       at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:560)
+       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:883)
+       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:868)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5043)
+       at 
org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:179)
+       at 
org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:184)
+       at 
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1067)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1041)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3205)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3187)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3461)
+       at 
org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
+       at 
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1067)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1041)
+       at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:232)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1016)
+       at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:724)
+       at 
org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:147)
+       at 
org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:107)
+       at 
org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:199)
+       at 
org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:99)
+       at 
org.apache.flink.table.client.gateway.local.LocalExecutor$1.lambda$parse$0(LocalExecutor.java:181)
+       at 
org.apache.flink.table.client.gateway.context.ExecutionContext.wrapClassLoader(ExecutionContext.java:90)
+       at 
org.apache.flink.table.client.gateway.local.LocalExecutor$1.parse(LocalExecutor.java:181)
+       at 
org.apache.flink.table.client.cli.SqlCommandParser.parseBySqlParser(SqlCommandParser.java:104)
+       at 
org.apache.flink.table.client.cli.SqlCommandParser.parse(SqlCommandParser.java:97)
+       at 
org.apache.flink.table.client.cli.CliClient.parseCommand(CliClient.java:275)
+       at org.apache.flink.table.client.cli.CliClient.open(CliClient.java:228)
+       at 
org.apache.flink.table.client.cli.CliClientITCase.runSqlStatements(CliClientITCase.java:156)
+       at 
org.apache.flink.table.client.cli.CliClientITCase.testSqlStatements(CliClientITCase.java:123)
+       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
+       at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
+       at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
+       at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
+       at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
+       at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
+       at 
org.apache.flink.util.TestNameProvider$1.evaluate(TestNameProvider.java:45)
+       at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
+       at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
+       at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
+       at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
+       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
+       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
+       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
+       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
+       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
+       at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
+       at org.junit.runners.Suite.runChild(Suite.java:128)
+       at org.junit.runners.Suite.runChild(Suite.java:27)
+       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
+       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
+       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
+       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
+       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
+       at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
+       at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
+       at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
+       at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
+       at org.junit.rules.RunRules.evaluate(RunRules.java:20)
+       at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
+       at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
+       at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
+       at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
+       at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
+       at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

Review comment:
       I am not sure this is stable? In mvn test, it will print the same 
exception stack ?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to