leonardBang commented on code in PR #21806:
URL: https://github.com/apache/flink/pull/21806#discussion_r1092856636


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/keyselector/GenericRowDataKeySelector.java:
##########
@@ -44,7 +44,23 @@ public GenericRowDataKeySelector(
         this.keySerializer = keySerializer;
     }
 
-    public void open() {
+    /**
+     * Compiles projection class in advance using provided classloader.
+     *
+     * <p>Note: this method should be called only from main Flink thread.
+     */
+    public void compileProjection(ClassLoader classLoader) {
+        generatedProjection.compile(classLoader);
+    }
+
+    /**
+     * Creates projection instance in advance.
+     *
+     * <p>Note: if projection was already compiled by {@link 
this#compileProjection(ClassLoader)},
+     * {@code Class<Projection>} should be already cached inside {@link 
GeneratedProjection}, so no
+     * compilation or another interaction with contex classLoader will happen.
+     */
+    public void open() throws Exception {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();

Review Comment:
   Could we ensure  ClassLoader cl is userCodeClassLoader?



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