You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "liuml07 (via GitHub)" <gi...@apache.org> on 2025/10/02 02:18:03 UTC

Re: [PR] [FLINK-38087][sql-gateway] Improve OperationExecutor error messages and Java stream usage [flink]

liuml07 commented on code in PR #26781:
URL: https://github.com/apache/flink/pull/26781#discussion_r2396448944


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationExecutor.java:
##########
@@ -180,28 +182,28 @@ public ResultFetcher configureSession(OperationHandle handle, String statement)
         }
         Operation op = parsedOperations.get(0);
 
-        if (!(op instanceof SetOperation)
-                && !(op instanceof ResetOperation)
-                && !(op instanceof CreateOperation)
-                && !(op instanceof DropOperation)
-                && !(op instanceof UseOperation)
-                && !(op instanceof AlterOperation)
-                && !(op instanceof LoadModuleOperation)
-                && !(op instanceof UnloadModuleOperation)
-                && !(op instanceof AddJarOperation)) {
+        // Use LinkedHashMap to preserve insertion order
+        Map<Class<?>, String> ops = new LinkedHashMap<>();
+        ops.put(SetOperation.class, "SET");
+        ops.put(ResetOperation.class, "RESET");
+        ops.put(
+                CreateOperation.class,

Review Comment:
   This makes sense. More changes are made besides the subclasses: 1) use a static final variable instead of a local var for the map, 2) added a few more missing operations:
   ```
     - CreateTempSystemFunctionOperation - CREATE TEMPORARY SYSTEM FUNCTION
     - DropTempSystemFunctionOperation - DROP TEMPORARY SYSTEM FUNCTION
     - AlterViewOperation - ALTER VIEW
     - AlterCatalogOptionsOperation - ALTER CATALOG SET
     - AlterCatalogResetOperation - ALTER CATALOG RESET
     - AlterCatalogCommentOperation - ALTER CATALOG SET COMMENT
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org