1996fanrui commented on code in PR #1738:
URL: 
https://github.com/apache/incubator-streampark/pull/1738#discussion_r991318472


##########
streampark-flink/streampark-flink-proxy/src/main/scala/org/apache/streampark/flink/proxy/FlinkShimsProxy.scala:
##########
@@ -81,59 +83,106 @@ object FlinkShimsProxy extends Logger {
     })
   }
 
-  private[this] def getFlinkShimsClassLoader(flinkVersion: FlinkVersion): 
ClassLoader = {
+  // flink 1.12 1.13~1.14 1.15 parseSql class exist in different dependencies,
+  //need to load all flink-table dependencies compatible with different 
versions
+  def getVerifySqlLibClassLoader(flinkVersion: FlinkVersion): ClassLoader = {
+    logInfo(s"add  verify sql lib,flink version:  $flinkVersion")
+    
VERIFY_SQL_CLASS_LOADER_CACHE.getOrElseUpdate(s"${flinkVersion.fullVersion}", {
+      val getFlinkTable: File => Boolean = _.getName.startsWith("flink-table")
+      // 1) flink/lib/flink-table*
+      val libTableURL = getFlinkHomeLib(flinkVersion.flinkHome, "lib", 
getFlinkTable)
+
+      // 2) After version 1.15 need add flink/opt/flink-table*
+      val optTableURL = getFlinkHomeLib(flinkVersion.flinkHome, "opt", 
getFlinkTable)
+      val shimsUrls = ListBuffer[URL](libTableURL ++ optTableURL: _*)
+
+      // 3) add only streampark shims jar
+      addShimsUrls(flinkVersion, shimsUrls, 
_.getName.startsWith("streampark-flink-shims"))
+      new ChildFirstClassLoader(
+        shimsUrls.toArray,
+        Thread.currentThread().getContextClassLoader,
+        getFlinkShimsResourcePattern(flinkVersion.majorVersion)
+      )
+    })
+  }
+
+  def addShimsUrls(flinkVersion: FlinkVersion, shimsUrls: ListBuffer[URL], 
filterJar: File => Boolean): Unit = {

Review Comment:
   As I understand, this comment just refactor, not change the logic, right?



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