wuchong commented on a change in pull request #15110:
URL: https://github.com/apache/flink/pull/15110#discussion_r592966287



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -1108,11 +1109,20 @@ private TableResult executeOperation(Operation 
operation) {
             return buildShowResult("table name", listTables());
         } else if (operation instanceof ShowFunctionsOperation) {
             ShowFunctionsOperation showFunctionsOperation = 
(ShowFunctionsOperation) operation;
-            return buildShowResult(
-                    "function name",
-                    showFunctionsOperation.requireUser()
-                            ? listUserDefinedFunctions()
-                            : listFunctions());
+            String[] functionNames = null;
+            ShowFunctionsOperation.FunctionScope functionScope =
+                    showFunctionsOperation.getFunctionScope();
+            switch (functionScope) {
+                case USER:
+                    functionNames = listUserDefinedFunctions();
+                    break;
+                case ALL:
+                    functionNames = listFunctions();
+                    break;
+                default:
+                    throw new 
UnsupportedFunctionScopeException(functionScope.toString());

Review comment:
       We don't need to introduce a new Exception class. Can simply use `new 
UnsupportedOperationException(String.format("SHOW FUNCTIONS with %s scope is 
not supported.", scope))` here . 




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