noorall commented on code in PR #27697:
URL: https://github.com/apache/flink/pull/27697#discussion_r2870675957


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/join/adaptive/AdaptiveJoinOperatorFactory.java:
##########
@@ -115,26 +121,20 @@ public Class<? extends StreamOperator> 
getStreamOperatorClass(ClassLoader classL
     }
 
     private void lazyInitialize() {
-        if 
(!tryInitializeAdaptiveJoin(Thread.currentThread().getContextClassLoader())) {
-            boolean isSuccess =
-                    tryInitializeAdaptiveJoin(
-                            
PlannerModule.getInstance().getSubmoduleClassLoader());
-            if (!isSuccess) {
-                throw new RuntimeException(
-                        "Failed to deserialize AdaptiveJoin instance. "
-                                + "Please check whether the 
flink-table-planner-loader.jar is in the classpath.");
-            }
-        }
-    }
-
-    private boolean tryInitializeAdaptiveJoin(ClassLoader classLoader) {
+        ClassLoader classLoader =
+                FlinkUserCodeClassLoaders.parentFirst(
+                        
PlannerModule.getInstance().getSubmoduleClassLoader().getURLs(),
+                        Thread.currentThread().getContextClassLoader(),
+                        NOOP_EXCEPTION_HANDLER,
+                        checkClassLoaderLeak);
         try {
             this.adaptiveJoin =
                     
InstantiationUtil.deserializeObject(adaptiveJoinSerialized, classLoader);
         } catch (ClassNotFoundException | IOException e) {
-            return false;
+            throw new RuntimeException(
+                    "Failed to deserialize AdaptiveJoin instance. "

Review Comment:
   Typically this situation should not happen. The existing workflow assumes 
that the current thread context `ClassLoader` or the table planner 
`ClassLoader` can resolve all required classes (**which is a wrong 
assumption**). Therefore, once this exception occurs, the most common cause is 
a missing **`flink-table-planner-loader.jar`**. The message is mainly meant to 
be user-friendly and to aid troubleshooting, and it does not imply this is the 
only possible root cause.
   
   1. Your understanding is correct.  
   2. The missing classes are not necessarily all contained in the 
planner-related jars; they can also come from the **user jar**.  
   3. As explained above, a missing `flink-table-planner-loader.jar` is the 
most common scenario, so this log message should be treated as a **suggestive 
troubleshooting hint** rather than a definitive diagnosis.



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